# MODVar

(Redirected from Event Instruction B9)

Jump to navigation
Jump to search
# {B9} MODVar

**MODVar(xVAR1,xVAR2)**

Divide Immediate | Variable = Variable ÷ ImmediateValue (high 32bit)

Divides Variable 1's Value by Variable 2's Value and gives the *remainder* as the result.

So if VAR1's Value was 0018 and VAR2's Value was 0006, the result (saved to VAR1) would be 0000.

If VAR1's Value was 0019 and VAR2's Value was 0006, the result (saved to VAR1) would be 0001.

Can be used after Random to essentially generate a random number along a specific range - from 0 to one number less than VAR2's Value.

See also: {B6} DIV ― {B7} DIVVar ― {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