Skip to reading
Progress Bars, Hints & Journals

8. Run actions at a percentage

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page

Percentage Events JSON lets a meter react when its displayed percentage crosses a boundary. A 75% event means three quarters of Maximum, whether Maximum is 4, 100 or 500.

For a first test, create a Boolean variable called test_once with a default of false. Paste this array into Percentage Events JSON in Type Settings:

Code example
[
  {
    "id": "power_ready",
    "percentage": 75,
    "direction": "up",
    "once": true,
    "actions": [
      {"type": "SetVariable", "name": "test_once", "value": true}
    ]
  }
]

1. Begin below 75%, such as power = 0.

2. Set power to 80 or 100. The upward crossing sets test_once to true.

3. Drop below 75 and cross upward again. With once enabled, that event is suppressed for this live bar instance.

The guide’s screenshot fixture also counts ready and low-power crossings and puts the result in ordinary Labels. That makes repeated-event behavior easy to see without repeatedly opening a message box.

Percentage Events is an array of event objects. A single object without the surrounding square brackets is rejected. The field reports JSON syntax errors; correct them before leaving the element.

Page 15 of 53Permalink
Go to page