Can't figure out how to do this. Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
MSJC

Can't figure out how to do this.

03 Oct 2018, 09:48

Hello. I am trying to make a script so when i press a button it will send a message in-game, i have got this to work. But i can't seem to add in if a key is pressed then end the script.
This i what i have so far:
Numpad1:: ;Injuries
Send t/me Kneels down and inspect the individual for any signs of injuries.
Keywait, enter, D
Keywait, enter
Send t/do What would i see?{enter}
return

What i want to do is add a if a key is pressed after the first send then end the script there, if not continue.
ThewarII
Posts: 38
Joined: 01 Oct 2014, 09:33
Facebook: [email protected]

Re: Can't figure out how to do this.  Topic is solved

03 Oct 2018, 13:42

I guess you want use ahk in GTA SAMP
Is it correct ?

If correct, I guess you want:
Try with this

Code: Select all

Numpad1:: ;Injuries
Send t/me Kneels down and inspect the individual for any signs of injuries.
Loop,
{
If (State := GetKeyState("enter","D"))
{
Send t/do What would i see?{enter}
Break
}
If (State := GetKeyState("1","D")) ; try use 1 or numpad1.
{
Break
}
}
return
It meant if you press numpad1 & again the loop is stop.
If you press numpad1 & enter the loop is send /do ... & stop.

I know it isn't good script.

Another way, you can try with this:

Code: Select all

with this
Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Numpad1:: ;Injuries
Send t/me Kneels down and inspect the individual for any signs of injuries.
Loop,
{
Keywait, enter, D
Keywait, enter
{
Send t/do What would i see?{enter}
Break
}
}
Return
and that is better than before but the loop won't stop without use enter so I think need add

Code: Select all

Keywait, 1, D
{
Break
}
like this

Code: Select all

Send t/do What would i see?{enter}
Break
}
Keywait, 1, D
{
Break
}
I :superhappy: when I know about AHK.
I have been using AHK for do anything in microsoft window.
The first time I know it in around year 2013.

Return to “Ask For Help”

Who is online

Users browsing this forum: Gio, Google [Bot], Sashkon and 120 guests