====== 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 [[reactions|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:
[...]
*********************
2 First_Toss
You roll a 6 die. If you roll 5 or 6, you will be taken to the next room.
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.
997|v_des_six_v.in.1-4|1|You're out of shape, start again!
997|v_of_six_v.in.5-6|3|Congratulations, you have succeeded after v_nb_tries_six_v attempts!
*********************
[...]
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: * 997 is the room indicating an automatic action * Condition(s) for the action to occur. 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. * Action(s) performed: 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]** * Sentence to display. 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) **Find us on the [[https://discord.gg/Z63DtVV|discord Make&Play]]**