How would I go about creating a chat command with arguments?
For now im using, a separate trigger for every debug command. And my god there is alot of them to make sure everything is working as it should be. I notice I am spending more and more time doing this when I could be doing something like.
-Debug time x
which would set the time of a variable to any integer that I put in the chat command.
Take a look at the "Crap Patrol 2" map on BNET (it's unlocked for sc2edit), I've made a quite thorough debug system there.
It's all contained in its own Debug subfolder in the treeview.
In a live game you need to be authorized (4 people are, based on player bnet ids), but as long as you run the map through the editor you are automatically authorized.
Thanks to the string natives available in SC2 making string parsers is easier than ever.
For word based commands you can iterate through the string word by word processing as required. In your case "-debug" would be the partially matched event word and then the second word of the string would be put through multiple selection to determine the command to perform. The third, or however many word is then processed as an argument for that command.
I literally threw together a debug system like that for Undead Assault 3 in a couple of minutes. Of course I disabled it for online play so no one could ever be tempted to cheat, not even myself.
How would I go about creating a chat command with arguments?
For now im using, a separate trigger for every debug command. And my god there is alot of them to make sure everything is working as it should be. I notice I am spending more and more time doing this when I could be doing something like.
-Debug time x
which would set the time of a variable to any integer that I put in the chat command.
Anyone could leave an example would be great.
You can use one trigger / event for this functionality. Terrible psuedoscript below.
@PirateArcade | I make games | Ask me things on Discord
Take a look at the "Crap Patrol 2" map on BNET (it's unlocked for sc2edit), I've made a quite thorough debug system there.
It's all contained in its own Debug subfolder in the treeview.
In a live game you need to be authorized (4 people are, based on player bnet ids), but as long as you run the map through the editor you are automatically authorized.
Thanks to the string natives available in SC2 making string parsers is easier than ever.
For word based commands you can iterate through the string word by word processing as required. In your case "-debug" would be the partially matched event word and then the second word of the string would be put through multiple selection to determine the command to perform. The third, or however many word is then processed as an argument for that command.
I literally threw together a debug system like that for Undead Assault 3 in a couple of minutes. Of course I disabled it for online play so no one could ever be tempted to cheat, not even myself.