← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #239460]: How to build a game bot that selects action based on current images

 

Question #239460 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/239460

    Status: Answered => Open

John Weaver is still having a problem:
So far, the script is working except that I need the whole thing to
repeat indefinitely. It also is fairly slow. It takes 4-5 seconds to
find and click on what it needs to. I'm not sure how to use regions, so
I'm not sure if they can help me or not.

   The way the game is setup, there is basically one main screen to enter, then 3 preliminary screens to go through with 1 simple button to click (SRB Screen1, SRB Screen2, & a Prep Screen).
    At that point, it sometimes comes across a network error, which I want it to respond to. 
   Then, it enters the "SRB Arena" where it will either hit "go" or encounter a decision at a path crossroad to go left or right. I would like to program it to go down the same path & choose the same route each time. 
    When it has chosen which direction it's going, it will hit ok. 
    Then, when encountering normal enemies, it will go to a battle screen, where I want it to choose "battle".
    Other times, it should encounter a boss, where I want it to choose "standard". When the boss is defeated, there is a reward points screen where I want it to click on the "x" in the top corner. 
   Then it should resume "go". When it runs out of energy for moves, or morale for attacks to the boss, I want it to wait for 45 minutes. 
   Then, when it completes the level, it will go back to the main screen and I want it to go through it again. 

I'm not sure if that all makes sense, & if i could get help with someone
via teamviewer or something, I would be glad to walk the helper through
what I'm wanting.

Here's the current script I have (without all the stuff I mentioned
finished yet):

#Main Screen
adv = "1385932103285.png"
while True:
    if not exists(adv, 0):
        break #leave the loop
    # now we check the top level actions
    if exists(adv, 0):
        click(adv)
#SRB Screen 1
raid = "1385932328149.png"
enter = "1385932344902.png"
while True:
    if not exists(raid,0):
        break #leave the loop
    if exists(raid,0):
        click(enter)
#SRB Screen 2
raid2 = "1385932503170.png"
ok = "1385932529090.png"
while True:
    if not exists(raid2,0):
        break #leave the loop
    if exists(raid2,0):
        click(ok)
#Prep Screen
begin = "1385932635165.png"
while True:
    if not exists(begin,0):
        break #leave the loop
    if exists(begin,0):
        click(begin)
#Network Error
Region(55,264,408,182)
error = "1385932728746.png"
retry = "1385932760650.png"
while True:
    if not exists(error,0):
        break #leave the loop
    if exists(error,0):
        click(retry)
#SRB Arena
srbregion = Region(45,35,427,643)
level = "1385933213128.png"
go = "1385933505624.png"
while True:
    if not exists(go,0):
        break #leave the loop
    if exists(go,0):
        click(go)
#Battle screen
battle = "1385933607414.png"
while True:
    if not exists(battle,0):
        break #leave the loop
    if exists(battle,0):
        click(battle)
#Captives screen
captives = "1385933685777.png"
skip = "1385933708242.png"
while True:
    if not exists(skip,0):
        break #leave the loop
    if exists(skip,0):
        click(skip)
#Path Choice
OK = "1385933983268.png"
goleft = "1385934030982.png"
goright = "1385934056409.png"
while True:
    if not exists(OK,0):
        break #leave the loop
    if exists(OK,0):
        click(OK)
#Raid Boss
standard = "1385934916465.png"
while True:
    if not exists(standard,0):
        break #leave the loop
    if exists(standard,0):
        click(standard)
        wait (5)
#Boss Rewards screen
rewards = "1385935121427.png"
x = "1385935133739.png"
while True:
    if not exists(rewards,0):
        break #leave the loop
    if exists(rewards,0):
        click(x)

Thank you so much for all your help!

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.