Possible version of your script.
Search is done once when script starts.
Then it goes into invisible mode and waits for GG icon to be pressed.
Until you select “Exit”, all found data in tables will be saved.
gg.isVisible(false)
gg.clearResults()
gg.clearList()
-------------Flying cost--------------------
gg.searchNumber( "-8.0004e10",gg.TYPE_FLOAT)
-- Why do a refining if you don’t have a group search?
gg.refineNumber(' -8.0004e10',gg.TYPE_FLOAT)
Fly = gg.getResults(gg.getResultsCount())
gg.clearResults()
-------------Energy cost--------------------
gg.searchNumber('55;53', gg.TYPE_FLOAT)
-- Refining is needed here.
gg.refineNumber('53', gg.TYPE_FLOAT)
Energy = gg.getResults(gg.getResultsCount())
gg.clearResults()
-------------Water cost--------------------
gg.searchNumber("7018090782024269824",gg.TTYPE_QWORD)
-- Why do a refining if you don’t have a group search?
gg.refineNumber("7018090782024269824",gg.TTYPE_QWORD)
Water = gg.getResults(gg.getResultsCount())
gg.clearResults()
::retr1::
choices = gg.choice({'Engery cost', 'Water cost', 'Exit'}, 0, '\tSelect item cost:\n⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯')
if choices == 1 then
for i = 1, #Water do
gg.setValues({{ address = Water[i].address, flags = gg.TTYPE_QWORD, value = 7018090361117474816 }})
end
for i = 1, #Energy do
gg.setValues({{ address = Energy[i].address, flags = gg.TYPE_FLOAT, value = 25 }})
end
for i = 1, #Fly do
gg.setValues({{ address = Fly[i].address, flags = gg.TYPE_FLOAT, value = 0 }})
end
gg.toast('Engery cost')
end
if choices == 2 then
for i = 1, #Fly do
gg.setValues({{ address = Fly[i].address, flags = gg.TYPE_FLOAT, value = -8.0004e10 }})
end
for i = 1, #Energy do
gg.setValues({{ address = Energy[i].address, flags = gg.TYPE_FLOAT, value = 53 }})
end
for i = 1, #Water do
gg.setValues({{ address = Water[i].address, flags = gg.TTYPE_QWORD, value = 7018090782024269824 }})
end
gg.toast('Water cost')
end
if choices == nil or choices == 3 then
gg.setVisible(true)
os.exit()
end
while not gg.isVisible() do gg.sleep(100) end
gg.setVisible(false)
goto retr1
os.exit()