Skip to content

Commit e81001f

Browse files
authored
Merge pull request #3648 from Goober5000/ai_ignore_documentation
add some SEXP documentation
2 parents 945427a + 9d1c930 commit e81001f

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

code/parse/sexp.cpp

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@
115115
#undef MessageBox
116116
#endif
117117

118-
119-
120-
#define TRUE 1
121-
#define FALSE 0
118+
// these are useful for embedding numbers in SEXP help strings
119+
// see https://stackoverflow.com/questions/5459868/concatenate-int-to-string-using-c-preprocessor
120+
#define STR_HELPER(x) #x
121+
#define STR(x) STR_HELPER(x)
122122

123123

124124
SCP_vector<sexp_oper> Operators = {
@@ -2825,7 +2825,7 @@ int check_sexp_syntax(int node, int return_type, int recursive, int *bad_node, i
28252825
if (*CTEXT(node) != '#') { // not a manual source?
28262826
if ( stricmp(CTEXT(node), "<any wingman>") != 0)
28272827
if ( stricmp(CTEXT(node), "<none>") != 0 ) // not a special token?
2828-
if ((ship_name_lookup(CTEXT(node), TRUE) < 0) && (wing_name_lookup(CTEXT(node), 1) < 0)) // is it in the mission?
2828+
if ((ship_name_lookup(CTEXT(node), 1) < 0) && (wing_name_lookup(CTEXT(node), 1) < 0)) // is it in the mission?
28292829
if (Fred_running || !mission_check_ship_yet_to_arrive(CTEXT(node)))
28302830
return SEXP_CHECK_INVALID_MSG_SOURCE;
28312831
}
@@ -33154,19 +33154,23 @@ SCP_vector<sexp_help_struct> Sexp_help = {
3315433154
"\t1:\tGoal priority (number between 0 and 89)." },
3315533155

3315633156
{ OP_AI_IGNORE, "Ai-ignore (Ship goal)\r\n"
33157-
"\tTells all ships to ignore the given ship and not consider it as a valid "
33158-
"target to attack.\r\n\r\n"
33157+
"\tTells the specified ship to ignore the given target and not consider it when picking something "
33158+
"to attack, but ALSO sets the protect-ship flag on the target so that NO ship can attack it. Only 1 target "
33159+
"can be ignored at a time, and the protect-ship flag will remain set on the target unless some other sexp "
33160+
"explicitly removes it or instructs a ship to attack the target. In most cases mission designers will want to use "
33161+
"ai-ignore-new instead.\r\n\r\n"
3315933162
"Takes 2 arguments...\r\n"
33160-
"\t1:\tName of ship to ignore.\r\n"
33161-
"\t2:\tGoal priority (number between 0 and 89)." },
33163+
"\t1:\tName of target to ignore.\r\n"
33164+
"\t2:\tGoal priority (number between 0 and 89) - note, this does not imply any ranking of ignored targets." },
3316233165

3316333166
// Goober5000
3316433167
{ OP_AI_IGNORE_NEW, "Ai-ignore-new (Ship goal)\r\n"
33165-
"\tTells the specified ship to ignore the given ship and not consider it as a valid "
33166-
"target to attack.\r\n\r\n"
33168+
"\tTells the specified ship to ignore the given target and not consider it when picking something "
33169+
"to attack. Up to " STR(MAX_IGNORE_NEW_OBJECTS) " targets can be ignored at a time. Targets ignored by "
33170+
"any given ship do not affect targets ignored by any other ship.\r\n\r\n"
3316733171
"Takes 2 arguments...\r\n"
33168-
"\t1:\tName of ship to ignore.\r\n"
33169-
"\t2:\tGoal priority (number between 0 and 89)." },
33172+
"\t1:\tName of target to ignore.\r\n"
33173+
"\t2:\tGoal priority (number between 0 and 89) - note, this does not imply any ranking of ignored targets." },
3317033174

3317133175
{ OP_AI_STAY_STILL, "Ai-stay still (Ship goal)\r\n"
3317233176
"\tCauses the specified ship to stay still. The ship will do nothing until attacked at "
@@ -33178,8 +33182,9 @@ SCP_vector<sexp_help_struct> Sexp_help = {
3317833182
{ OP_AI_PLAY_DEAD, "Ai-play-dead (Ship goal)\r\n"
3317933183
"\tCauses the specified ship to pretend that it is dead and not do anything. This "
3318033184
"expression should be used to indicate that a ship has no pilot and cannot respond "
33181-
"to any enemy threats. A ship playing dead will not respond to any attack. This "
33182-
"should really be named ai-is-dead\r\n\r\n"
33185+
"to any enemy threats. A ship playing dead will not respond to any attack.\r\n\r\n"
33186+
"Do note that the ship's goal list is cleared, which means that if it receives any other goal in any way, "
33187+
"it will immediately come back to life. Use ai-play-dead-persistent to prevent this from happening.\r\n\r\n"
3318333188
"Takes 1 argument...\r\n"
3318433189
"\t1:\tGoal priority (number between 0 and 89)." },
3318533190

0 commit comments

Comments
 (0)