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 

arrow key remap for games

 
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: Fri Jul 02, 2004 10:04 pm    Post subject: arrow key remap for games Reply with quote

most strategy/RPG games let you scroll the map using the arrow keys.

this script scrolls the map using e,s,d,f.

to type the actual character e,s,d,f use the shift key.

Code:
e::up
s::left
d::down
f::right

$+e::send, e
$+s::send, s
$+d::send, d
$+f::send, f










the code below is obsolete.

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

+r::reload
+q::suspend

;capslock::send {space}   ;   capslock equals space
;space::Send {space}     ; non-repeating space 

space & e::
send,   {up down}
Loop
{
   getkeystate, state, e, p
      if state = u
      {
      send, {up up}
      break
          }
sleep 10
}
return

space & d::
send,   {down down}
Loop
{
   getkeystate, state, d, p
      if state = u
      {
      send, {down up}
      break
          }
sleep 10          
}
return

space & s::
send,   {left down}
Loop
{
   getkeystate, state, s, p
      if state = u
      {
      send, {left up}
      break
          }
sleep 10          
}
return

space & f::
send,   {right down}
Loop
{
   getkeystate, state, f, p
      if state = u
      {
      send, {right up}
      break
          }
sleep 10          
}
return




Code:
Code:


Last edited by jamestr on Sun Jul 16, 2006 4:25 pm; edited 3 times in total
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10465

PostPosted: Fri Jul 02, 2004 10:49 pm    Post subject: Reply with quote

If all you want to do is remap keys, it's much easier to do it this way:
space & d::Send {down}

The above also allows the hotkey to be auto-repeated by holding it down.

By contrast, the remapping technique you use would be useful for games that directly check the state of the arrow keys. Perhaps that's what you intended it for.
Back to top
View user's profile Send private message Send e-mail
NHO3



Joined: 23 Jul 2004
Posts: 9

PostPosted: Fri Jul 23, 2004 3:40 am    Post subject: sacred key binding Reply with quote

I play Sacred and the game doesnt allow you to change the key bindings and it has a stupid UI for the spells. The way it works is you select a spell with the number keys 6-0 then you have to right click your mouse to cast the spell. I want to be able to press F1 and have it select and cast the spell in the 6 slot. This is what i tried but it didnt do anything. I am very new to this scripting.

run C:\games\sacred\sacred.exe

F6::Send {6 RButton}
F7::Send {7 Rbutton}
F8::Send {8 RButton}
F9::Send {9 RButton}
F10::Send {0 RButton}

It ran the game of course but it didnt execute the right button when I pressed the corrosponding F key. Please help.
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10465

PostPosted: Fri Jul 23, 2004 4:00 am    Post subject: Reply with quote

Try changing each hotkey as follows:
F6::
Send 6
MouseClick, right
return
Back to top
View user's profile Send private message Send e-mail
NHO3



Joined: 23 Jul 2004
Posts: 9

PostPosted: Fri Jul 23, 2004 4:08 am    Post subject: Reply with quote

Hmm I think it works going to do more testing. Thanks!!!!!!
Back to top
View user's profile Send private message
NHO3



Joined: 23 Jul 2004
Posts: 9

PostPosted: Fri Jul 23, 2004 4:15 am    Post subject: Reply with quote

It does work wonderfully thanks so much!!!!!! Now I need to figure out how to make a hotkey to change the spells on the toolbar and how to make the script end when the game exits.
Back to top
View user's profile Send private message
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