| View previous topic :: View next topic |
| Author |
Message |
biatche
Joined: 23 Feb 2008 Posts: 59
|
Posted: Sun Apr 20, 2008 10:03 am Post subject: [??] Why aren't hotkeys mapping not allowed within functions |
|
|
Ok, I got a big problem, its preventing me from what I want to do.
I wanna remap certain keys, but before that, I want some user interaction.. How do I go abouts this?
Basically it's like this
if code=123
hotkeys1()
if code=234
hotkeys2()
since this probably is a program limitation, anyone got any ideas how to go about this? |
|
| Back to top |
|
 |
Zippo() Guest
|
Posted: Sun Apr 20, 2008 11:29 am Post subject: |
|
|
| Use the Hotkey command. |
|
| Back to top |
|
 |
biatche
Joined: 23 Feb 2008 Posts: 59
|
Posted: Sun Apr 20, 2008 12:45 pm Post subject: |
|
|
function1()
{
Hotkey, !q::send, {Numpad7}
}
syntax dont seem right.. for sure without the hotkey command it doesn't work. thats when it complains about not being able to be inside a function |
|
| Back to top |
|
 |
n-l-i-d Guest
|
Posted: Sun Apr 20, 2008 1:17 pm Post subject: |
|
|
| Quote: | | syntax dont seem right |
... true, it isn't. You are mixing the Hotstring and Hotkey command. Reread the documentation. |
|
| Back to top |
|
 |
biatche
Joined: 23 Feb 2008 Posts: 59
|
Posted: Sun Apr 20, 2008 1:23 pm Post subject: |
|
|
i can't get "!q::send, {Numpad7} " into a function... it doesnt allow me to.
so zippo seem to have suggested me using hotkey, but reading the docs, i dont know what syntax to make |
|
| Back to top |
|
 |
Tuncay
Joined: 07 Nov 2006 Posts: 384 Location: Berlin
|
Posted: Sun Apr 20, 2008 1:34 pm Post subject: |
|
|
Look at this:
| Code: | function1()
function1()
{
Hotkey, !q, sendlabel
}
Return ; End of AutoExecution Section.
sendlabel:
send, {Numpad7}
return |
Tested.
With the Hotkey command you specify a Hotkey, which calls a subroutine (here named to sendlabel). To take the dynamically created Hotkey in effect, the command have to be executed. A function encapsulates all commands in it and does not execute automatically. You have to call the function explicitly (first line). |
|
| Back to top |
|
 |
biatche
Joined: 23 Feb 2008 Posts: 59
|
Posted: Sun Apr 20, 2008 2:20 pm Post subject: |
|
|
| Thanks Tuncay. |
|
| Back to top |
|
 |
|