Anonymous

Changes

From Final Fantasy Inside

FF7/Field/Script/Opcodes/14 IFUB

730 bytes added, 00:54, 18 August 2006
m
If/Else Example
==== If/Else Example ====
In this example, if the value found is greater than 0x30, the script halts for a shorter period of time; otherwise, the script halts for a long period of time. Note how the jump forward placed before the longer WAIT ensures that on completion of the 'if' block, execution of the 'else' block is avoided. It jumps forward to just before the 0x200 WAIT, which it then executes, and returns. The 'else' block only executes if it is jumped into by the final argument of the IFUB argument list (thus avoiding the execution of the 'if' block). Once the 'else' block is executed, script execution just continues and the 0x200 WAIT and RET is executed. Since this is also executed by the 'if' block having jumped forward to skip the else block, this demonstrates that the two code paths converge. In C++ (below) this is the equivalent of the if/else block being completed.
<pre>
JMPF (04)
WAIT (00,04)
WAIT (00,02)
RET ()
</pre>
}
WAIT(200);
return;
</cpp>