The scripting command AlterEvent has the opcode (0x18).
- byte - line number
- byte - replacement opcode
Replaces the given line number of the current event with the replacement opcode. If the opcode to be replaced is PlayCD then it also updates the line immediately following it.
00: If 09 00 03 // unconditional jump to line 4 01: Display 02 // display string 2, ie "Now you see this" 02: If 09 2c 01 03 // wait for a key press, then move to line 3 03: Exit // Exit event 04: Display 01 // display string 1, ie "See this first" 05: If 09 2c 01 06 // wait for a key press, then move to line 6 06: AlterEvent 00 00 // make line 0 opcode 0
The first time this event is triggered, the If condition at line 0 will cause the event to skip to line 4, displaying "See this first" to the screen. AlterEvent then changes the If condition to a NOP, so that the second time this event is triggered, it moves on to line 2, displaying "Now you see this".
The check for 0x3C was most likely a quick fix when CD voices was added to the game. Rather than go through every event, and increment the line number to be updated if the line it was replacing was the newly inserted CD event (a time consuming task, easy to get wrong) they simply change both the newly inserted CD event, and the line which immediately follows which would be the correct event to change. This is just a logical guess, and there may be more going on then is apparent.