← Back to team overview

sikuli-driver team mailing list archive

[Question #262834]: Speeding Up the Key Listening in a Game

 

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

Hello

In a game there is small box and a smybol inside. Lets say the symbol can only be only be alpha, beta, or gamma (3 possibilities).  As the symbol in the box changes every second or so, user has to click the to shortcut button on the keyboard within 1 seconds or so to get scores. Lets say button shortcuts are q, w, and e.  Sounds similar to guitar hero with 1 button at a time.

It is also worth nothing that I'm also doing mouse moves and pressing to other buttons while playing this game. I'm using the sikuli as an helper. But the problem with the is sikuli is lagging behind, a bit slow. And most of the time doesn't see the symbols. Could you please help me what may be the cause of the slowness, and offer some ways to speed up the code? Thank you.

System Specifications:
32 bit Windows 10 Pro Technical Preview
AMD Phenom 8650 Triple Core 2.30 GHz
4 GB (3,25 usable) RAM

This code:

##-------------------------------------------------

alpha = "alpha.png" #q has to be pressed if this symbol appears
gamma = "gamma.png"  #w has to be pressed if this symbol appears
beta = "beta.png" #e has to be pressed if this symbol appears

reg=Region(1348,482,58,52) #quite a small window to be honest

def letsSpam(event):

    if reg.exists(alpha):
        keyDown("q")  
        wait(.2)
        keyUp("q")

    elif reg.exists(gamma):
        keyDown("w")  
        wait(.2)
        keyUp("w")  

    elif reg.exists(beta):
        keyDown("e")  
        wait(.2)
        keyUp("e")

# When the user presses alt+z,  buttons q, w, or e are pushed down according to the symbol inside the region.
Env.addHotkey("z", KeyModifier.ALT, letsSpam)

##-------------------------------------------------

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