AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Joystick script sample

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
jamestr



Joined: 05 Apr 2004
Posts: 96
Location: Connecticut USA

PostPosted: Sat Jun 26, 2004 2:39 pm    Post subject: Joystick script sample Reply with quote

One way to have keyboard modifier/prefix keys work with joybuttons, is to config the joysticks 'official' drivers (logitech, saitek, MS, thrustmaster, etc) to output keyboard keys instead of joybuttons.

I configured my logitech drivers to output 6, 7, 8 and 9, when i press joy1, joy2, joy3 or joy4.

then i can use the normal AHK prefix/modifier keys:

space & 6::send (insert game code here)
space & 7::
space & 8::
space & 9::

etc



Another way to use modifier keys is with a script like this:

Holding down the spacebar;
will change Joybutton2 and the POV hat switch.


Code:
#HotkeyInterval 1000       ;     default 2000
#MaxHotkeysPerInterval 250    ; default 5

!r::reload
!q::suspend

               ;Joy2 changed by 'spacebar'
Joy2:: 
getkeystate, state, space, P
if state =  D
   {
   MsgBox, 0, , spacebar       spacebar      spacebar   , .7
   return
   }
MsgBox, 0, , normal , .7
return



               ;POV switch modified by 'spacebar'
space::
getkeystate, state, JoyPOV
   ifequal, state, 0,         Send, {up}
   ifequal, state, 9000,      send, {right}
   ifequal, state, 18000,      send, {down}
   ifequal, state, 27000,      send, {left}
sleep, 50
return


Last edited by jamestr on Sun Jun 27, 2004 12:16 am; edited 1 time in total
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10465

PostPosted: Sat Jun 26, 2004 3:32 pm    Post subject: Reply with quote

The master of custom hotkey combinations strikes again! Smile
Back to top
View user's profile Send private message Send e-mail
jamestr



Joined: 05 Apr 2004
Posts: 96
Location: Connecticut USA

PostPosted: Sat Jun 26, 2004 5:52 pm    Post subject: Reply with quote

If the space bar is held down;

joy2 and the POV buttons are still,
sent to the game, so one needs to config the game to ignore them.


Last edited by jamestr on Sat Jun 26, 2004 11:58 pm; edited 1 time in total
Back to top
View user's profile Send private message
jamestr



Joined: 05 Apr 2004
Posts: 96
Location: Connecticut USA

PostPosted: Sat Jun 26, 2004 6:39 pm    Post subject: Reply with quote

edited

Last edited by jamestr on Sun Jun 27, 2004 12:19 am; edited 2 times in total
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10465

PostPosted: Sat Jun 26, 2004 7:52 pm    Post subject: Reply with quote

You probably know that support for prefixes with joystick buttons is planned.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group