|
Post by AnkuLua on Jun 19, 2017 23:25:33 GMT
version 1.6.0 now supports modified action. Want to do more when some image found, rewrite the action. The variable matchResult is the match result. Here are some examples. ------ 1 ----- touchList[index] = {target = "1.png", region = Region(612, 493, 150, 150), id = "1", action = 'click("realTarget.png")'} index = index + 1
------ 2 ----- touchList[index] = {target = "2.png", region = Region(774, 493, 150, 150), id = "2", action = 'click(matchResult); wait(2)'} index = index + 1
------ 3 -----
touchList[index] = {target = "3.png", region = Region(174, 293, 150, 150), id = "3", action = 'dofile("3.lua")'}
index = index + 1
|
|
|
Post by super7 on Jun 20, 2017 8:25:35 GMT
Looks great!
In the 1st example will realTarget.png be found anywhere on the screen, no coordinates required?
In the 2nd example when 2.png is found it will be clicked? I don't understand the difference between action = "click" and action = 'click(matchResult)' Can use both?
Is it possible now to use this in luar file as well: action = 'click(Location(609, 720)); wait(2)' ? Do we need to use " " or ' '?
I'll test it out. Thx
|
|
|
Post by AnkuLua on Jun 20, 2017 9:08:50 GMT
In the first example, no coordinate is required.
In the 2nd example, action='click(matchResult)' is the same as action = "click". But wait(2) is added.
Yes. you can use action = 'click(Location(609, 720)); wait(2)' In lua, " " is equal to ''. To use strings in action, you need both. Just as 1st example.
|
|
|
Post by andi1203 on Jun 22, 2017 13:27:51 GMT
My wish would be:
Change mode ...
The script should then run normally and capture additional optional clicks.
I have a script, which is so very good, but sometimes a window appears, what must be clicked away. So what:
.......
seq = (true) while (seq) do if exists("P1.png", 1) then click("P1.png") seq = (false) else exists("P2.png", 1) then click("P2.png") seq = (false) else end end
...
or something like that. The window, which must be clicked away, comes only occasionally
|
|
|
Post by super7 on Jun 24, 2017 19:09:56 GMT
Hi I'm testing dofile command but getting runtime error cannot open testx.luar, no such file or directory. Where should I place the file and snaps folder to make it work?
Can I use dofile command with .luar file?
In test.luar I have this
------ 1 ----- touchList[index] = {target = "quick_fight_1076_868_276_75.png", region = Region(1056, 848, 316, 115), id = "1", action = 'dofile("testx.luar")'} index = index + 1
In testx.luar this
------ 1 ----- touchList[index] = {target = "box_left_top_254_303_167_55.png", region = Region(249, 648, 467, 65), id = "25", action='click(matchResult); wait(3)'} index = index + 1
Thx
|
|
|
Post by AnkuLua on Jun 24, 2017 23:46:28 GMT
Use scriptPath() to get the path to snapAndPlay.lua
------ 1 ----- touchList[index] = {target = "quick_fight_1076_868_276_75.png", region = Region(1056, 848, 316, 115), id = "1", action = 'dofile(scriptPath() .. "luar/testx.luar")'} index = index + 1
However, your testx.luar seems strange.
|
|
|
Post by super7 on Jun 25, 2017 9:04:05 GMT
Use scriptPath() to get the path to snapAndPlay.lua ------ 1 ----- touchList[index] = {target = "quick_fight_1076_868_276_75.png", region = Region(1056, 848, 316, 115), id = "1", action = 'dofile(scriptPath() .. "luar/testx.luar")'} index = index + 1 However, your testx.luar seems strange. Actually I don't find anything strange about it cause I was just testing this command. Now I know how it works and have a plan how to use it. Snaps must be in the same folder as other snaps, so if you have testImage folder you keep all snaps for test.luar and testx.luar in testImage folder you don't create separate testxImage folder. My index list contains already about 30 snaps to check and it will be growing, but I don't want ankulua to go through the whole index list in each sequence. So I figured out to use dofile command to reduce number of checks. I will put into other .luar files checks to be done when a certain picture is found. I don't know better option now.
|
|
|
Post by super7 on Jun 26, 2017 12:29:53 GMT
Can you please advise if it is possible and how to do it to repeat touch list index items 1 to 8 for example, 10 times and then proceed to the next or any other index number?
I want ankulua to repeat checking and clicking certain index items a number of times and then going to a next one.
|
|
|
Post by super7 on Jun 27, 2017 19:49:32 GMT
Getting the following errors during playback:
1. Runtime error: /sdcard/.../snapAndPlay.v1.6.0.lua:616: attempt to concatenate field '?' (a nil value) stack traceback...616... playback 682...main chunk
2. Runtime error: /sdcard/.../snapAndPlay.v1.6.0.lua:131: attempt to index local 't' (a nil value) stack traceback...131... regionWaitMulti 609... playback 682...main chunk
3. Runtime error: /sdcard/.../snapAndPlay.v1.6.0.lua:131: attempt to perform arithmetic on field '?' (a nil value) stack traceback 613... playback 682...main chunk
|
|
|
Post by AnkuLua on Jun 27, 2017 23:38:25 GMT
Did you modify the generated .luar or snapAndPlay.lua? Please share the screenshot of error message.
|
|
|
Post by super7 on Jun 28, 2017 7:37:23 GMT
I found 1 error so far in a .luar file it was index + 2, and after correction it's ok now. I will report again if something is still wrong.
|
|
esk0r
New Member
Posts: 1
|
Post by esk0r on Jul 19, 2017 17:14:44 GMT
I would like to show you the error i am getting: imgur.com/a/71glW I didnt take a look at the lines myself, but i will right after this post.
|
|
|
Post by AnkuLua on Jul 19, 2017 22:19:53 GMT
Please avoid space in directory name.
|
|
|
Post by nata488 on Sept 19, 2017 1:53:19 GMT
hi, is there a script that activates a back button if a certain image was found. I mean there is a game that i played sometimes it pops up a ads or an image which can only be closed by pressing back button. Its hard to farm sometimes because it pops out.
|
|
|
Post by Exilereven on Sept 19, 2017 2:11:25 GMT
Include this code in your script, it will load up common lib functions.
luaLib = loadstring(httpGet("https://raw.githubusercontent.com/mercobots/luaLib/master/luaLib.min.lua")) luaLib()
Then use: btn_back() anywhere you want in the code to "press back"
|
|