heh, Heimdal's making a trigger programming language. Oh well, if only someone told me that four weeks ago before I started writing so much code... Heimdal, how far are you with making your programming language? For me, I was just going to add the trigger conditions to the language today, and then make it convert the triggers to a CHK file, then I'd be done. I'm not doing the variables thing, because I want to get a stable finished version done first, then I'll mess around and add extra features.
I have actually been making this for myself so I can make large quantities of complicated triggers faster for a particular map that I was trying to make. I guess if everyone finds it useless I should just keep it within the Starchitects or something. I thought that'd be most people's reaction though, I mean, I saw Bolt's reaction to Garrec's trigger program, and this program is much harder.
Bolt_Head, I've got an if statement already programmed, but I don't know if I'm that happy with it at the moment, so I might look into different ways of setting it up. The problem happens when you have an if on one player, and the else on another. In that case, can you guarantee that the triggers will hit the if trigger before the else trigger? Because the else statement, as you know, works basically like an "always" condition.
What I'm thinking is, let the programmer decide, or maybe even scrap the "else" clause and just let you do your own "elseif(true)" command yourself.
I'm using a death counter to mark the current stage that the map is at, that's the meaning of the process statement at the top of that code in my first post, but it has the same purpose as your switch there. The values of the death counter is automatically managed by the trigger programming language compiler, so if you go:
CODE
process |player["1"],player["2"],player["3"],player["4"]| (unit["Independent Command Center"], player["currentPlayer"]) {
always{
#enumerate($locationName = {chooseRed,chooseGreen,chooseBlue})
createUnit(1, "Terran Beacon", location["$locationName"];
#endenumerate
setPreserveState(false);
}
#enumerate($locationName = {chooseRed,chooseGreen,chooseBlue}, $colourName = {red,green,blue})
if(player["currentPlayer"].bring(unit["Terran Civilian"], location["$locationName"]) >= 1) {
removeUnit(1, unit["Terran Civilian"], player["currentPlayer"], location["$locationName"]);
displayText("You have chosen the $colourName beacon!", true);
player["currentPlayer"].score["custom"] += 10;
}
#endEnumerate
elseif(player["currentPlayer"].command(unit["Terran Civilian"]) == 0) {
displayText("Your civilian has died!", true);
jump doDefeat;
}
stop;
doDefeat:
always{
defeat();
}
}
You could make the compiler generate the same triggers by doing this:
CODE
if(player["currentPlayer"].deaths["Independent Command Center"] == 0) {
#enumerate($locationName = {chooseRed,chooseGreen,chooseBlue})
createUnit(1, "Terran Beacon", location["$locationName"];
#endenumerate
setPreserveState(false);
player["currentPlayer"].deaths["Independent Command Center"] += 1;
}
#enumerate($locationName = {chooseRed,chooseGreen,chooseBlue}, $colourName = {red,green,blue})
if(player["currentPlayer"].deaths["Independent Command Center"] == 1
&& player["currentPlayer"].bring(unit["Terran Civilian"], location["$locationName"]) >= 1) {
removeUnit(1, unit["Terran Civilian"], player["currentPlayer"], location["$locationName"]);
displayText("You have chosen the $colourName beacon!", true);
player["currentPlayer"].score["custom"] += 10;
player["currentPlayer"].deaths["Independent Command Center"] += 1;
}
#endEnumerate
elseif(player["currentPlayer"].deaths["Independent Command Center"] == 1
&& player["currentPlayer"].command(unit["Terran Civilian"]) == 0) {
displayText("Your civilian has died!", true);
player["currentPlayer"].deaths["Independent Command Center"] = 3;
}
// no command for player["currentPlayer"].deaths["Independent Command Center"] == 2
if(player["currentPlayer"].deaths["Independent Command Center"] == 3) {
defeat();
player["currentPlayer"].deaths["Independent Command Center"] += 1;
}
Okay, now I think I'm ranting, and I'm just accentuating to triggersters that the programming language will be really hard for non-programmers. (I bet you're all looking at that and going "What?") But anyway, now that I hear Heimdal's making a bigger and better version of the same thing I guess it might never be used.
Edit: Another thing I could use your input on. How should I do those #enumerate commands? What they do is, if you give them a list, they substitute the $variables in your code with the items in the list. The question in my mind is, do you want it done like this:
CODE
#enumerate($listA = {programmer,webmaster,modder}, $listB = {heimdal,yoshi,stealthydeath})
Or do you want it like this:
CODE
#enumerate(($listA, $listB) = {programmer=>heimdal,webmaster=>yoshi,modder=>stealthydeath})