|
Post by vsr8428 on Nov 15, 2018 16:26:31 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 vsr8428 on Nov 15, 2018 16:27:10 GMT
is there a script if image found continue clicking until the mage was gone
|
|
|
Post by AnkuLua on Nov 16, 2018 0:31:22 GMT
is there a script if image found continue clicking until the mage was gone Modify the luar like following touchList[index] = {target = "1.png", region = Region(612, 493, 150, 150), id = "1", action = 'while(existsClick("1.png", 0))do end'}
|
|
|
Post by newscripter on Nov 19, 2018 6:17:14 GMT
Is it possible to keep the script on hold until the next image appears? I want to build a reroll script. Sorry. Don't catch your idea. He means make script wait/pause until X image is found, then click X image. Would be good to make reroll script.
|
|
|
Post by AnkuLua on Nov 19, 2018 6:55:08 GMT
Sorry. Don't catch your idea. He means make script wait/pause until X image is found, then click X image. Would be good to make reroll script. Just try the script. It behaves just like what you want.
|
|
|
Post by newscripter on Nov 19, 2018 8:04:00 GMT
Another question is could we randomize the timer example wait 2second + random milliseconds? Use math.random() www.lua.org/pil/18.htmlCan I ask where to put it in if I want it to wait random time before clicking, and then wait again after clicking? and if I just want it to wait before clicking. ------ 4 ----- (wait before/after) touchList[index] = {target = "startstage.png", region = Region(1400, 902, 200, 150), id = "startstage", action = 'math.random(1,3); click(matchResult); wait(70)'} index = index + 1 ------ 4 ----- (wait before) touchList[index] = {target = "startstage.png", region = Region(1400, 902, 200, 150), id = "startstage", action = 'math.random(1,3); click(matchResult);'} index = index + 1
|
|
|
Post by AnkuLua on Nov 19, 2018 8:10:18 GMT
Put wait before click to wait before click. Put wait after click to wait after click.
|
|
|
Post by newscripter on Nov 19, 2018 8:45:12 GMT
Put wait before click to wait before click. Put wait after click to wait after click. okay think i got that bit thanks you, is there somewhere I can put math.randomseed(tick()) to randomise the seed once for the entire script?
|
|
|
Post by AnkuLua on Nov 19, 2018 9:33:00 GMT
Put wait before click to wait before click. Put wait after click to wait after click. okay think i got that bit thanks you, is there somewhere I can put math.randomseed(tick()) to randomise the seed once for the entire script? Just call math.randomseed() once for the entire script.
|
|
|
Post by newscripter on Nov 19, 2018 9:36:54 GMT
okay think i got that bit thanks you, is there somewhere I can put math.randomseed(tick()) to randomise the seed once for the entire script? Just call math.randomseed() once for the entire script. Thanks, so just put it in any of the lines? like ------ 1 ----- touchList[index] = {target = "stageclear.png", region = Region(917, 143, 200, 150), id = "stageclear", action = 'wait(math.random(1,3)); click(matchResult); setScanInterval(1);math.randomseed()'} index = index + 1
|
|
|
Post by AnkuLua on Nov 19, 2018 10:09:25 GMT
Just call math.randomseed() once for the entire script. Thanks, so just put it in any of the lines? like ------ 1 ----- touchList[index] = {target = "stageclear.png", region = Region(917, 143, 200, 150), id = "stageclear", action = 'wait(math.random(1,3)); click(matchResult); setScanInterval(1);math.randomseed()'} index = index + 1 In fact, you don't need math.randomseed().
|
|
|
Post by newscripter on Nov 25, 2018 16:34:50 GMT
Thanks, so just put it in any of the lines? like ------ 1 ----- touchList[index] = {target = "stageclear.png", region = Region(917, 143, 200, 150), id = "stageclear", action = 'wait(math.random(1,3)); click(matchResult); setScanInterval(1);math.randomseed()'} index = index + 1 In fact, you don't need math.randomseed(). Thanks, worked without. Is there any way to prevent script stop if image is no longer found? Maybe skip to next line? Or a while(existsDoubleClick("chest.png") Secenario is i am in stage, want to click chest if it appears. But auto is constantly walking to the right. The click location is to pause auto. ------ 2 ----- touchList[index] = {target = "clickchest.png", region = Region(20, 420, 1890, 300), id = "clickchest", action = 'click(Location(1770,50)); wait(math.random(0,3)); doubleClick("clickchest.png"); wait(math.random(4,8)); click(Location(1770,50))'} index = index + 1 It works okay if image to click is still on screen, but stop if already walk too far and image clickchest is out of screen/blocked. Option is either to skip to next line code, or make script walk backwards first. Also is it possible to set similarity for one image/line only?
|
|
|
Post by AnkuLua on Nov 26, 2018 0:36:00 GMT
In fact, you don't need math.randomseed(). Thanks, worked without. Is there any way to prevent script stop if image is no longer found? Maybe skip to next line? Or a while(existsDoubleClick("chest.png") Secenario is i am in stage, want to click chest if it appears. But auto is constantly walking to the right. The click location is to pause auto. ------ 2 ----- touchList[index] = {target = "clickchest.png", region = Region(20, 420, 1890, 300), id = "clickchest", action = 'click(Location(1770,50)); wait(math.random(0,3)); doubleClick("clickchest.png"); wait(math.random(4,8)); click(Location(1770,50))'} index = index + 1 It works okay if image to click is still on screen, but stop if already walk too far and image clickchest is out of screen/blocked. Option is either to skip to next line code, or make script walk backwards first. Also is it possible to set similarity for one image/line only? You can added another exists() before doubleClick(). Set one image similarity with Pattern() and similar() touchList[index] = {target = Pattern("clickchest.png"):similar(0.7), , region = Region(20, 420, 1890, 300), id = "clickchest", action = 'click(Location(1770,50)); wait(math.random(0,3)); matchResult = exists("clickchest.png"); if (matchResult) then doubleClick(matchResult); end; wait(math.random(4,8)); click(Location(1770,50))'} You may need to modify the codes according to your needs. Such as do you still need to click if "clickchest.png" is gone.
|
|
|
Post by newscripter on Nov 26, 2018 2:38:07 GMT
Thanks, worked without. Is there any way to prevent script stop if image is no longer found? Maybe skip to next line? Or a while(existsDoubleClick("chest.png") Secenario is i am in stage, want to click chest if it appears. But auto is constantly walking to the right. The click location is to pause auto. ------ 2 ----- touchList[index] = {target = "clickchest.png", region = Region(20, 420, 1890, 300), id = "clickchest", action = 'click(Location(1770,50)); wait(math.random(0,3)); doubleClick("clickchest.png"); wait(math.random(4,8)); click(Location(1770,50))'} index = index + 1 It works okay if image to click is still on screen, but stop if already walk too far and image clickchest is out of screen/blocked. Option is either to skip to next line code, or make script walk backwards first. Also is it possible to set similarity for one image/line only? You can added another exists() before doubleClick(). Set one image similarity with Pattern() and similar() touchList[index] = {target = Pattern("clickchest.png"):similar(0.7), , region = Region(20, 420, 1890, 300), id = "clickchest", action = 'click(Location(1770,50)); wait(math.random(0,3)); matchResult = exists("clickchest.png"); if (matchResult) then doubleClick(matchResult); end; wait(math.random(4,8)); click(Location(1770,50))'} You may need to modify the codes according to your needs. Such as do you still need to click if "clickchest.png" is gone. Thank you very much! Should be able to figure out from here, was trying to figure out how to do doubleClick along with if exists, since normally click doesn't seem to work somehow.
|
|
|
Post by dgatekeeper on Dec 5, 2018 5:35:26 GMT
Hello, I'm trying to record a simple drag and drop action using Snap and Play but I can't get it to work as I intended to.
The script detected the action as drag and drop, and I can see the two points (start and end), but the object on the screen didn't move as it supposed to be dragged and dropped at the end point.
Am I missing anything here? How do I properly set up drag and drop using Snap and Play?
Thank you in advance.
|
|