 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Cymbrogi Guest
|
Posted: Fri Mar 25, 2005 4:16 am Post subject: Suspend hotkeys until 1 of 2 keys is pressed - how? |
|
|
Hi all
I've just started using this program and the scripting because the Joint Operations game didn't let me set any toggles for posture of my player. My current problem is this (having solved the posture one):
when I try to use the in-game chat, the "C" key (which is scripted for the "prone function" in the game) is unavailable to be used for typing. What I want to do is have the script watch for EITHER the Enter keystroke (showing I've sent my typed message) OR the Esc keystroke (showing I canceled my typed message). I know KeyWait will work for 1 keystroke, but how do I do the either / or situation?
Here's the script I put together, in case its any use for anyone else who sees this.
| Code: |
;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: Cymbrogi (cymbrogi@gmx.net)
;
;
; Stand is mapped to Delete
; Crouch is mapped to End
; Prone is mapped to PgDn
; This will let you have more of a toggle to your positions than the 3 key setup in JO.
; For example, if you are standng, hitting LShift will go to crouch. Then, if you want to go prone,
; you hit C. Because of the nested IF statements, you are able to hit C to stand up from that prone
; hit LShift to go back to crouching, using LShift again to stand up.
; The effect is that, if you keep track of what position you are in, hitting the key that matches that
; position (hit C if in prone and LShift if in crouch) will let you stand up. No more messing with a
; third key to stand up!
Process, Priority, , High
#KeyHistory 0
SetBatchLines, 10ms
stand=true
crouch=false
prone=false
LShift::
; Standing, so crouch when hit LShift
if stand=true
if crouch=false
if prone=false
{
send,{End}
stand=false
crouch=true
prone=false
return
}
; Crouching, so stand when hit Lshift
if stand=false
if crouch=true
if prone=false
{
send,{Delete}
stand=true
crouch=false
prone=false
return
}
; Prone, so crouch when hit Lshift
if stand=false
if crouch=false
if prone=true
{
send,{End}
stand=false
crouch=true
prone=false
return
}
; End of routine for Lshift
C::
; Standing, so go prone when hit C
if stand=true
if crouch=false
if prone=false
{
send,{PgDn}
stand=false
crouch=false
prone=true
return
}
; Prone already, so stand when hit C
if stand=false
if crouch=false
if prone=true
{
send,{Delete}
stand=true
crouch=false
prone=false
return
}
; Crouching, so go prone when hit C
if stand=false
if crouch=true
if prone=false
{
send,{PgDn}
stand=false
crouch=false
prone=true
return
}
; End of routine for C
|
|
|
| Back to top |
|
 |
Hester
Joined: 07 Mar 2005 Posts: 27
|
Posted: Fri Mar 25, 2005 5:55 am Post subject: |
|
|
here you go
good luck on your last posture state when you die or when the map changes
| Code: |
;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: Cymbrogi (cymbrogi@gmx.net)
;
;
; Stand is mapped to Delete
; Crouch is mapped to End
; Prone is mapped to PgDn
; This will let you have more of a toggle to your positions than the 3 key setup in JO.
; For example, if you are standng, hitting LShift will go to crouch. Then, if you want to go prone,
; you hit C. Because of the nested IF statements, you are able to hit C to stand up from that prone
; hit LShift to go back to crouching, using LShift again to stand up.
; The effect is that, if you keep track of what position you are in, hitting the key that matches that
; position (hit C if in prone and LShift if in crouch) will let you stand up. No more messing with a
; third key to stand up!
Process, Priority, , High
#KeyHistory 0
SetBatchLines, 10ms
stand=true
crouch=false
prone=false
imchattin=false
*LShift::
; Standing, so crouch when hit LShift
if stand=true
if crouch=false
if prone=false
if imchattin=false
{
send,{End}
stand=false
crouch=true
prone=false
return
}
; Crouching, so stand when hit Lshift
if stand=false
if crouch=true
if prone=false
if imchattin=false
{
send,{Delete}
stand=true
crouch=false
prone=false
return
}
; Prone, so crouch when hit Lshift
if stand=false
if crouch=false
if prone=true
if imchattin=false
{
send,{End}
stand=false
crouch=true
prone=false
return
}
; End of routine for Lshift
*c::
; Standing, so go prone when hit C
if stand=true
if crouch=false
if prone=false
if imchattin=false
{
send,{PgDn}
stand=false
crouch=false
prone=true
return
}
; Prone already, so stand when hit C
if stand=false
if crouch=false
if prone=true
if imchattin=false
{
send,{Delete}
stand=true
crouch=false
prone=false
return
}
; Crouching, so go prone when hit C
if stand=false
if crouch=true
if prone=false
if imchattin=false
{
send,{PgDn}
stand=false
crouch=false
prone=true
return
}
; End of routine for C
*t:: ; set this key to whatever you need to to chat
; im chatting so stop changing the dag-nab posture keys :)
imchatting=true
send, t
return
*enter::
; i just sent a message
imchatting=false
send, {enter}
return
*escape::
; i changed my mind and dont want to chat
imchatting=false
send, {escape}
return |
|
|
| Back to top |
|
 |
