Jump to content
  • 0

Lua scripting | when "no" then keep searching & editing following values


nio04

Question

gg.setRanges(gg.REGION_VIDEO)
gg.searchNumber("1080033292", gg.TYPE_DWORD)
gg.refineAddress("494", -1, gg.TYPE_DWORD)
gg.getResults(1)
gg.editAll("9", gg.TYPE_DWORD)
gg.sleep(4000)

local l = gg.alert('is only enemy body colored ::: ','no', 'yes')
    
    if l == 2 then
gg.clearResults(1)
        os.exit()

    else    
    gg.editAll("1080033292",gg.TYPE_DWORD)
    gg.getResults(1)
end

 

 

>> So, the "yes" part works... But i wonder, how i can keep continue my searching if the user say "no" (when user say no, revert part works, but i cant continue my search for others remaining value)

 

Plz help me...

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Update

 

 
 

gg.setRanges(gg.REGION_VIDEO)

gg.searchNumber("1080033292", gg.TYPE_DWORD)

gg.refineAddress("494", -1, gg.TYPE_DWORD)

res = gg.getResults(1)

gg.editAll("9", gg.TYPE_DWORD)

gg.sleep(4000)

 

local l = gg.alert('is only enemy body colored ::: ','no', 'yes')

 

 

    if l == 1 then goto again end

    if l == 2 then goto close end

 

::again::

while (gg.getResults(1)>1) do

gg.editAll("1080033292", gg.TYPE_DWORD)

gg.setRanges(gg.REGION_VIDEO)

gg.searchNumber("1080033292", gg.TYPE_DWORD)

gg.editAll("9", gg.TYPE_DWORD)

end

 

::close::

os.exit()

 

for above code, i get following error 

Script ended:

Script error: luaj.o: /storage/emulated/0/Notes/maskTest.lua:15

`while (gg.getResults(1)>1) do`

attempt to compare number with table

level = 1, const = 23, proto = 0, upval = 1, vars = 4, code = 77

LT 0 1 v1

 ; PC 47 CODE 85804019 OP 25 A 0 B 267 C 1 Bx 136705 sBx 5634

stack traceback:

 /storage/emulated/0/Notes/maskTest.lua:15 in main chunk

 [Java]: in ?

 at luaj.LuaValue.f(src:989)

 at luaj.LuaValue.h(src:2443)

 at luaj.LuaValue.p(src:2310)

 at luaj.LuaLong.p(src:178)

 at luaj.LuaClosure.a(src:497)

 at luaj.LuaClosure.l(src:160)

 at android.ext.Script.d(src:6056)

 at android.ext.Script$ScriptThread.run(src:5785)

Link to comment
Share on other sites

1 hour ago, nio04 said:

while (gg.getResults(1)>1) do

You are comparing the results as a table you should try something like 

if gg.getResultsCount() <= 1 then 

 

else

 

end

You could use getResults if the goal was to compare the value of the result itself but you'd need to use the indexes of the table such as

if res[1].value <= 1 then 

 

else

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.