← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #678649]: How can I handle events that are happening asynchronously and independently?

 

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

lisa howells2 requested more information:
alright I understand why you want me to do it the proper way and how
multithreading clicking was wrong, but I dont think I know how to do
this since I'm a new programmer. my exact code is:

partyMem1 = region(a,b,x,y) # region of party member 1's hp bar
while True:
    if partyMem1.exists(lowHp.png) # an image of an almost empty HP bar
        click(location(X, Y) # party member 1's HP restore potion button
        wait(1)

this code works, it detects and heals the first party member as needed,
like in the image I drew earlier. how do I make this code work like what
you are talking about in your "general solution"? as in can you help me
out with how to write it because I dont think I understand how to do the
relating and detaching and implementing synching/locking. sorry if this
question is very basic python question and thanks for any help. also my
pc crashed so I had to make a new Launchpad account

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.