This primitive starts, modifies or deletes a timer. Timers permit actions to occur in the future or at a regular interval.
There is no SimPe wizard for this instruction, so the following table details the meaning of each of the operands.
Operand | Description | Operand Values |
---|---|---|
0 & 1 | Tick Count duration of timer (if op5 bit4 is 0) | |
2 | Event Tree Scope | 0x00: Private 0x01: Semi-Global 0x02: GlobalNote: SimPE doesn't use this operand at all and reports op14 as the Event Tree Scope, but I believe that's a mistake - see below. |
3 & 4 | Event Tree instance to call when timer expires | |
5 - bit 1 | Controls what Parameters are passed to the Event Tree | Off: Pass the variables in operands 6, 9 and 12 On: Pass the callers parameters |
5 - bit 2 | Controls Looping | Off: Timer triggers once after Tick Count ticks On: Timer triggers every Tick Count ticks |
5 - bit 3 | Reset flag | Only used if action (op15) is modify (0x01), presumably determines if the timer's current tick count is reset to 0 or left at its current value |
5 - bit 4 | Controls where the Tick Count is taken from | Off: Use value in Ops 0 & 1 On: Use value in Temp 1 |
6 | Variable to pass as the first parameter (P0) to the Event Tree (if op5 bit1 is 0) | |
7 & 8 | Qualifiers on the variable in operand 6 | |
9 | Variable to pass as the second parameter (P1) to the Event Tree (if op5 bit1 is 0) | |
10 & 11 | Qualifiers on the variable in operand 9 | |
12 | Variable to pass as the third parameter (P2) to the Event Tree (if op5 bit1 is 0) | |
13 & 14 | Qualifiers on the variable in operand 12 | |
14 | SimPE reports this as the Event Tree Scope operand, but also uses it as part of the qualifier for operand 12. From checking several BHAVs that use the On Timer primitive, I believe that operand 2 is the Event Tree Scope. | |
15 | Action | 0x00: Start 0x01: Modify 0x02: Delete (no other operands are used) |
// Decompiled with JetBrains decompiler // Type: pjse.BhavNameWizards.WizPrim0x007a // Assembly: pjse.coder.plugin, Version=4.0.3349.37576, Culture=neutral, PublicKeyToken=null using SimPe; using SimPe.PackedFiles.Wrapper; using System; namespace pjse.BhavNameWizards { public class WizPrim0x007a : BhavWizPrim { public WizPrim0x007a(Instruction i) : base(i) { } protected override string Operands(bool lng) { byte[] numArray = new byte[16]; ((byte[]) this.instruction.Operands).CopyTo((Array) numArray, 0); ((byte[]) this.instruction.Reserved1).CopyTo((Array) numArray, 8); string str1 = ""; string str2; switch (numArray[15]) { case 0: str2 = str1 + pjse.Localization.GetString("bwp7a_start"); break; case 1: str2 = str1 + pjse.Localization.GetString("bwp7a_modify"); break; case 2: str2 = str1 + pjse.Localization.GetString("bwp7a_delete"); break; default: str2 = str1 + pjse.Localization.GetString("unk") + ": 0x" + Helper.HexString(numArray[15]); break; } if (numArray[15] != (byte) 2) { str2 = str2 + ", " + pjse.Localization.GetString("bwp_ticks") + ": " + (((int) numArray[5] & 8) != 0 ? this.dataOwner((byte) 8, (ushort) 1) : "0x" + Helper.HexString(BhavWiz.ToShort(numArray[0], numArray[1]))); if (lng) { bool found = false; string str3 = str2 + ", " + pjse.Localization.GetString("bwp_eventTree") + ": " + this.bhavName((uint) BhavWiz.ToShort(numArray[3], numArray[4]), ref found); Scope scope = Scope.Global; if (numArray[14] == (byte) 0) scope = Scope.Private; else if (numArray[14] == (byte) 1) scope = Scope.SemiGlobal; string str4 = str3 + " (" + pjse.Localization.GetString(scope.ToString()) + ")" + ", " + pjse.Localization.GetString("manyArgs") + ": "; if (((int) numArray[5] & 1) != 0) { str4 += pjse.Localization.GetString("bw_callerparams"); } else { for (int index = 0; index < 3; ++index) str4 = str4 + (index == 0 ? "" : ", ") + this.dataOwner(numArray[3 * index + 6], numArray[3 * index + 7], numArray[3 * index + 8]); } str2 = str4 + ", " + pjse.Localization.GetString("bwp7a_looping") + ": " + (((int) numArray[5] & 2) != 0).ToString(); if (numArray[15] == (byte) 1) str2 = str2 + ", " + pjse.Localization.GetString("bwp7a_reset") + ": " + (((int) numArray[5] & 4) != 0).ToString(); } } return str2; } } }