Okay, here's an idea I'd been toying with the idea of writing for a while. It's called the Event Log and basically it allows you to flag certain events and write to a log whether they are working or not working. Those of us who FRED will all have been in this situation, we have an event like this
Do something cool
When
-and
--Condition A
--Condition B
--Condition C
which isn't working when we think it should. But what is going wrong? Which of the conditions isn't working? Well this is the beauty of the event log. By adding some flags to your mission file (manually for now, but FRED will support them in the future) you can tell FS2_Open to keep an eye on this event and write out what is going on with it. The result is a log that looks something like this
09/25 18:41:20~ FS2_Open Mission Log - Opened
Mission Rebels & Renegades loaded.
09/25 18:41:48~ Hinton Run
is-destroyed-delay returned value CAN'T EVALUATE
distance returned value 1214
< returned value TRUE
and returned value FALSE
when returned value FALSE
As you can see the log shows me that the event Hinton Run isn't triggering because although the distance is close enough, the is-destroyed-delay SEXP can't evaluate (in this case because the ship in question hasn't jumped in yet). The events.log file is written to the data folder of the mod you are running, NOT the main Data folder! This cause it is basically code I altered from the multi.log and not the fs2_Open log. As an aside I made the code for multi.log generic. That means if other coders want to create a log for something, it shouldn't take more than a few minutes now.
Okay, so now you can see what to do with it, how do you set it up? Well first you'll need
these builds. Then you'll need to alter the mission file for the event in question.
$Formula: ( when
( and
( is-destroyed-delay 0 "GVC Yaaru" )
( <
( distance "NTF Iceni" "NTSC Hinton" )
2000
)
)
( add-goal
"NTSC Hinton"
( ai-waypoints-once
"Waypoint path 1"
89
)
)
)
+Name: Hinton Run
+Repeat Count: 1
+Interval: 1
+Event Log Flags: ( "True" "False" )
The last line is the new one. At the moment only two flags are supported, corresponding to the event evaluating to true or false. I intend to add other flags that will be triggered on the 1st repetition of an event, or immediately after the first triggering. I suspect the handling of arguments and variables could also use improving.
Anyway, give me some feedback on which event properties you'd like me to expose in the log and I'll see what I can do. Remember that this only works at the event level, but I might see what I can do to have it also trigger on SEXP errors (trying to do things to ships which aren't there, etc).