← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #190878]: mining iron ore

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
--- ironore = Pattern("iron.png").similar(0.00)
.similar(0.00) does not make much sense, because it might find more things, than you want.
You should always start without a .similar(), which then uses 0.7, which should work in most cases. If not, make a better screenshot (less background).

--- "while ironore:" and "if choose1:"
both decisions are always True, because ironore and choose1 are image references, that only deliver False if they are assigned as None (which is not the case here). I goes you want to check the existence of the images.

--- So a version of your script with some sense (I do not know wether it does what you want though ;-):
 
ironore = "iron.png"
pickup = "icon picup.png"
choose1 = "icon pickup.png"

while exists(ironore):
    rightClick(getLastMatch()) # no need to search again
    if exists(choose1):
        click(pickup)
        wait(7)
    else:
        wait(2)

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