added update regarding custom actions to README.md

This commit is contained in:
Sokomine 2022-08-07 22:06:26 +02:00
parent 48e5af991c
commit 5da08359cb

View File

@ -20,7 +20,7 @@ Chat commands
grants NPC n_3 the right to execute grants NPC n_3 the right to execute
lua code as an effect/result lua code as an effect/result
Note: If a precondition or effect originates from a generic Note: If a precondition or effect originates from a generic
NPC, the priv will be considered granted if the NPC, the priv will be considered granted if either the
executing NPC or the the generic NPC has the priv. executing NPC or the the generic NPC has the priv.
/npc_talk_generic Add or remove NPC from the list of generic dialog providers. /npc_talk_generic Add or remove NPC from the list of generic dialog providers.
@ -47,7 +47,10 @@ action An action the player may (or may not) take, i.e. trading,
effect/result Further effects (like setting variables, handing out items) effect/result Further effects (like setting variables, handing out items)
that take place after the action was successful. that take place after the action was successful.
alternate text Text shown instead of the normal dialog text. alternate text Text shown instead of the normal dialog text. This is useful
when you have a dialog with a lot of questions and want the
player to be able to easily select the next question without
having to create a new dialog for each option.
Special dialogs Special dialogs
=============== ===============
@ -236,21 +239,17 @@ when you set up this action.
Custom Preconditions, Actions and Effects Custom Preconditions, Actions and Effects
========================================= =========================================
You can define custom actions and provide a parameter. The function You can define custom actions and provide up to ten parameters. The file
yl_speak_up.get_fs_action_custom(player, param) custom_functions_you_can_override.lua
gets called when such a function is executed and ought to return a formspec. holds examplexs. Please do not edit that file directly. Just take a look
Input ought to be sent to the function there and override functions as needed in your own files! That way it is
yl_speak_up.input_fs_action_custom(player, formname, fields) much easier to update.
which acts as an example of what you need to take care of in your own
implementation of this function.
You can also define custom preconditions and effects. For more information, In general, the table
take a look at yl_speak_up.custom_functions_p_[ descriptive_name ]
custrom_functions_you_can_override.lua holds information about the parameters for display in the formspec (when
In order to add custom functions, you need to be able to edit that file or setting up a precondition, action or effect) and contains the function
execute Lua code on the server. that shall be executed.
NPC may need extra privs for some actions.
Alternate Text Alternate Text
============== ==============