AutoHotkey Community

It is currently May 26th, 2012, 3:41 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: March 25th, 2005, 5:16 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 25th, 2005, 6:55 am 
Offline

Joined: March 7th, 2005, 4:09 am
Posts: 27
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 25th, 2005, 4:02 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2005, 5:30 am 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2005, 5:48 am 
Offline

Joined: March 7th, 2005, 4:09 am
Posts: 27
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 31st, 2005, 12:08 am 
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" :lol:

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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2005, 5:48 pm 
Offline

Joined: December 28th, 2004, 12:33 am
Posts: 60
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 7th, 2006, 4:47 pm 
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 :wink:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 7th, 2006, 9:33 pm 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
You mean to hold them down? Try this.

Code:
*control::send,{q down}{d down}
*control up::send,{q up}{d up}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 10th, 2006, 6:21 pm 
Thanks, worked perfectly :D


Report this post
Top
  
Reply with quote  
 Post subject: Sorry to be a pest :)
PostPosted: November 12th, 2006, 5:12 pm 
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 :?


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: 0x150||ISO, Bing [Bot], Exabot [Bot], Yahoo [Bot] and 15 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group