Jump to content
edwinn

search address and increase value

Recommended Posts

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.

Share this post


Link to post
Share on other sites

44 minutes ago, edwinn said:

local t = gg.getResults(2)
local old = {}
old = t[1].value

Move outside loop.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

 

Share this post


Link to post
Share on other sites

Wouldn't you be better to modify offset to achieve same thing??

Share this post


Link to post
Share on other sites
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

Edited by edwinn

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...