function main()
menu = gg.choice({"DMG Hack", "Exit"}, nil, "Select Cheat")
if menu == 1 then
setDmg()
elseif menu == 2 then
return true -- Use return true to indicate script should exit.
else
noselect()
end
return false -- Continue running the script.
end
function setDmg()
gg.setVisible(false)
local input = gg.prompt({"Input your current Final ATK"}, nil, {"number"})
local input2 = gg.prompt({"Input your current Final DEF"}, nil, {"number"})
if not input or not input2 then
gg.alert("You didn't enter a value")
return
end
input, input2 = input[1], input2[1] -- Simplify access to values.
-- This loop is now dedicated to updating the values continuously.
while true do
if gg.isVisible() then
return -- Exit this function when the GG overlay becomes visible, giving control back to the main loop.
end
gg.clearResults()
searchAndEdit(input, "100000000")
searchAndEdit(input2, "100000000")
gg.sleep(100) -- Slight delay to prevent script from running too fast and consuming too much CPU.
end
end
function searchAndEdit(searchValue, editValue)
gg.searchNumber(searchValue, gg.TYPE_DOUBLE, false, gg.SIGN_EQUAL, 0, -1)
gg.refineNumber(searchValue, gg.TYPE_DOUBLE, false, gg.SIGN_EQUAL, 0, -1)
gg.getResults(100)
gg.editAll(editValue, gg.TYPE_DOUBLE)
gg.clearResults()
end
function noselect()
gg.toast("Please make a selection")
end
gg.setVisible(false) -- Initially hide the overlay.
while true do
if gg.isVisible(true) then
gg.setVisible(false) -- Immediately hide the overlay after it becomes visible.
if main() then break end -- Exit the script if main returns true.
end
gg.sleep(100) -- Keep the delay to prevent script from hogging CPU resources.
end