|
Post by prince on Mar 3, 2017 16:59:46 GMT
hi all, goto doesnt work for me, getting different errors: and with error: '=' while(true)do
::rebellionlabel:: --GIFTS-------------------- if(gift)then
if(giftcoords:exists(Pattern("gift.png"):similar(0.9)))then
click("gift.png")
click("gift2.png")
elseif (rebellion) then gift=false
goto rebellionlabel
end while(opencoords:exists(Pattern("open.png"))) do -- click(Pattern("open.png")) -- click(Pattern("delete.png"))
open=findAll("open.png") for i, m in ipairs(open) do
click(Pattern("open.png"),100)end click(Pattern("deleteall.png"))
end status="ingift"
end
--REBELLION------------------- if (rebellion) then
|
|
|
Post by AnkuLua on Mar 4, 2017 6:05:48 GMT
AnkuLua use lua 5.1.1 goto is not supported.
|
|
|
Post by Mercobots on Mar 4, 2017 22:19:25 GMT
why don't create function instead
function rebellionlabel() local gift = true while (gift) do if (giftcoords:exists(Pattern("gift.png"):similar(0.9))) then click("gift.png") click("gift2.png") elseif (rebellion) then gift = false end end return gift end -- while (true) do local rebellion = rebellionlabel() while (opencoords:exists(Pattern("open.png"))) do -- click(Pattern("open.png")) -- click(Pattern("delete.png"))
open = findAll("open.png") for i, m in ipairs(open) do
click(Pattern("open.png"), 100) end click(Pattern("deleteall.png")) end status = "ingift" end
--REBELLION------------------- if (rebellion) then end
|
|
|
Post by prince on Mar 4, 2017 23:05:36 GMT
yes i already solved it with a while loop and break condition and also created a function but thanks anyway
function giftfunc() while(opencoords:exists(Pattern("open.png"),100)) do --while(true) -- click(Pattern("open.png")) -- click(Pattern("delete.png"))
open=regionFindAll(opencoords,"open.png") for i, m in ipairs(open) do
giftcount=giftcount + click(m,1) Region(390,130,150,40):highlight("Gifts collected: "..giftcount) end click(Pattern("deleteall.png"),1)
if(Region(245,230,130,130):exists(Pattern("openempty.png"))) then break end end status="ingift" end
while(true)do
----
--GIFTS--------------------
while(gift) do --just for break Region(390,130,150,40):highlight("Gifts collected: "..giftcount) if(giftcoords:exists(Pattern("gift.png"):similar(0.9)))then
click("gift.png")
click("gift2.png")
elseif ((rebellion) or (monster)) then gift=false break --goto rebellionlabel
else scriptExit() end
giftfunc()
end
|
|
|
Post by kingofrandom on Mar 29, 2019 8:16:49 GMT
Is goto still not supported? I have different crashes on 8.3.0 trial. Compiled with Lua 5.3 compiler.
to Prince nice idea with break! I have more complex goto structure (I skip some parts of code and sometimes go back and forth with it), but will see maybe I can substitute it somehow too.
|
|
|
Post by AnkuLua on Mar 29, 2019 8:42:07 GMT
Is goto still not supported? I have different crashes on 8.3.0 trial. Compiled with Lua 5.3 compiler. to Prince nice idea with break! I have more complex goto structure (I skip some parts of code and sometimes go back and forth with it), but will see maybe I can substitute it somehow too. Goto is not supported in 5.1. AnkuLua was first released with Lua 5.1. Lua isn't backward compatible. Consider it, AnkuLua will stay in Lua 5.1.
|
|
|
Post by kingofrandom on Mar 29, 2019 8:49:53 GMT
Ok I will from now use 5.1 compiler. Is there analog that I can use instead (maybe from Sikuli) to skip parts of code? P.S. Yep functions and breaks do the job. Maybe it even better to sub it with funcs cause it makes them transportable and more organized. You can call function from other script and etc. Onky one plus of go to that it is much wider supported in other macro script programs.
|
|
|
Post by kingofrandom on Mar 30, 2019 19:16:25 GMT
AnkuLua will stay in Lua 5.1. Why?
|
|
|
Post by AnkuLua on Mar 30, 2019 23:35:12 GMT
AnkuLua will stay in Lua 5.1. Why? Lua isn't backward compatible. And many scripts were released in luac or luae2.
|
|
|
Post by kingofrandom on Mar 30, 2019 23:51:18 GMT
So some code will not work in lua 5.3 that was written in lua 5.1? But it can be fixed by scripters easily and there are not many cmds that are not compatible. Ahh so there is no way it can play Luac/luae2 with 5.3? but there still will be previous ankulua version for that.
|
|