Jump to content
  • 0

Hey guys help me with revert


Mytz_321

Question

anyone know how to make revert in the script i have 2 code but if i revert only last code revert -_

function gj()
gg.searchNumber('526',gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)
revert = gg.getResults()
gg.editAll('65536',gg.TYPE_DWORD)
t = gg.getResults()
gg.addListItems(t)
gg.toast('Anti pinball done')
end

function gh()
gg.searchNumber('526',gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)
revert = gg.getResults()
gg.editAll('0',gg.TYPE_DWORD)
t = gg.getResults()
gg.addListItems(t)
gg.toast('Anti pinball done')
end

fucntion rev()
if revert ~= nil then gg.setValues(revert) end
end

 

 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • Administrators

You need add to revert table all new results. Not replace table - add new items in old table.

But it is memory leak. If your script work long this can cause out of memory if you put in revert table huge amount of items.

Link to comment
Share on other sites

9 minutes ago, Enyby said:

You need add to revert table all new results. Not replace table - add new items in old table.

But it is memory leak. If your script work long this can cause out of memory if you put in revert table huge amount of items.

can you show me code? idk what you say hehehe

Link to comment
Share on other sites

on = "[ ON ]"
off = "[ OFF ]"
status = off

function main()
local menu = gg.choice({status.." Anti pinball", "Exit"}, nil, "Demo script.")
if menu == 1 then
if status == off then
status = on
else
status = off
end
process()
elseif menu == 2 then
os.exit()
end
end

function process()
if status == on then
gg.searchNumber("526", gg.TYPE_DWORD)
save = gg.getResults(100) -- Many values will be saved
gg.editAll("65536", gg.TYPE_DWORD)
gg.addListItems(save)
gg.clearResults()
gg.toast("Success active Anti pinball!", true)
else
-- Reverting values
gg.getListItems(save)
for i, v in ipairs(save) do
save[i].value = "526"
end
gg.setValues(save)
gg.removeListItems(save)
gg.toast("Success deactive Anti pinball!", true)
end
end

while true do
if gg.isVisible() then
gg.setVisible(false)
main()
end
end

You can use this if you want

Link to comment
Share on other sites

1 minute ago, maulz said:

on = "[ ON ]"
off = "[ OFF ]"
status = off

function main()
local menu = gg.choice({status.." Anti pinball", "Exit"}, nil, "Demo script.")
if menu == 1 then
if status == off then
status = on
else
status = off
end
process()
elseif menu == 2 then
os.exit()
end
end

function process()
if status == on then
gg.searchNumber("526", gg.TYPE_DWORD)
save = gg.getResults(100) -- Many values will be saved
gg.editAll("65536", gg.TYPE_DWORD)
gg.addListItems(save)
gg.clearResults()
gg.toast("Success active Anti pinball!", true)
else
-- Reverting values
gg.getListItems(save)
for i, v in ipairs(save) do
save[i].value = "526"
end
gg.setValues(save)
gg.removeListItems(save)
gg.toast("Success deactive Anti pinball!", true)
end
end

while true do
if gg.isVisible() then
gg.setVisible(false)
main()
end
end

You can use this if you want

if the value not 526?

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.