Post by AnkuLua on Feb 3, 2016 0:26:17 GMT
When developing the script of seven knights, we found that brute force is good enough for many situations.
It's really helpful for repeating the same stages.
First, let's look at the structure of the script.
Basic Operation
The script is simple. It will keep searching all the images (1.png, 2.png, 3.png, ...).
If find one, it will click it.
Development steps
The steps to make the script working are as following
This is just a beginning. It's a good start, the script should save your time and free your hands.
It's really helpful for repeating the same stages.
First, let's look at the structure of the script.
-- ========== Settings ================
Settings:setCompareDimension(true, xxx) -- You must change these two settings according to your environments
Settings:setScriptDimension(true, xxx)
Settings:set("MinSimilarity", 0.8)
setImmersiveMode(true) -- Force immersive to be true. It may cause problem on others' devices. But we don't care since it's only for you.
-- ========== main program ===========
while (true) do
existsClick("1.png", 0)
existsClick("2.png", 0)
-- Add the extra images according to your requirements.
end -- The is an non-stop loop. Stop only when the users press the stop button.
Basic Operation
The script is simple. It will keep searching all the images (1.png, 2.png, 3.png, ...).
If find one, it will click it.
Development steps
The steps to make the script working are as following
- Set CompareDimension and ScriptDimension
Please refer to ankulua.boards.net/thread/7/settings
This is very important. If you find the image is on the scree, but the script doesn't click on it. Then it's very possible that the CompareDimension is not set up correctly. - Take a snapshot and modify the script.
Next, enter the game. Hold on when you want to press some place (maybe some button).
Take a screenshot and snap that area to a image file. (Here we assume the file is named x.png)
Then adding following line to the script.existsClick("x.png", 0) -- Change x.png to the file name just snapped.
- Repeat step 2 until you come back to first snapped image.
- Run the script. If you find the screen freezes on some place and need you to press the screen, stop the script.
Repeat step 2, adding new snapped image and modify the script.
Then continue the execution of the script.
This is just a beginning. It's a good start, the script should save your time and free your hands.