I know how to set the trigger colors using the user-interface. But I want to know how to code the actual script for it instead of doing it through MUSH itself.
One approach is to use ImportXML. This lets you set up things (like triggers) using the XML syntax that is used in the world file. What you could do is set one up using the GUI user-interface, and then copy it to the clipboard. This would give you the format. Then use that function to create additional ones whenever you want.
Another approach is to use SetTriggerOption - this lets you change trigger configurations for the things that are not directly supported by AddTrigger.
Youll probably going to end up using the SetTriggerOption, because it sounds like youre using a script to make a trigger, or change the match color, or whatnot.
Via scripting, the XML thing would require a lot of work you dont need.
A lot of work? Just a single call, to set up the trigger exactly how you want it. Otherwise you have to add it, and then maybe do three or four SetTriggerOption calls to get it exactly right.
In the debug build of MUSHclient, which is typically about 5 times as slow as the release build, I got this figure importing a fairly complex trigger:
Time taken: ImportXML = 0.000726 seconds.
That is less than 1/1000 th. of a second to import a trigger via ImportXML.
Hang on a tic, I'll check the release build ...
Time taken: ImportXML = 0.000189 seconds.
Yep, about 4 times as fast. So, you could import over 5,000 triggers using ImportXML in under a second. Since I am assuming he will want to do a couple every now and then, I don't think the overhead is a big worry.
Plus, as I said, to do an AddTrigger, followed by four or five SetTriggerOption calls, will probably take as long, due to the overhead of setting up scripting calls inside COM.