| View previous topic :: View next topic |
| Author |
Message |
sniggles Guest
|
Posted: Tue May 13, 2008 3:32 am Post subject: ARGGH - Help Please - Mapping RButton to two keyboard keys? |
|
|
Hi guys
Just spent hours trying to work this out and on the IRC instant chat room but no luck or help that worked.
A simple problem - I hope!
Just need a simple script to allow my right mouse button while being held down to simulate holding down both x and w simultaneously on the keyboard
I am a complete NEWB and i can get the right mouse button to simulate holding down one keyboard button but not two - beyond my humble scripting skills.
The script i can get working is - RButton::w
That is great and when playing my PC game (Star Wars Knights of the Old Republic) by pressing and holding the right mouse button i run forward like i want.
The problem is i need to get another keyboard button (the look around button) to also simulate being held down for steering my character while i run. In game i have remapped this button from ctrl to x to avoid any conflicts with ctrl/alt/del auto functions etc.
So - I tried the scripts RButton::wx and RButton::w & x and they are not recognised as correct scripts and and autohotkey won't load them.
Any help would be greatly appreciated.
I will check back regularly to see if any kind person has had the time to chuck me a few scripts to try out.
Again - all i need is a script that as long as i hold down the right mouse button - the keyboard keys w and x are also held down |
|
| Back to top |
|
 |
Vinthian
Joined: 11 May 2008 Posts: 15 Location: USA
|
Posted: Tue May 13, 2008 3:36 am Post subject: |
|
|
I don't know if this will work,
| Code: | RButton::
Send w
Send x
return
|
I also tried "Send {w down}" and "Send {x down}" but I really can't test it. |
|
| Back to top |
|
 |
Ian
Joined: 15 Jul 2007 Posts: 1157 Location: Enterprise, Alabama
|
Posted: Tue May 13, 2008 3:37 am Post subject: |
|
|
Sorry I kinda left you there but I got disconnected.
Try modifing this script pulled from [url=http://www.autohotkey.com/forum/viewtopic.php?t=31303]
| Code: |
SendMode Play
~*LButton::
loop
{
GetKeyState, LButtonState, LButton, P
GetKeyState, CapsState, CapsLock, T
if (LButtonState = "U") || (CapsState = "U")
{
break
}
else
{
send {click down}
sleep, 10
send {click up}
sleep, 30
}
}
Return |
_________________ ScriptPad/~dieom/dieom/izwian2k7/Trikster/God
 |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 848 Location: London, UK
|
Posted: Tue May 13, 2008 3:39 am Post subject: |
|
|
Also try
| Code: | Rbutton::
Send,{w down}
Send,{x down}
Return
Rbutton Up::
Send,{w up}
Send,{x up}
Return |
_________________ Steve F AKA Superfraggle
http://r.yuwie.com/superfraggle |
|
| Back to top |
|
 |
Vinthian
Joined: 11 May 2008 Posts: 15 Location: USA
|
Posted: Tue May 13, 2008 3:46 am Post subject: |
|
|
| Just a warning, you might want to add an extra function to pause the script, because you won't be able to right click properly until you exit the script (which I couldn't do since I couldn't right click the tray icon =_=) . |
|
| Back to top |
|
 |
sinkfaze
Joined: 19 Mar 2008 Posts: 140
|
Posted: Tue May 13, 2008 3:46 am Post subject: |
|
|
What about using the right mouse button as a hotkey to enable a SetTimer and run a loop that sends w & x, then assign some other button as a hotkey to turn the timer off? You won't be holding the right mouse button down that way, but I guess is it necessary to hold it down for gameplay purposes? _________________ Have trouble searching the site for information? Try Quick Search for Autohotkey. |
|
| Back to top |
|
 |
sinkfaze
Joined: 19 Mar 2008 Posts: 140
|
Posted: Tue May 13, 2008 3:50 am Post subject: |
|
|
@ Superfraggle:
Wouldn't you need to script it like this?
| Code: | *Rbutton::
Send {Blind}{w DownTemp}{x DownTemp}
Return
*Rbutton Up::
Send {Blind}{w up}{x up}
Return |
_________________ Have trouble searching the site for information? Try Quick Search for Autohotkey. |
|
| Back to top |
|
 |
sniggles Guest
|
Posted: Tue May 13, 2008 3:58 am Post subject: |
|
|
WOW WOW WOW
Thats okay Ian - thanks for your help.
Just got back after being distracted for a couple hours and all these replies.
What a great forum - I'm off to try out all the suggestions and i'm sure one of them must work.
Back in a while if i don't fall asleep (it's 4 am here - early yet - LOL) |
|
| Back to top |
|
 |
sniggles Guest
|
Posted: Tue May 13, 2008 4:10 am Post subject: |
|
|
Well that didn't take long to test - I worked backwards through the posted replies and the first script i tried from sinkfaze worked perfectly.
Thanks everyone for replying and especially sinkfaze.
I can now go to sleep in peace knowing that 'MAN' once again has beaten the machines - LOL.
Honestly - thanks guys - i love this game so much i wanted this 'hack' to work and now the game plays even metter - THANKS.
OOPS - Ggetttinggg tiryred starrrting ti mike spellang mitokes. |
|
| Back to top |
|
 |
[VxE]
Joined: 07 Oct 2006 Posts: 1128
|
Posted: Tue May 13, 2008 4:16 am Post subject: |
|
|
| Code: | Pause::Suspend
$*RButton::
SetTimer, KeyRep, -500
KeyRep:
If (A_ThisLabel != A_ThisHotkey)
SetTimer, KeyRep, -50
Send {Blind}{w down}{x down}
return
$*RButton up::
Send {Blind}{w up}{x up}
SetTimer, KeyRep, off
return |
This should be a very close approximation of the inverse of the hotkey including key repeat. _________________ My Home Thread
More Common Answers: 1. It's in the FAQ 2. Ternary ( ? : ) guide 3. Post code with [code][/code] tags |
|
| Back to top |
|
 |
|