Sign in to follow this  
Followers 0
DaTeL237

Double Press...

4 posts in this topic

I'm trying to perform a 'dodge' in Unreal Tournament (1999 in this case) with a single button press (through AutoIt... clearly)

Normally, this is performed by pressing a directional button twice in 'quick' succession...

So far I use a script to send the forward button, wait a bit, and send it again, unfortunately this does not result in a dodge

The problem (I believe) is that very often, the game does not process it being sent

When I start typing into the game (in the console for instance) it does however recognize all w's being sent

1st question, if someone knows a solution for this

2nd question (that I think might help solve it) is if it's possible to toggle/set a keyboard button's state (pressed/unpressed)? If so, I could make it press-wait-unpress-wait-press-wait-unpress...

ps. if i hold down 'u' for a long time, it does make me dodge eventually... but nothing near 'instant' (for example, 2 seconds later would not be uncommon)

ps2 Here's the script so far... oh and it never resulted in a dodge, although sometimes it does make me walk forward for (I think) 1 frame

MsgBox(0, "Script Ready!", "The script is running, press {U} to dodge? Press Alt+Esc to exit.")
HotKeySet("u", "Event")
HotKeySet("!{ESC}", "Terminate")

; Have the script running (event will interrpt it)
While 1
    Sleep(100)
WEnd

; "w" = walk forward, for some people "{up}" would be used
Func Event()
    Send("w") 
    Sleep(250)
    Send("w")
EndFunc

Func Terminate()
    Exit 0
EndFunc

Share this post


Link to post
Share on other sites



Hi and Welcome to the forums!

Straight out from the helpfile:

To hold a key down (generally only useful for games)

Send("{a down}") ;Holds the A key down

Send("{a up}") ;Releases the A key

Please try it yourself next time, you could learn something ;)

Share this post


Link to post
Share on other sites

Ouch that made me look way stupid ;) I looked through the online documentation but missed that part...

anyway here's the resulting dodge-from-standstill script (if 'w' is your walk-forward button)

One thing that took some time to figure out was that I had to run AutoIt 'as administrator' before it could interact with UT at all (it wouldn't even register keypresses without it, even in windowed mode)

$holdDurationMS = 20
$releaseDurationMS = 10

MsgBox(0, "Script running!", "The script is running, press R to forward-dodge, press Alt+Esc to exit.")
HotKeySet("r", "Dodge")
HotKeySet("!{ESC}", "Terminate")

; Have the script running (event will interrpt it)
While 1
    Sleep(100)
WEnd

Func Dodge()
    Send("{w down}") 
    Sleep($holdDurationMS)
    Send("{w up}")
    Sleep($releaseDurationMS)
    Send("{w down}")
    Sleep($holdDurationMS)
    Send("{w up}")
EndFunc

Share this post


Link to post
Share on other sites

One thing that took some time to figure out was that I had to run AutoIt 'as administrator' before it could interact with UT at all (it wouldn't even register keypresses without it, even in windowed mode)

You can put a #RequireAdmin on top of your script, and the user will be forced to run your script as admin. ;)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0