sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #23914
[Question #243270]: Make sikuli look for certain phrases and click offset link accordingly
New question #243270 on Sikuli:
https://answers.launchpad.net/sikuli/+question/243270
So on this website there are certain games we want our bot to spectate.
Here is how it looks like: http://i61.tinypic.com/2u5cnzt.png
from (www.untap.in) Free to play!
At first the game must be a "MTG" game.
The spectating bot should find phrases like (ALL case UNsensitive): "bng", "botg", "born" and click "Spectate" accordingly.
If there are non found then it should look for (ALL case UNsensitive): "std", "standard" and click "Spectate" accordingly.
When there is still nothing found it goes on and just clicks a random one.
So that's the code until now:
while True: # main loop
exists(Pattern("1-2.png").similar(0.85),99999) # Wait for Games
click(Pattern("1-3.png").similar(0.85)) # Click on Games
exists(Pattern("autoSpectate.png").similar(0.80),99999) # Wait for Spectate
import random
click(random.choice(list(findAll(Pattern("autoSpectate-3.png").similar(0.80))))) # Click on Spectate
exists(Pattern("autoturn-1.png").similar(0.85),99999) # Wait for Turn
while exists(Pattern("autoturn-1.png").similar(0.85)): # Secondary search loop
if exists(Pattern("1391360914254.png").similar(0.85)): # TEST " player has left game
Region(1800,1051,110,28).exists(Pattern("autlev-2.png").similar(0.33),99999) # Look for Exit Name
Region(1800,1051,110,28).hover(Pattern("autlev-2.png").similar(0.33)) # find exit lobby button in proper region
exists(Pattern("backtolob-1.png").similar(0.85),99999)
click(Pattern("backtolob.png").similar(0.85))
break # end search loop and return to main loop.
else:
wait(2) # wait period before restarting loop
continue # continue search loop if "player has left game" is not found.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.