Cymbrogi Guest
|
Posted: Fri Mar 25, 2005 3:02 pm Post subject: |
|
|
Thanks - I'll look more deeply at that once I get home from work.
As for the posture state at death or mapchange, yeah, that's a bugaboo. I have the same issues in my script for Counterstrike, so its become second nature to just hit everything immediately after I respawn.
Even with that issue, this is much much better than the stock control setups. |
|
| Back to top |
|
 |
Cymbrogi Guest
|
Posted: Wed Mar 30, 2005 4:30 am Post subject: |
|
|
well, after the easter holiday I got back to working with this. Here's the new problem (note there are some spelling errors between "imchattin" and imchatting).
Whenever I hit the "t" to chat in the game, the Lshift and C keys send ONLY the letter t. I'm clearly out of my area of skill with this. Why would they be all of a sudden send "t"? I see it once, but shouldn't that be what is sent when I hit T and only that one time?
An alternative idea I had was that if I hit "t" twice in quick succession, that would temporarily disable all of the hotkeys until I either hit enter or esc. Of course, I'm lost on how to tackle that one at all.
So, thanks for anything that can be done to guide me - even just as to whether or not either of these tasks is possible (which I'm sure they are). Even just a suggestion as to what commands might be involved would be helpful. |
|
| Back to top |
|
 |
Hester
Joined: 07 Mar 2005 Posts: 27
|
Posted: Wed Mar 30, 2005 4:48 am Post subject: |
|
|
oops we both missed the return for c and LShift
the script stopped at the return for t thats why t was showing up when c or LShift was pressed.
| Code: |
;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: Cymbrogi (cymbrogi@gmx.net)
;
;
; Stand is mapped to Delete
; Crouch is mapped to End
; Prone is mapped to PgDn
; This will let you have more of a toggle to your positions than the 3 key setup in JO.
; For example, if you are standng, hitting LShift will go to crouch. Then, if you want to go prone,
; you hit C. Because of the nested IF statements, you are able to hit C to stand up from that prone
; hit LShift to go back to crouching, using LShift again to stand up.
; The effect is that, if you keep track of what position you are in, hitting the key that matches that
; position (hit C if in prone and LShift if in crouch) will let you stand up. No more messing with a
; third key to stand up!
Process, Priority, , High
#KeyHistory 0
SetBatchLines, 10ms
stand=true
crouch=false
prone=false
imchatting=false
*LShift::
; Standing, so crouch when hit LShift
if stand=true
if crouch=false
if prone=false
if imchatting=false
{
send,{End}
stand=false
crouch=true
prone=false
return
}
; Crouching, so stand when hit Lshift
if stand=false
if crouch=true
if prone=false
if imchatting=false
{
send,{Delete}
stand=true
crouch=false
prone=false
return
}
; Prone, so crouch when hit Lshift
if stand=false
if crouch=false
if prone=true
if imchatting=false
{
send,{End}
stand=false
crouch=true
prone=false
return
}
; End of routine for Lshift
return
*c::
; Standing, so go prone when hit C
if stand=true
if crouch=false
if prone=false
if imchatting=false
{
send,{PgDn}
stand=false
crouch=false
prone=true
return
}
; Prone already, so stand when hit C
if stand=false
if crouch=false
if prone=true
if imchatting=false
{
send,{Delete}
stand=true
crouch=false
prone=false
return
}
; Crouching, so go prone when hit C
if stand=false
if crouch=true
if prone=false
if imchatting=false
{
send,{PgDn}
stand=false
crouch=false
prone=true
return
}
; End of routine for C
return
*t:: ; set this key to whatever you need to to chat
; im chatting so stop changing the dag-nab posture keys :)
imchatting=true
send, t
return
*enter::
; i just sent a message
imchatting=false
send, {enter}
return
*escape::
; i changed my mind and dont want to chat
imchatting=false
send, {escape}
return |
|
|
| Back to top |
|
 |
