Jump to content
  • 0

how to track value change


marken

Question

this is for 1 value change .

local v = gg.getResults(1) gg.setVisible(false) while not gg.isVisible() do     local old = v[1].value     v = gg.getValues(v) if old ~= v[1].value then         gg.toast('changed: '..old..' -> '..v[1].value)     end     gg.sleep(100) end

 

how to make this 2 value change like 2 adress/or 2 result ?

this script is a big help for me esp farming

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

The idea is same for tracking changes of multiple values. Just few things need to be changed in the code:

1. Build/get a table with all required values, not just one. Example: 

local t = gg.getResults(2) -- Using first two results
t[#t + 1] = {address = 0x11223344, flags = gg.TYPE_DWORD} -- And a value at custom address

2. Save old values of table elements before entering loop. Custom field can be used for that. Example: 

t = gg.getValues(t)
for i, v in ipairs(t) do
  v.old_value = v.value
end

3. Process all elements of the table in loop. Example: 

while not gg.isVisible() do
  t = gg.getValues(t)
  for i, v in ipairs(t) do
    if v.value ~= v.old_value then
      -- do something
      v.old_value = v.value
    end
  end
  gg.sleep(100)
end
Link to comment
Share on other sites

local v = gg.getResults(1) gg.setVisible(false) while not gg.isVisible() do     local old = v[1].value     v = gg.getValues(v) if old ~= v[1].value then         gg.setSpeed(1.0)gg.toast('changed: '..old..' -> '..v[1].value)     end     gg.sleep(100) end
gg.getResults(2)
do     local old = v[2].value     v = gg.getValues(v) if old ~= v[2].value then         gg.setSpeed(90.0)gg.toast('changed: '..old..' -> '..v[2].value)     end     gg.sleep(100) end

[added 3 minutes later]

error. how do i make that

 1st result make normal speed 

and second result make faster.

Link to comment
Share on other sites

local v = gg.getResults(1) gg.setVisible(false) while not gg.isVisible() do     local old = v[1].value     v = gg.getValues(v) if old ~= v[1].value then         gg.setSpeed(1.0)
gg.toast('changed: '..old..' -> '..v[1].value)     end     gg.sleep(100) end

 

this is working

my problem is how do i make second result for gg.setSpeed(90.0)

 

tnx for help

Link to comment
Share on other sites

6 minutes ago, marken said:

my problem is how do i make second result for gg.setSpeed(90.0)

Identically to the code for one value, just different actions in "if" blocks. For example: 

local v = gg.getResults(2)
gg.setVisible(false)
while not gg.isVisible() do
  local old1 = v[1].value
  local old2 = v[2].value
  v = gg.getValues(v)
  if old1 ~= v[1].value then
    gg.setSpeed(1.0)
    gg.toast('First value has changed: ' .. old1 .. ' -> ' .. v[1].value)
  end
  if old2 ~= v[2].value then
    gg.setSpeed(90.0)
    gg.toast('Second value has changed: ' .. old2 .. ' -> ' .. v[2].value)
  end
  gg.sleep(100)
end
Link to comment
Share on other sites

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.