Sign in to follow this  
Followers 0
Chaz

Holding a button down

3 posts in this topic

Hi, i am having trouble making my script hold the button down.

I want the script to hold down the button and hold it for a certain amount of seconds.

It is for a game to make it walk.

$timer = TimerInit()
Send("{UP down}")

While $timer < 8000
Sleep(10)
WEnd

Send("{UP up}")

Unfortunately, this doesn't work as all it does is press up, but it does not constantly press it.

To fix this, i've tried these:

$timer = TimerInit()

While $timer < 8000
Send("{UP}")
sleep(10)
WEnd

$timer = TimerInit()

While $timer < 8000
Send("{UP down}")
sleep(10)
Send("{UP up}")

WEnd

I was wondering if i am doing anything wrong. Thanks for your help in advance =).

Share this post


Link to post
Share on other sites



$timer = TimerInit()

Do
     Send ("{UP}")
     $Diff = TimerDiff ($timer)
Until $Diff > 8000

Sure, that doesn't hold it, but it sure presses it fast.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

That does the same thing as the While statement, I'll give it a shot though

Edit: nvm stupid mistake, thanks everyone i fixed it

Edited by Chaz

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