Difference between revisions of "MODVar"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(2 intermediate revisions by one other user not shown)
Line 5: Line 5:
  
  
See Also: [[Event_Instruction_B0|{B0} {{IE_B0}}]] ― [[Event_Instruction_B2|{B2} {{IE_B2}}]] ― [[Event_Instruction_B4|{B4} {{IE_B4}}]] ― [[Event_Instruction_B6|{B6} {{IE_B6}}]] ― [[Event_Instruction_B8|{B8} {{IE_B8}}]] ― [[Event_Instruction_BA|{BA} {{IE_BA}}]] ― [[Event_Instruction_BC|{BC} {{IE_BC}}]] ― [[Event_Instruction_BE|{BE} {{IE_BE}}]]
+
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 [[Event_Instruction_BF|{{IE_BF}}]] to essentially generate a random number along a specific range - from 0 to one number less than VAR2's Value.
 +
 +
 +
See also: [[Event_Instruction_B6|{B6} {{IE_B6}}]] ― [[Event_Instruction_B7|{B7} {{IE_B7}}]] ― [[Event_Instruction_BE|{BE} {{IE_BE}}]]
 +
 +
 +
== Variable 1 : Half-Word (hex) ==
 
{{Variables}}
 
{{Variables}}
  
  
{{Immediate}}
+
== Variable 2 : Half-Word (hex) ==
 +
{{Variables}}

Revision as of 04:30, 23 April 2019

{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