Modified code with comments. I don’t know whether it does anything useful, but the syntax at least makes sense.
Code: Select all
"IDENTIFY_HOSTILES" =
{
ENTER =
(
fightOrFleeHostiles, // Lose the closing paren
"scanForNearestShipWithRole: slaver",
{ // Conditions are a dictionary, they need braces
conditions = ("shipsFound_number greaterthan 0"); // Semicolon, not comma, because we're in a dictionary. Also, quotation marks must surround the whole statement, not just the variable.
do =
(
setTargetToFoundTarget, "commsMessage: [maegil-mark]",
"setStateTo: ATTACK_SLAVER"
);
else =
(
scanForHostiles,
setTargetToPrimaryAggressor,
{ // Conditions still need braces
conditions = ("shipsFound_role equal police"); // Semicolon, not comma, because we're in a dictionary. Also, quotation marks must surround the whole statement, not just the variable.
do = ("commsMessage: [maegil-police]");
else =
(
{ // And again
conditions = ("shipsFound_role equal pirate"); // Quotation marks must surround the whole statement, not just the variable.
do = ("commsMessage: [maegil-pirate]");
else = ("commsMessage: [maegil-threat]");
}
); // Closing bracket was missing
},
"setStateTo: ATTACK_SHIP" // Not sure if this is in the right place
);
}
);
EXIT = ();
UPDATE = ("scanForNearestShipWithRole: slaver, pirate", "pauseAI: 1.0");
};
There were a number of systematic
property list syntax errors. To create working scripts, you need to understand the property list structure.
Your conditions were not in dictionaries. Key-value pairs (
foo = bar) only make sense in dictionaries, i.e. surrounded by {} pairs.
Several of your conditions took the form
"method" operator value instead of
"method operator value. A condition is a string; it must be surrounded by quotation marks.
The trailing paren after
fightOrFleeHostiles near the top makes no sense.
I reccomend finding and learning to use a programmer’s text editor. The single most important function of such an editor is to maintain consistent indentation, i.e. the number of tabs at the beginning of each line. This helps line up the opening and closing parens/brackets as I’ve done above. This makes it much, much easier to keep the structure “balanced” and properly nested, and to understand the structure.