Post by AnkuLua on Feb 27, 2017 4:10:09 GMT
Forward:
Although having record and play script for simple "click and wait" parts, there are some weaknesses for this script:
We already have the methodology for brute force script development. Why can't we make it automation?
Yes, we can. Here is it --"snap And Play".
The script is built inside AnkuLua (both trial and Pro2)
You can use it (snapAndPlay.lua) directly.
If you never use AnkuLua before, please first refer to the example.
Revision history:
3.3.0:
www.dropbox.com/s/3ajt1nk4v0ejd0y/snapAndPlay.v3.3.0.lua?dl=0
2.8.8:
drive.google.com/open?id=12QUrwFeVJOsKxS7orF1bVYsi17zBBHnS
www.dropbox.com/s/axdamr3hsrsfxqk/snapAndPlay.v2.8.8.lua?dl=1
2.8.3:
drive.google.com/file/d/1EaG9rJtZ8w0pIIdh1-NGVQ_PTcYREWJ3/view?usp=sharing
2.8.1:
* support autoGameArea()
www.dropbox.com/s/m7p8oeskvuyxvxa/snapAndPlay.v2.8.1.lua?dl=1
2.7.2:
* added no luar warning in play and expand
* clear bugs of smart reorder and duplication detection
2.7.0:
* added "Click target offset""
* added "dim the screen when running script" option
2.6.0:
* added "If A found, click B location"
* added "click target offset"
www.dropbox.com/s/vclpn7qkkt5vibf/snapAndPlay.v2.6.0.lua?dl=1
2.3.0:
* added supporting devices with cutout (notch)
2.0.0:
* added Portuguese support
1.9.0:
* added "Always search from first image." option
* added "If A found, click B"
1.8.1:
* added playback minimum similarity settings
1.8.0:
* Support expanding existing luar
1.7.0:
* Support detecting duplication(same images will not be recorded again), reduce the luar size.
* Support smart order(If previous snaps found in background, new snap will arrange in front). Make the replay result as expected.
1.6.0:
* support modified action
1.5.0:
* added wait option. Enable this feature if the game pauses when the screen is light yellow.
1.3.2:
* supports random click
1.2:
* supports drag and drop
* adds option to append scripts
1.1:
* adds option to assign image file names
1.0: First release
The script is open source. Welcome to modify and distribute.
Record usage:
1. Choose recordAndPlay.lua, then enter the the screen to record.
2. Press the lower left AnkuLua Play button, then choose record.
Choose the game is immersive or not.
Input the file name to save
Note: Don't use space in file name.
1jLaOiWBNN_PAdJk0FcyOdpRgTTddp-7r
When running, please only touch the screen when there is light yellow on screen. Or the touch will not be recorded.
When running, please only touch the screen when there is light yellow on screen. Or the touch will not be recorded.
When running, please only touch the screen when there is light yellow on screen. Or the touch will not be recorded.
Don't touch the screen like below.
Only touch screen when there is light yellow on screen.
3. To stop recording, press the red "Stop!" area or AnkuLua stop button.
Playback usage:
1. Choose recordAndPlay.lua and enter the screen to playback.
2. Choose playback
3. Choose the file to playback
The first two settings are clear. Need no more explanation.
Some snaps don't always occur on a fixed area. In this case, cancel the click on "All searchings with regions".
Then following setting page will show. And you can choose which snap to search on fixed area and which to search on whole screen.
Hint: You can find the images in directory luar/fileNameImage under snapAndPlay script.
Demo video
Advanced skills:
Simply generated script can't meet your requirements. You can modify the generated luar to do more.
The variable matchResult is the match result. Here are some example.
Although having record and play script for simple "click and wait" parts, there are some weaknesses for this script:
- It's not efficient because conservative and buffer of time
- For different (harder) level, the recorded script fails because not enough time buffer.
We already have the methodology for brute force script development. Why can't we make it automation?
Yes, we can. Here is it --"snap And Play".
The script is built inside AnkuLua (both trial and Pro2)
You can use it (snapAndPlay.lua) directly.
If you never use AnkuLua before, please first refer to the example.
Revision history:
3.3.0:
www.dropbox.com/s/3ajt1nk4v0ejd0y/snapAndPlay.v3.3.0.lua?dl=0
2.8.8:
drive.google.com/open?id=12QUrwFeVJOsKxS7orF1bVYsi17zBBHnS
www.dropbox.com/s/axdamr3hsrsfxqk/snapAndPlay.v2.8.8.lua?dl=1
2.8.3:
drive.google.com/file/d/1EaG9rJtZ8w0pIIdh1-NGVQ_PTcYREWJ3/view?usp=sharing
2.8.1:
* support autoGameArea()
www.dropbox.com/s/m7p8oeskvuyxvxa/snapAndPlay.v2.8.1.lua?dl=1
2.7.2:
* added no luar warning in play and expand
* clear bugs of smart reorder and duplication detection
2.7.0:
* added "Click target offset""
* added "dim the screen when running script" option
2.6.0:
* added "If A found, click B location"
* added "click target offset"
www.dropbox.com/s/vclpn7qkkt5vibf/snapAndPlay.v2.6.0.lua?dl=1
2.3.0:
* added supporting devices with cutout (notch)
2.0.0:
* added Portuguese support
1.9.0:
* added "Always search from first image." option
* added "If A found, click B"
1.8.1:
* added playback minimum similarity settings
1.8.0:
* Support expanding existing luar
1.7.0:
* Support detecting duplication(same images will not be recorded again), reduce the luar size.
* Support smart order(If previous snaps found in background, new snap will arrange in front). Make the replay result as expected.
1.6.0:
* support modified action
1.5.0:
* added wait option. Enable this feature if the game pauses when the screen is light yellow.
1.3.2:
* supports random click
1.2:
* supports drag and drop
* adds option to append scripts
1.1:
* adds option to assign image file names
1.0: First release
The script is open source. Welcome to modify and distribute.
Record usage:
1. Choose recordAndPlay.lua, then enter the the screen to record.
2. Press the lower left AnkuLua Play button, then choose record.
Choose the game is immersive or not.
Input the file name to save
Note: Don't use space in file name.
1jLaOiWBNN_PAdJk0FcyOdpRgTTddp-7r
When running, please only touch the screen when there is light yellow on screen. Or the touch will not be recorded.
When running, please only touch the screen when there is light yellow on screen. Or the touch will not be recorded.
When running, please only touch the screen when there is light yellow on screen. Or the touch will not be recorded.
Don't touch the screen like below.
Only touch screen when there is light yellow on screen.
3. To stop recording, press the red "Stop!" area or AnkuLua stop button.
Playback usage:
1. Choose recordAndPlay.lua and enter the screen to playback.
2. Choose playback
3. Choose the file to playback
The first two settings are clear. Need no more explanation.
Some snaps don't always occur on a fixed area. In this case, cancel the click on "All searchings with regions".
Then following setting page will show. And you can choose which snap to search on fixed area and which to search on whole screen.
Hint: You can find the images in directory luar/fileNameImage under snapAndPlay script.
Demo video
Advanced skills:
Simply generated script can't meet your requirements. You can modify the generated luar to do more.
- modified action:
The variable matchResult is the match result. Here are some example.
------ 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