ORVar

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search

{BD} ORVar

ORVar(xVAR1,xVAR2)

OR Variable bitwise operand | Variable1 = Variable1 OR Variable2

This command compares the individual bits of the value between a Variable and a specific ImmediateValue, and produces a single binary output.

With OR, the resulting bit outputs are set to 1 (TRUE) if either value's bit input is 1. This makes this a good way to enable a specific bit within a byte without changing the rest of the bits.

The bits available within a single byte are:

  • 0x80
  • 0x40
  • 0x20
  • 0x10
  • 0x08
  • 0x04
  • 0x02
  • 0x01

So, for example, if you want to edit a unit's Battle Stats to add the Control flag (which is bit 0x08), but leave the other flags such as their Team untouched, you would LoadAddress the byte into an editable variable, then OR that variable against a value of 0008: OR(xVARI,x0008). This uses a zero value on every bit except 08, which uses a one value, forcing the output to always have Control flagged, while leaving the rest of the bits from the variable unaltered.


See also: {BC} OR{BE} ZERO


Variable 1 : Half-Word (hex)

Click here for the list of Variables


Variable 2 : Half-Word (hex)

Click here for the list of Variables