← Back to team overview

sikuli-driver team mailing list archive

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

 

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

Hello, I've looked around the boards for answers to the questions I'm seeking with little success and hope I can get some help here.

I am trying to create a bot for blood brothers, more as a learning project in Sikuli than just about anything else. It would be very useful to automating my work in the game as well.

However, I cannot figure out how to make a looping script that looks for images & makes clicking actions based on those images. For example, I've taken screenshots of various popups titled "items received", "zone cleared", "captives", etc. and want to have sikuli click on skip, ok, cancel, use, or other buttons available based on which popup is up. Primarily, I need this bot to click "go" when go is showing, "battle" when it is showing, and "use" mandrakes when it is showing. I also need it to navigate through a menu and back into the game without stopping. 

I've tried using "while exists", "if exists", "if not exists", and the like to create something that is somewhat of a loop. Unfortunately, it only works for each of the elements once, then stops working. 

For example:
while exists (go):
    click (go)
    if not exists (go):
        break
while exists (battle):
    click (battle)
    if not exists (battle):
        break
while exists (items):
    click (ok)
    if not exists (items):
        break

This will go through a few of the buttons, but then it ends. I'm sure I'm very far off from getting it right, but it seems this should be a fairly simple script.

I've tried reading on the boards, following tutorials, and more, with very little of it helping. I'm learning more and more, but I just can't seem to make this work.


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