by rld » Wed Sep 12, 2012 10:56 am
Trying to think of ways for games that want to do more complicated things, that the basic 'step macro' mechanism might be made more flexible and useful.
One thing that the step macro might typically be used for is to remove spell effects (such as a protection spell or increased combat skill) after a certain period of time. If you have a number of these you want to implement, the step macro might get cluttered up quickly, and you have to burn extra variables/flags for the counters, etc.
What we want to be able to do is add macros to a list that get run every turn along with the step macro, so if the step macro is #10, but we add 17 and 24 to the list as well, then every turn the macros 10, 17, and 24 will all be run in that order. Since the ACK engine doesn't allow macros to be nested (you can't call macros from inside other macros as subroutines, only jump/goto from one macro to another), this would also allow the macro code to be more modular and less tangled together.
So, adding a couple of new DRAW extension commands, like:
DRAW 999 xxx <macro> 0 0 0
where one command added a macro to the list and another removed it, would be simple enough. These could be called "daemons", like the background-running *nix processes.
Similarly, you could have a list of 'fuse' macros; when a macro was added to the list, you would give it a macro number and a number of turns until the macro would be run. Basically, a way to say, "run macro #32 in 10 turns"; after that, the macro would be automatically removed from the list.
You could add simple conditions as well, so that a daemon might only run when the player was holding (or wielding) a certain object, for example. Or more complex conditions that would be useful, but are hard to implement in macro code, like running a daemon only when a certain type of creature is within a certain number of squares of the player on the map. Or only every X number of turns, etc, etc.
Trying to think of ways for games that want to do more complicated things, that the basic 'step macro' mechanism might be made more flexible and useful.
One thing that the step macro might typically be used for is to remove spell effects (such as a protection spell or increased combat skill) after a certain period of time. If you have a number of these you want to implement, the step macro might get cluttered up quickly, and you have to burn extra variables/flags for the counters, etc.
What we want to be able to do is add macros to a list that get run every turn along with the step macro, so if the step macro is #10, but we add 17 and 24 to the list as well, then every turn the macros 10, 17, and 24 will all be run in that order. Since the ACK engine doesn't allow macros to be nested (you can't call macros from inside other macros as subroutines, only jump/goto from one macro to another), this would also allow the macro code to be more modular and less tangled together.
So, adding a couple of new DRAW extension commands, like:
DRAW 999 xxx <macro> 0 0 0
where one command added a macro to the list and another removed it, would be simple enough. These could be called "daemons", like the background-running *nix processes.
Similarly, you could have a list of 'fuse' macros; when a macro was added to the list, you would give it a macro number and a number of turns until the macro would be run. Basically, a way to say, "run macro #32 in 10 turns"; after that, the macro would be automatically removed from the list.
You could add simple conditions as well, so that a daemon might only run when the player was holding (or wielding) a certain object, for example. Or more complex conditions that would be useful, but are hard to implement in macro code, like running a daemon only when a certain type of creature is within a certain number of squares of the player on the map. Or only every X number of turns, etc, etc.