Adding an external macro compiler
Posted: Thu Feb 24, 2011 9:06 pm
I have been picking through the innards of the macro data and macro index files, and found out that they are not actually too convoluted and I might have a chance at figuring them out.
This made me take a second look at something I have been considering for a while. Basically, I would like to see if it is possible to write a standalone compiler for ACK macros that would translate from text files (similar to the exported MACROS.TXT) into the ACK native macro file.
Once the compiler had been executed, the resulting macro file could be used in-game just like one that had been created in the ACK macro editor. But having an external compiler to feed macros in would add several new feature possibilities:
o Macro code could be commented (// comment)
o Labels could be named (instead of "IF A=2 THEN 25", "IF A=2 THEN UnlockDoor")
o Variables could be named (instead of "IF K>10...", you could have "IF LockPickSkill > 10..."
o The 'hack' commands tied into DRAW could be translated from more-meaningful names - instead of DRAW 999 0 ...., you could enter a command like DRAWTILE, and the proper sequence of parameters would be generated.
I might also be able to implement macros that call other macros as subroutines (nested macros), and maybe even do something about the 255-macro limit. You probably wouldn't be able to open macros over 255 in the editor, and they would probably only be callable by other macros, but it would be something.
And of course this would make it much easier to port macros from one game to another.
If anyone thinks this would be useful, let me know, and I will take a crack at it.
This made me take a second look at something I have been considering for a while. Basically, I would like to see if it is possible to write a standalone compiler for ACK macros that would translate from text files (similar to the exported MACROS.TXT) into the ACK native macro file.
Once the compiler had been executed, the resulting macro file could be used in-game just like one that had been created in the ACK macro editor. But having an external compiler to feed macros in would add several new feature possibilities:
o Macro code could be commented (// comment)
o Labels could be named (instead of "IF A=2 THEN 25", "IF A=2 THEN UnlockDoor")
o Variables could be named (instead of "IF K>10...", you could have "IF LockPickSkill > 10..."
o The 'hack' commands tied into DRAW could be translated from more-meaningful names - instead of DRAW 999 0 ...., you could enter a command like DRAWTILE, and the proper sequence of parameters would be generated.
I might also be able to implement macros that call other macros as subroutines (nested macros), and maybe even do something about the 255-macro limit. You probably wouldn't be able to open macros over 255 in the editor, and they would probably only be callable by other macros, but it would be something.
And of course this would make it much easier to port macros from one game to another.
If anyone thinks this would be useful, let me know, and I will take a crack at it.