tttommeke

Key down

7 posts in this topic

What is the code for holding a key down ?

Like in games if you walk you hold key down w (or z) for 10 seconds.

I already tried with sending always again a new w (or z) in the game but the games freaks and crash. So i need to now how i can keep the key down for X seconds

Exemple :

You are walking 100 yards. So the key must be like 10 seconds down before you reach the finish or so.

Hope you guys can help me.

Share this post


Link to post
Share on other sites



$secondsToHoldKey = 10 ;change this if you want
$KeyToPress = "w" ;also change this if you want

Send ("{"&$KeyToPress&" DOWN}")
Sleep ($secondsToHoldKey*1000)
Send ("{"&$KeyToPress&" UP}")


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

$secondsToHoldKey = 10 ;change this if you want
$KeyToPress = "w" ;also change this if you want

Send ("{"&$KeyToPress&" DOWN}")
Sleep ($secondsToHoldKey*1000)
Send ("{"&$KeyToPress&" UP}")
tnx

Share this post


Link to post
Share on other sites

$secondsToHoldKey = 10 ;change this if you want

$KeyToPress = "w" ;also change this if you want

Send ("{w DOWN}")

Sleep ($secondsToHoldKey*1000)

Send ("{w UP}")

But i run it, i've got a character w

hold key "w" for 10 seconds, i must got "wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww" ?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

You just want to push 'w' over and over? Stick the above in a loop. Or, you can just do it like this:

HotKeySet('{esc}', 'quit')

$millisecondsToDelayKey = 50 ;change this if you want
$KeyToPress = "w" ;also change this if you want

While 1
    Send ("{"&$KeyToPress&"}")
    Sleep ($millisecondsToDelayKey)
WEnd

Func quit()
    Exit
EndFunc
Edited by xcal

Share this post


Link to post
Share on other sites

Don't work!

i can't do this!!!

if I exec this:

$secondsToHoldKey = 10 ;change this if you want
$KeyToPress = "w" ;also change this if you want

Send ("{"&$KeyToPress&" DOWN}")
Sleep ($secondsToHoldKey*1000)
Send ("{"&$KeyToPress&" UP}")

the result is:

w

and stop.....

whyyyyyy?!?! :'(


Console Browse: Navigate on the WEB in a textual consoleMultiPing!: Show computer on the lan and/or show the local/remote task, ALL animated!KillaWin: Event executingCryptPage: Crypt your webpage and show only with key

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

This thread is nearly 9 years old and all participants have been offline for years.
A lot has changed in the meantime: Did you notice that discussing game automation is no longer permitted on this forum?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2016-08-18 - Version 1.4.6.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2016-12-04 - Version 1.2.2.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

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