Cymbrogi Guest
|
Posted: Wed Mar 30, 2005 11:08 pm Post subject: |
|
|
that still didn't work, but here's what does!
at the end of each option for posture, i added an 'else' followed by 'send, {key}' like so:
| Code: |
*c::
; Standing, so go prone when hit C
if stand=true
if crouch=false
if prone=false
if imchatting=false
{
send,{PgDn}
stand=false
crouch=false
prone=true
return
}
else
send, c
|
Note the "else" on the line following the }.
Now it lets me type C's where I need them! The shift key didn't seem to work for capital letters, but that is such a non-issue I don't care if it works. It was hard telling people "cover me" without being able to type "c"
Thanks for the help, the posture stuff is working great and I might end up porting this script to other games that don't have toggles for posture.
Cymbrogi |
|
| Back to top |
|
 |
Watcher
Joined: 27 Dec 2004 Posts: 60
|
Posted: Sat Apr 02, 2005 4:48 pm Post subject: |
|
|
Give this a try if you like, it's MUCH more efficient than what you had and should function identically. Sorry but I had no way to test so good luck.
| Code: |
;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: Cymbrogi (cymbrogi@gmx.net)
;
;
; Stand is mapped to Delete
; Crouch is mapped to End
; Prone is mapped to PgDn
; This will let you have more of a toggle to your positions than the 3 key setup in JO.
; For example, if you are standng, hitting LShift will go to crouch. Then, if you want to go prone,
; you hit C. Because of the nested IF statements, you are able to hit C to stand up from that prone
; hit LShift to go back to crouching, using LShift again to stand up.
; The effect is that, if you keep track of what position you are in, hitting the key that matches that
; position (hit C if in prone and LShift if in crouch) will let you stand up. No more messing with a
; third key to stand up!
Process, Priority, , High
#KeyHistory 0
SetBatchLines, 10ms
crouch=false
prone=false
chatting=false
*LShift::
{
If (!chatting) ; if chatting leave
{
If (!crouching && !prone) ; must be standing
{
; Standing, so crouch when hit LShift
send {End}
crouch=true
}
Else ; not standing so...
{
If crouching
{
send,{Delete}
crouch=false
}
Else ; must be prone
{
send,{End}
crouch=true
prone=false
}
}
}
return
}
*c::
{
If (!chatting) ; not chatting
{
If (!crouching && !prone) ; must be standing
{
; Standing, so go prone when hit C
send,{PgDn}
prone=true
}
Else ; not standing
{
If crouching
{
; Crouching, so go prone when hit C
send,{PgDn}
crouch=false
prone=true
}
Else
{
; Prone already, so stand when hit C
send,{Delete}
prone=false
}
}
}
return
}
*t:: ; set this key to whatever you need to to chat
; im chatting so stop changing the dag-nab posture keys :)
chatting=true
send t
return
*enter::
; i just sent a message
chatting=false
send {enter}
return
*escape::
; i changed my mind and dont want to chat
chatting=false
send {escape}
return
|
|
|
| Back to top |
|
 |
h3x-RS- Guest
|
Posted: Tue Nov 07, 2006 3:47 pm Post subject: |
|
|
Can somebody help me make a script for this game to lean left & run right?
lean left = q
strafe right = d
I have tried
| Code: | control::
send, qd
return |
I have also tried
| Quote: | *control::
send, {q}
send, {d} |
and a bunch of other similar codes but, no luck Would be very great full if somebody could help me  |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 2951 Location: Minnesota
|
Posted: Tue Nov 07, 2006 8:33 pm Post subject: |
|
|
You mean to hold them down? Try this.
| Code: | *control::send,{q down}{d down}
*control up::send,{q up}{d up} |
|
|
| Back to top |
|
 |
h3x-RS- Guest
|
Posted: Fri Nov 10, 2006 5:21 pm Post subject: |
|
|
Thanks, worked perfectly  |
|
| Back to top |
|
 |
h3x-RS- Guest
|
Posted: Sun Nov 12, 2006 4:12 pm Post subject: Sorry to be a pest :) |
|
|
Thanks for the fast & accurate help before, wandering if you could help me with a new script.
I'm trying to replicate the snake glitch in JO.
The snake glitch goes like this
hold w
press z
tap a & d repeatedly
I've managed to get it to do it, but only briefly & the sequence never properly stopped (it never released W).
heres some of the things I've tried so far:
| Code: | ;Loop, 10
;{
;*w::send,{z down} {a down}{d down}
;*w up::send, {a up}{d up}
;}
;w::
;send, {w down}
;send, {z down}
;Loop
;{
;send, {a down}
;sleep, 10
;send, {a up}
;sleep, 10
;send, {d down}
;sleep, 10
;send, {d up}
;}
alt::
loop
{
sleep, 5
send, {a}
sleep, 10
send, {d}
}
return
|
One of the big problems i've been having is trying to get it to stop  |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|