Almost there! Need some help creating 2 toggles :) Topic is solved
Posted: 02 May 2017, 11:30
Hello!
I created a script to hold down a key (Q and E, respectively) on a toggle. This is so that I can toggle the leaning function in-game. (S.T.A.L.K.E.R : Call of Pripyat)
I need the script to do 3 things:
However once in-game it works once, then stops leaning. Alt-tabbing back to notepad and it works no problem?
Any help would be amazing!
Thanks
EDIT:
Here is the code that solved my problem! (posted by neomulemi6) (
I created a script to hold down a key (Q and E, respectively) on a toggle. This is so that I can toggle the leaning function in-game. (S.T.A.L.K.E.R : Call of Pripyat)
I need the script to do 3 things:
- Hold Q down on a toggle
- Hold E down on a toggle
- Switch between holding E to holding Q when the other one is pressed
However once in-game it works once, then stops leaning. Alt-tabbing back to notepad and it works no problem?
Any help would be amazing!
Thanks
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.
#maxThreadsPerHotkey, 4
;================DECLARE VARIABLES===================================
toggle_q := 0
toggle_e := 0
;===========RUN LEAN_HOLD EVERY 100 TICS=============================
settimer, lean_hold_q, 100 ;run lean_hold every 100 tics
settimer, lean_hold_e, 101
;===========Q BUTTON TOGGLE==========================================
*q::
toggle_e := 0 ;stop other lean direction
toggle_q := !toggle_q ; switch from toggle true/false everytime "q" pressed
lean_hold_q: ;routine runs by setimer
If (!Toggle_q) ; if not toggled on, do nothing
Return
Sendinput {q DOWN} ; if toggled on send q
return
;===========E BUTTON TOGGLE (SAME AS Q TOGGLE)=======================
*e::
Toggle_q := 0
toggle_e := !toggle_e
lean_hold_e:
If (!Toggle_e)
Return
Sendinput {e DOWN}
return
Here is the code that solved my problem! (posted by neomulemi6) (
Code: Select all
*q::
q := !q
if (q)
send {e up}{q down}
else
send {q up}
Return
*e::
e := !e
if (e)
send {q up}{e down}
else
send {e up}
Return