Walking + jumping script

Ask gaming related questions (AHK v1.1 and older)
Derty
Posts: 2
Joined: 01 Apr 2018, 00:18

Walking + jumping script

01 Apr 2018, 00:25

Hello, I'm hoping you guys can help me out here.

What I'm trying to achieve is the following; I want my character to walk a certain distance while holding the RIGHT arrow, then pressing the LShift button down for 200 miliseconds.
However, these commands seem to get messed up, the jump only seems to happen at the moment the command for RIGHT is finished, and not during the RIGHT press event.

Could anyone please give me any advice on how to handle this? This is my current code:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

^j::
	SendInput {Right down}
	Sleep 3000
	SendInput {LShift down}
	Sleep 200
	SendInput {Right up}
	SendInput {LShift up}
	
	
Return





Edit: Apologies for the double post in the wrong forum section. Since I've posted this I've looked into Timers, since that seems to be what I'm looking for, but I can't seem to figure it out.
Rohwedder
Posts: 7656
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Walking + jumping script

01 Apr 2018, 02:16

Hallo,
only a try:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

^j::
	SendInput {Right down}
	Sleep 3000
	SendInput {LShift down}{Right down}
	Sleep 200
	SendInput {Right up}
	SendInput {LShift up}	
Return
Derty
Posts: 2
Joined: 01 Apr 2018, 00:18

Re: Walking + jumping script

01 Apr 2018, 14:09

That's a bit more like it, though it doesn't do what I want it to do just yet. At the moment, I have 3 scripts set up;

-One that makes my character walk Right for a set amount of time
-One that makes my character jump (LShift)
-One that activates both these scripts to function at the same time


That's working as intended, although the order in which the commands are sent seems a bit random, it's not consistent. However my new issue is that whenever both these commands are executed and the script is done, my character is
right above a pit of spikes. I now tried to make a new set of 3 scripts, doing pretty much the same thing but with different Sleep delays, and all set to a different button, of course.

This doesn't seem to work. My character only does a little jump in mid air without moving to the right. Are there too many scripts running at the same time for the second set of scripts to recognize both Right and LShift?
Am I going about this the wrong way altogether, is it possible to just add a delay of not doing anything to my first set of 3 scripts, and then make it execute the Right and Lshift movements later, being in the same script?
neverlevel
Posts: 60
Joined: 13 Apr 2016, 22:02

Re: Walking + jumping script

02 Apr 2018, 21:11

I think the sleep is short on the jump ...change 200 up to 1000 or your max air time..1000 is one second.. you probably need to right at least that long too

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 24 guests