Outils pour utilisateurs

Outils du site


en:custom-actions

Using custom actions:

You can define custom actions, giving access to commands in the name of the action.
These actions are defined either in a room (local action, only possible in this room) at the same place as the directions and events 997 (thus after the text of the room), or at the end of the scenario (at the same place as the onlines variables, the aliases, …)

The syntax: “ action:target|condition(s)|effect|phrase if condition ok|phrase if condition not ok

The player will then have to use the command “ j!action cible ”. For example “break:door”, the bot will respond to the command “j!break door”.
If the action/command written by the player does not exist, the bot will indicate it. The same applies if the target is incorrect.

It is possible to put “all” as the target. In this case, the command will perform the action, whatever the target typed by the player.
The variable action_target (or t_action_target_t depending on the location of the scenario) will contain the last target typed by the player (valid or not), and the variable action_target_ok will contain the last valid target typed by the player.
It is then possible, with “ all ” and these 2 variables, to create a multitude of actions while leaving a great freedom to the player.

Last thing: it is possible to specify the same action:target several times. In this case, the first one whose conditions are respected will be executed. If none of these conditions are met, the refusal text of the last one will be displayed. Similarly, local actions are tested before global actions.

The scenario “ example_actions.txt” shows you concrete examples of use!

Find us on the discord Make&Play