← Back to team overview

sikuli-driver team mailing list archive

[Question #674438]: can't find a way to click at a random pixel

 

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

Hi, i have been using Sikuli quite often but most of the times i simply copied the code since iam really at programming... But i wanted to get started myself and improving my programming skills. I mainly using Sikuli for different games i used to play and having some troubles with my latest project: I use the click(pattern...) and want to click at a random pixel within a given range around the center of the picture...

I've alrdy tried different approaches e.g.:

# use this where ever needed
x = random.randint(0, 250)
y = random.randint(0, 250) 

if exists(Pattern("1537959580441.png").targetOffset(-28,-32)):
 click("1537960842723.png").similar(0.90).targetOffset(x,y)

---but its still clicking the same spot over and over 

i tried using the offset on a set location and it worked perfectly fine:

click(Location(1163, 558).offset(random.randint(0,250), random.randint(0,60)))


So my question: is there an easy way to set a random clicking offset using a pattern?


thank you



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