Events
Like the rooms “998” and “999”, the room “997” is put in the line of accessible boxes. It represents an event: an action triggered by the bot or by the player (via a reaction for example, you'll see that in Use of reactions), and which, if the conditions are met, produce an effect on the game. It can be used to automatically go to another room, change the value of a variable, add or remove an object or state, or display text. Let's take the previous example and make it automatically go to room 1 or 3 depending on the result:
<html> <div style=“background:#dddddd”> […]<br /> *<br /> 2 First_Toss<br /> You roll a 6 die. If you roll 5 or 6, you will be taken to the next room.<br /> des_six|variable|%=1:6|You roll v_result_v|A 6-sided die.|nb_tries_six|variable|+1|You have made v_nb_tries_six_v roll.|Number of D6 rolls.<br /> <span style=“color:#FF0000”>997</span>|<span style=“color:#0000FF”>v_des_six_v.in.1-4</span>|<span style=“color:#FFA000”>1</span>|<span style=“color:#30B000”>You're out of shape, start again!</span><br /> 997|v_of_six_v.in.5-6|3|Congratulations, you have succeeded after v_nb_tries_six_v attempts!<br /> *<br /> […] </div> </html>
Notice that I have added a second variable (“v_nb_tries_six_v”) that counts the number of tries before success. Now let's look at this in detail:
- <html><span style=“color:#FF0000”>997 is the room indicating an automatic action</span></html>
- <html><span style=“color:#0000FF”>Condition(s) for the action to occur.</span></html> We saw earlier how to present it, for example “v_life_v.>.0”. It can also take the value “null” (= no condition, the action will necessarily take place), or use objects or states as a condition (or both.) This part works the same way as the other conditions.
- <html><span style=“color:#FFA000”>Action(s) performed:</span></html> You can put more than one in the same 997, separating them with “@@”.
- Modification of a variable: (with +, =, -, %=X:Y,%+X:Y, or%-X:Y)
- Change of room (we put the room number or v_variable_v (the room number will be the value of this variable))
- Add or remove an object/status from the inventory: [object name]&&[inventory or invisible]&&[description of object or state]. As for other objects or states, it can be preceded by “-” to remove it
- For example: “screwdriver&&inventory&&The screwdriver is used to screw in or out.”
- Another example: “-You are not tired anymore!”
- Declaration or modification of a numeric or textual variable (online or not): [variable name]&&[variable or variable_t]&&[variable value]&&[variable description]
- <html><span style=“color:#30B000”>Sentence to display.</span></html> You can display nothing (you put “null”), and you can display in the sentence the value of a variable by surrounding it with “v_” and “_v” (if numeric variable) or “t_” and “_t” (if textual variable)
Interactive YAML Events
In YAML scripts, an event can also be triggered from an element inside the text:
idtriggers an event on click, see Clickable elements.labeldisplays a tooltip and can trigger an event, see Interactive tooltips.
The fields if:, visible-if:, disabled-if:, do:, to:, text: and once: apply to these events like they do to other events.
A local event can be enabled or disabled by an action:
events: - id: disable_statue do: "event:statue_seen:OFF" text: "The statue stops reacting."
Available values are ON, OFF and SWITCH.
Find us on the discord Make&Play
