Help

Asked by Deividas

Hello so I want to make a bot which will clicks on image when the image is on screen but if image isn't on screen just randomly clicks on minimap and when image appears again it will click and I want it to loop it I'm beginner so don't expect from me more.

I don't please for whole code I just want to know commands that I need to use to do this, please.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

import random
def randomClick(region):
    clickX = random.randint(region.x, region.x + region.w)
    clickY = random.randint(region.y, region.y + region.h)
    click(Location(clickX, clickY))

image = <capture image> # use capture button
imageMap = Region(.....) # one might use selectRegion()

while true:
    if exists(image, 0):
        click()
        wait(...) # might be needed
    else:
        randomClick(imageMap)
        wait(...) # might be needed

--- wait(...) # might be needed
depends on the reaction time of the GUI: example wait(0.3)

Revision history for this message
RaiMan (raimund-hocke) said :
#2

Now you have to learn about the used features in the docs
http://sikulix.com

... and you have to learn some basic Python

... and you have to try to get it working

Can you help with this problem?

Provide an answer of your own, or ask Deividas for more information if necessary.

To post a message you must log in.