Scripting Technique - Commenting Script Blocks

Using Igor to script missions is a lot like writing a program. With a program, the computer is told what to do and how to respond to user input. When you script a mission, you tell Ghost Recon what to do and how to respond to players. It can get confusing when scripting a mission and comments help organize script blocks into a readable flow of commands. Comments also help describe what is happening inside a script block or what the block is supposed to respond to.

A technique I picked up from the Island Thunder missions is numbering my script blocks. In the block's comment, I first put a number corresponding to the logical flow of script execution. I may also put a letter after the number if I've added a block later and want it ordered in between two blocks. The advantage of numbering your blocks is you can sort the comments so that the blocks are listed in a logical order. This will help a lot down the road when you have to edit something in your mission several months later, or, even more importantly, when somebody else is looking at your mission.

Here's what the script blocks in one of my missions look like when it isn't numbered:

Code:
Startup           Initialize mission vars
Startup           Set hostage zone and teleport hostage
ProximityActor    Hostage rescue complete
EscortInitiated   Show intel objective location
ProximityPlatoon  Extraction complete
DeathActor        Team member died
TimerExpired      Evaluate mission completion
DeathActor        Hostage died
ProximityPlatoon  Intel gathered
ProximityPlatoon  Intel retrieved from body
DeathActor        Allow pickup of intel from dead body
ProximityActor    Intel taken to extraction
Call              Mission failed
Call              Show hostage zone
Call              Show intel location on map
DeathActor        Hostage died, check for intel zone revelation
Call              Mission win
That's a mess!

Here are the comment blocks when they are numbered:

Code:
Startup           01: Initialize mission vars
Startup           02: Set hostage zone and teleport hostage
ProximityActor    03b: Hostage rescue complete
EscortInitiated   03: Show intel objective location
ProximityPlatoon  05: Extraction complete
DeathActor        OBJ FAIL: Team member died
TimerExpired      06: Evaluate mission completion
DeathActor        OBJ FAIL: Hostage died
ProximityPlatoon  04: Intel gathered
ProximityPlatoon  04a: Intel retrieved from body
DeathActor        04a: Allow pickup of intel from dead body
ProximityActor    04a: Intel taken to extraction
Call              06a: Mission failed
Call              02a: Show hostage zone
Call              03a: Show intel location on map
DeathActor        OBJ FAIL: Hostage died, check for intel zone revelation
Call              06a: Mission win
It's a little easier to read and sort out what to look for when editing the script.

Here are the sorted comment blocks:

Code:
Startup           01: Initialize mission vars
Startup           02: Set hostage zone and teleport hostage
Call              02a: Show hostage zone
EscortInitiated   03: Show intel objective location
Call              03a: Show intel location on map
ProximityActor    03b: Hostage rescue complete
ProximityPlatoon  04: Intel gathered
ProximityPlatoon  04a: Intel retrieved from body
DeathActor        04a: Allow pickup of intel from dead body
ProximityActor    04a: Intel taken to extraction
ProximityPlatoon  05: Extraction complete
TimerExpired      06: Evaluate mission completion
Call              06a: Mission failed
Call              06a: Mission win
DeathActor        OBJ FAIL: Hostage died
DeathActor        OBJ FAIL: Hostage died, check for intel zone revelation
DeathActor        OBJ FAIL: Team member died
Now it's easier to see how the mission flows. If you're anything like me, I like looking at my script in a linear way and this commenting technique will organize your blocks linearly. You can also sort blocks according to group name or trigger event. I use them from time to time to get a different look at the mission flow.