← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #664345]: CPU usage going through the roof when running script

 

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

Description changed to:
Hi everyone,

I've created a farming bot for a mobile game which I am playing on my PC with the android emulator Nox.
My problem is that once I start the script the CPU usage goes up really high. Here's a SS: https://imgur.com/a/HcKIm

And here is my script / code:

Settings.MoveMouseDelay = 0.1
running = True

def runHotkey(event):
    global running
    running = False
    
Env.addHotkey(Key.F1, KeyModifier.CTRL, runHotkey)

while running:
    if Screen(1).exists(Pattern("1516809781721.png").similar(0.90)):
        Screen(1).click(Pattern("1516809781721.png").similar(0.90))

    if Screen(1).exists("1516823633104.png"):
        Screen(1).click(Pattern("1516823633104.png").targetOffset(125,220))

    if Screen(1).exists(Pattern("1517864572951.png").similar(0.60)):
        Screen(1).click(Pattern("1517864572951.png").similar(0.60))

    if Screen(1).exists("1516823633104.png"):
        Screen(1).click(Pattern("1516823633104.png").targetOffset(-70,230))

    if Screen(1).exists(Pattern("1516820524383.png").exact()):
        Screen(1).click(Pattern("1516820524383.png").exact())

    if Screen(1).exists(Pattern("1516812605236-1.png").similar(0.90)):
        Screen(1).click(Pattern("1516812605236.png").similar(0.90))
        Screen(1).wait("1516812737846.png", 60)
        Screen(1).click(Pattern("1516812737846.png").targetOffset(320,134))

To run the script I'm just pressing on "run / execute" (Ausführen in
German) in Sikuli.

So if anyone knows how to reduce the CPU and RAM usage, please tell me!
If I do not set the FPS in the emulator to 10 my PC crashes within 20 mins or so.

Greetings, Dave

PS: I'm a noob on this territory. This is the first I've ever coded
something so please explain it so I can understand what I should do. :)

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