Talk:FF7/Field/Script/Opcodes/14 IFUB
< Talk:FF7
Jump to navigation
Jump to search
I had split the first byte arg into two nybbles as per halkun's document. However, the second nybble of the first argument is not always zero. Example: itown1a, timer, script 1; note the second if statement after label j0:
<cpp>
init: return
base:
j1: if(<50>[A] == 1) { GETAI(6,E,D)
j0: if(<50>[11] < 50) { GETAI(6,E,F) if(<66>[D] == F) { INC(5,11) jump(j0) } SETBYTE(50,11,0) } else { SETBYTE(50,A,0) BITOFF(F0,B1,2) SETBYTE(50,11,0) SETBYTE(50,C,1) REQ(E,65) } } jump(j1) return
</cpp>
SB 20:58, 6 Sep 2006 (CDT)
That's odd. It might be a destination bank/source bank pair. (Like the maths use) That makes sense as both values being compaired are in the same bank (6 and 6). In that case, the value being compaired is most likely the source bank address. (i.e. not explicit)
--Halkun 22:03, 6 Sep 2006 (CDT)
- Looks about right actually. The GET opcode will be getting (whatever AI is) into bank 6, address D, then again into bank 6, address F (this odd ordering of args follows the GETPC argument list). So to compare the two, if the second nybble is non-zero, we're comparing values at the two address found around the comparison type, rather than a value at an address compared with an explicit value. I've seen another comparing two in bank 5 but I think we can assume it's valid to do this in non-temporary memory banks as well? Can write a script in Meteor and test it in-game to check. SB 22:33, 6 Sep 2006 (CDT)
- Give yourself a cookie. ;) Tested the following dialogs & script:
Dialog 0: Wutai 1: Same. 2: Different. ...
<cpp> main:
CreateWindow(0,10,10,50,50) SETBYTE(10,5,FE) SETBYTE(30,6,FE) if(<13>[5] == 6) { Dialog(0,1) } else { Dialog(0,2) } return
</cpp>
- This produces a window with "Same."; changing either SETBYTEs to a different address produces "Different.". So the IF variants can compare addresses directly, just as the maths codes. I'll update the entries later, unless you get there first. :) SB 22:48, 6 Sep 2006 (CDT)