Jump to content
  • 0

search address and increase value


edwinn

Question

Posted

hi all. I need so help here. I want to create a lua script to constantly increase value '1200' to the 2 addresses found if value change. My script as below but I not sure why sometimes the values will increase 1200 and sometimes the value will increase 2400. Any one can help?

data = gg.prompt({[1]='Search Address 1', [2]='Search Address 2', [3]='Value'}, {[1]='13EE7610', [2]='13EE75A0', [3]='1200'})
gg.searchAddress(data[1], gg.TYPE_DWORD)
gg.searchAddress(data[2], gg.TYPE_DWORD)

while true do
local t = gg.getResults(2)
local old = {}
old = t[1].value
t= gg.getValues(t)
if old ~=t[1].value then
t[1].value=t[1].value+data[3]
t[2].value=t[1].value
end
gg.setValues(t)
end

 

Thanks and have a good day.

5 answers to this question

Recommended Posts

Posted
13 minutes ago, Enyby said:

Move outside loop.

I tried but the value keep increasing non stop. I forgot to mention that I want the value only increase '1200' every time when I pop the "blocks".

Thanks for help.

  • Administrators
Posted
local t = gg.getResults(2)
local old = t[1].value
while true do
  t = gg.getValues(t)
  if old ~= t[1].value then
    old = old + data[3]
    t[1].value = old
    t[2].value = old
    gg.setValues(t)
  end
end

 

Posted
13 hours ago, Enyby said:

local t = gg.getResults(2)
local old = t[1].value
while true do
  t = gg.getValues(t)
  if old ~= t[1].value then
    old = old + data[3]
    t[1].value = old
    t[2].value = old
    gg.setValues(t)
  end
end

Thanks it is working.

It is working. Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.