Help - Search - Members - Calendar
Full Version: How to change Marco dynamically?
AC Tools Everything Macro > General Discussion > C++/Delphi/VB Development
bloodbird
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
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.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.