kase
New Member
Posts: 5
|
Post by kase on Dec 15, 2015 1:32:13 GMT
I am trying to create a script that will scan the phone every one minute(s) for an img. and if the image is found then it will click it.
This is my script:
Settings:setCompareDimension(true, 1080);
Settings:setCompareDimension(true, 1080);
---- Main Program:
while true do
wait(60)
existsClick(Pattern("Target.png")[, 3]);
wait(8);
end But it does not run! It says Syntax Error and it cannot run.
What am I doing wrong? How can I make it better?
|
|
|
Post by AnkuLua on Dec 15, 2015 2:04:11 GMT
This line is incorrect existsClick(Pattern("Target.png")[, 3]);
Anything in square brackets is optional. It should be one of followings existsClick(Pattern("Target.png")); -- if "Target.png" exists then click it. The existing check lasts for 2 seconds (2 is the default value) existsClick(Pattern("Target.png",3 )); -- if "Target.png" exists then click it. The existing check lasts for 3 seconds
existsClick(Pattern("Target.png"), 0); -- if "Target.png" exists then click it. The existing check only once
In fact, you don't need the Pattern in this case. It could be existsClick("Target.png"); -- if "Target.png" exists then click it. The existing check lasts for 2 seconds (2 is the default value) existsClick("Target.png",3 ); -- if "Target.png" exists then click it. The existing check lasts for 3 seconds
existsClick("Target.png", 0); -- if "Target.png" exists then click it. The existing check only once Feel free to tell us if any problem. To provide better service, more information is better. It's better that you can email a zip file including the script and all images. Please also email us the screenshots with problem. At least, one screenshot with AnkuLua error message and the other after clicking all AnkuLua message. It's better to email us the file /sdcard/AnkuLua/captured_images/findException.png if findException happen. email to: ankulua@gmail.com
|
|
kase
New Member
Posts: 5
|
Post by kase on Dec 15, 2015 2:41:31 GMT
This line is incorrect existsClick(Pattern("Target.png")[, 3]);
Anything in square brackets is optional. It should be one of followings existsClick(Pattern("Target.png")); -- if "Target.png" exists then click it. The existing check lasts for 2 seconds (2 is the default value) existsClick(Pattern("Target.png",3 )); -- if "Target.png" exists then click it. The existing check lasts for 3 seconds
existsClick(Pattern("Target.png"), 0); -- if "Target.png" exists then click it. The existing check only once
In fact, you don't need the Pattern in this case. It could be existsClick("Target.png"); -- if "Target.png" exists then click it. The existing check lasts for 2 seconds (2 is the default value) existsClick("Target.png",3 ); -- if "Target.png" exists then click it. The existing check lasts for 3 seconds
existsClick("Target.png", 0); -- if "Target.png" exists then click it. The existing check only once Feel free to tell us if any problem. To provide better service, more information is better. It's better that you can email a zip file including the script and all images. Please also email us the screenshots with problem. At least, one screenshot with AnkuLua error message and the other after clicking all AnkuLua message. It's better to email us the file /sdcard/AnkuLua/captured_images/findException.png if findException happen. email to: ankulua@gmail.comThank you so much for the fast reply! It seems to be working so far but I'll see... Can I use the 'if' conditional statement for all the methods and objects? That's one question that I have or only certain methods/objects? Edit here is an example: if exists(PS[, seconds]) == true then --If it's true do this... end Is that possible?
|
|
|
Post by AnkuLua on Dec 15, 2015 2:56:35 GMT
|
|
izan
New Member
Posts: 1
|
Post by izan on Dec 21, 2015 11:12:37 GMT
hi admin,
i am trying to create script that can scan image (an image as requirement) on the phone, so if the img pop up then it will click different img (as target img) and in combine with countinueclick, but it does not run... i hope you understand... sory about my english this is my script
Settings:setCompareDimension(true, 352); Settings:setCompareDimension(true, 352);
---- Main Program: if(exist("image1.png", "image2.png", 3)) then local p = find("target.png") continueClick(p:getX(), p:getY(), 1, 1, 100) else do return getLastMath() end wait (1) end
|
|
|
Post by AnkuLua on Dec 21, 2015 12:17:19 GMT
hi admin, i am trying to create script that can scan image (an image as requirement) on the phone, so if the img pop up then it will click different img (as target img) and in combine with countinueclick, but it does not run... i hope you understand... sory about my english this is my script Settings:setCompareDimension(true, 352); Settings:setCompareDimension(true, 352); ---- Main Program: if(exist("image1.png", "image2.png", 3)) then local p = find("target.png") continueClick(p:getX(), p:getY(), 1, 1, 100) else do return getLastMath() end wait (1) end Please refer to ankulua.boards.net/thread/34/help-on-developing-scriptsAnd provide required information.
|
|