I corrected the mistake after I pasted the chunk here.
It still didn't work.
Well, this is annoying, but... I went back to how TOS used this method in Bloodsport and Sacrifice, so I simplified the whole thing into two functions. So now I don't need to save any trigger in a string or increment anything.
void addXS(string code=""){
rmAddTriggerEffect("Send Chat");
rmSetTriggerEffectParam("Message", "*/"+code+"/*", false);
}
void xsInject() {
rmCreateTrigger("Globals start");
rmSwitchToTrigger(rmTriggerID("Globals start"));
rmSetTriggerActive(false);
rmAddTriggerEffect("Send Chat");
rmSetTriggerEffectParam("Message", "\"); }} /*", false);
addXS("trRevealEntireMap();");
rmAddTriggerEffect("Send Chat");
rmSetTriggerEffectParam("Message", "*/ rule globals_end minInterval 4 inactive { if (1==1) { trChatSend(0, \"", false);
}
void main(void) {
xsInject();
}
Nothing controversial here. But again, this doesn't accomplish anything.
So, I tried to make the trigger active or to fire it, in any way possible, either inside the second function or outside, in the main function. Neither was considered legit by the interpreter. It rejects the line commented out here:
rmCreateTrigger("Globals run");
rmAddTriggerEffect("Activate Trigger");
// rmSetTriggerEffectParam("EventID", rmTriggerID("Globals start"));[In the meanwhile I noticed there was another mistake here: I forgot to switch to this new trigger which was created to activate the first, not just fire it.]But I noticed TOS never activated his "global start" trigger, within which he called the xs function to inject code. It seems to me this is not the problem.
Maybe this whole "global start" trigger was made only to create a method to hack into the game environment and make the interpreter listen to all types of XS commands in a map script (not just the usual rm- and xs- functions, but also tr/kb functions). So this "global start" trigger was never meant to be active or fired or run as such, but only the code that was inserted after the send-chat "opened the gate" and tricked the interpreter into getting tr/kb commands directly from within the RMS.
If you look into TOS's maps he never activates this trigger he created to open the possibility of injecting XS code. The trigger itself doesn't do anything besides sending a send-chat to trick the interpreter. The stuff which needs to be active and run is the actual code inserted in the send-chats, right?