bloodbird
Sep 25 2004, 03:28 PM
when i run the game , i want to change the marco dynamically by a hotkey,
press F12 ----run or stop marcoScript 1
press F11 ----run or stop marcoScript 2
how to do it ?
or how to modify the sourcecode to realize it ?
Ahk
Sep 28 2004, 01:19 AM
Read the readme file on {globalkeys} and ClearGlobalKeys (might be in the actool help but I'm not sure). Use a While loop with a moderate delay to watch for the keys or check for the keypresses whenever using the ProcessMessages command.
Another note, look up Procedure, specifically the WHEN keyword.
You could use something like so:
| CODE |
Constants key_F12 = 123 key_F11 = 122 End ClearGlobalKeys
Procedure Bla When {GlobalKeys} contains $key_F12 TimeStamp F12 was pressed! End
Procedure Bla2 When {GlobalKeys} contains $key_F11 TimeStamp F11 was pressed! End
While 1 = 1 Delay 150 ProcessMessages ClearGlobalKeys End |
That's just an example, procedure names should be renamed, Bla isn't very descriptive lol. I cleared the keys *after* the processmessages so that all keypresses can be evaluated (none left out).
No need to change the macro, just include both into one macro, and then have the code branch off when necessary.