Outils pour utilisateurs

Outils du site


en:conditions

Conditions

You have seen in create-script how to create rooms that can be accessed with your current room, and in objects how to create objects. Now it's time to talk about conditions.

The conditions allow you to make a room accessible only if you have the necessary object(s). We specify the condition and the texts which accompany it, following the number of room which we want to make accessible, by using the separator “|

The syntax is as follows:

room_number|object1 object2 object3|phrase if we don't have the object|phrase if we have the object (and we therefore access this room)

As you can see, you can specify as many objects you want. If you want to forbid access if you have an object, you must use “-” before the object (for example “-object”)

Let's take an example of a room, from which we can access unconditionally to room 4, but for room 2 we will need to own the lamp to access it, and for room 3 we must NOT have the lamp in our inventory :

2|-lamp|it's too dark to enter without a lamp!|You enter the living room by lighting yourself with your lamp
3|-lamp|This room contains light sensitive paintings, please do not enter with a lamp!|You enter the painting gallery.
4

In the advanced features of the bot, you will see other possibilities (using the value of a variable, etc.) and other uses of conditions (for an automatic event for example).

AND/OR conditions

By default, conditions (by required objects, conditions or variable) are cumulative. If you put 2 objects, you will need to have both objects to respect the condition (like the keys in the example).
If you want a room to be accessible with an object OR another object, you can put 2 times the box of the room, each line having a different condition. The bot will try the first, then the second, etc.
Finally, if none of the conditions are met, the bot will display the text corresponding to the last line tested.

In the following example, we see that room 2 is now accessible with either a lamp or a torch:

2|lamp|it's too dark to enter without a lamp or torch!|You enter the living room by lighting yourself with your lamp
2|torch|it's too dark to enter without a lamp or torch!|You enter the living room by lighting yourself with your torch
3
4

The text that will be displayed will therefore be different depending on the object you have.

Find us on the discord Make&Play

Discussion

Entrer votre commentaire. La syntaxe wiki est autorisée:
 
en/conditions.txt · Dernière modification: 2021/04/19 22:51 de cyrilfiesta