further improvement of README.md

This commit is contained in:
Sokomine 2023-09-02 00:55:58 +00:00
parent 31d86bc058
commit 5372cfdec1

113
README.md
View File

@ -122,10 +122,10 @@ special meaning:
### 5. How to configure NPC and add dialogs
<a name="how-to-configure"></a>
Just talk to them and click on the "I am your owner"-Dialog. This opens up
Just talk to them and click on the `"I am your owner"`-Dialog. This opens up
a menu where you can edit most things.
hint: The command `/npc_talk debug <npc_id>` allows you to get debug
Hint: The command `/npc_talk debug <npc_id>` allows you to get debug
information regarding preconditions and effects. You can turn it
off with `/npc_talk debug off`. The NPC ID can be seen in the
setup dialog for preconditions and effects.
@ -134,48 +134,29 @@ hint: The command `/npc_talk debug <npc_id>` allows you to get debug
### 6. The privs
<a name="privs"></a>
`npc_talk_owner` will allow players to edit their *own* NPC by talking to them.
Ought to be given to all players.
`npc_talk_master` allows players to edit *any* NPC supported by this mod.
Ought to be given to selected trusted players who want to
help others with their NPC configuration and/or support
NPCs owned by the server.
| Minetest priv | what this priv grants the player who has it |
| ----------------- | ------------------------------------------- |
| `npc_talk_owner` | will allow players to edit their *own* NPC by talking to them. Ought to be given to all players.|
| `npc_talk_master` | allows players to edit *any* NPC supported by this mod.<br>Ought to be given to selected trusted players who want to help others with their NPC configuration and/or support NPCs owned by the server.|
| `npc_talk_admin` | Generic maintenance of NPC.<br>Allows to use the the command `/npc_talk generic` and add or remove an NPC from the list of generic dialog providers.<br>Also allows to set and change NPC properties starting with the prefix "server".|
| `npc_master` | allows players to edit *any* NPC supported by this mod. *Does* include usage of the staffs (now part of `yl_npc`).<br>This is very powerful and allows to enter and execute lua code without restrictions.<br>Only grant this to staff members you ***really*** trust. The priv is usually not needed.|
| `privs` | Necessary for the commands<br>`/npc_talk privs` - grant NPC privs like e.g. execute lua and <br>`/npc_talk_reload` - reload code of this mod|
`npc_talk_admin` Generic maintenance of NPC. Necessary for the command
`/npc_talk generic` - add or remove an NPC from the list of
generic dialog providers
Also allows to set and change NPC properties starting with
the prefix "server".
`npc_master` allows players to edit *any* NPC supported by this mod.
*Does* include usage of the staffs (now part of `yl_npc`).
This is very powerful and allows to enter and execute lua
code without restrictions.
Only grant this to staff members you really trust.
`privs` Necessary for the commands
`/npc_talk privs` - grant NPC privs like e.g. execute lua
`/npc_talk_reload` - reload code of this mod
NPC can have privs as well. The NPC...
`precon_exec_lua` ..is allowed to excecute lua code as a precondition
`effect_exec_lua` ..is allowed to execute lua code as an effect
`effect_give_item` ..can give items to the player, created out of thin air
`effect_take_item` ..can accept and destroy items given to it by a player
`effect_move_player` ..can move the player to another position
NPC can have privs as well:
| NPC priv | The NPC.. |
| -------------------- | --------- |
| `precon_exec_lua` | ..is allowed to excecute lua code as a precondition|
| `effect_exec_lua` | ..is allowed to execute lua code as an effect|
| `effect_give_item` | ..can give items to the player, created out of thin air|
| `effect_take_item` | ..can accept and destroy items given to it by a player|
| `effect_move_player` | ..can move the player to another position|
### 7. Tools
<a name="tools"></a>
There are no more tools (=staffs) provided. You can do all you could do
with them by just talking to the NPC.
with them by just talking to the NPC. The staffs are deprecated.
### 8. Mute
@ -192,7 +173,7 @@ NPC's owner.
### 9. Skin
<a name="skin"></a>
The skin and what the NPC wields can be changed via the "Edit Skin" button.
The skin and what the NPC wields can be changed via the `"Edit Skin"` button.
### 10. Simple variables
@ -200,16 +181,16 @@ The skin and what the NPC wields can be changed via the "Edit Skin" button.
If you want to let your NPC greet the player by name, you can do so. Some
variables/texts are replaced appropriately in the text the NPC says and
the player can reply:
in the options the player can select from:
`$MY_NAME$` will be replaced by the name of the NPC
`$NPC_NAME$` same as above
`$OWNER_NAME$` will be replaced by the name of the owner of the NPC
`$PLAYER_NAME$` will be replaced by the name of the player talking to the NPC
`$GOOD_DAY$` will be replaced by "Good morning", "Good afternoon" or
"Good evening" - depending on the ingame time of day
`$good_DAY$` same as above, but starts with a lowercase letter (i.e.
"good morning")
| Variable | will be replaced with.. |
| --------------- | ----------------------- |
| `$MY_NAME$` | ..the name of the NPC|
| `$NPC_NAME$` | ..same as above (name of the NPC)|
| `$OWNER_NAME$` | ..the name of the owner of the NPC|
| `$PLAYER_NAME$` | ..the name of the player talking to the NPC|
| `$GOOD_DAY$` | ..`"Good morning"`, `"Good afternoon"` or `"Good evening"` - depending on the ingame time of day|
| `$good_DAY$` | ..same as above, but starts with a lowercase letter (i.e. `"good morning"`)|
Note: If you want to extend this, you can do the following in your own mod:
```
@ -243,7 +224,7 @@ only be attached to dialog options), then a button "Let's trade" will be shown
as option for the first dialog.
Trades that are attached to the trade list (and not dialog options) can be
added and deleted without entering edit mode ("I am your owner. ...").
added and deleted without entering edit mode (`"I am your owner. ..."`).
If unsure where to put your trades: If your NPC wants to tell players a story
about what he sells (or if it is i.e. a barkeeper), put your trades in the
@ -261,7 +242,7 @@ The log shows the date but not the time of the action. Players can view the
logs of their own NPC.
If you want to keep an NPC from logging, set the property
server_nolog_effects to i.e "true"
`server_nolog_effects` to i.e `true`
That way, the NPC will no longer log or send debug messages when executing
effects.
@ -355,10 +336,10 @@ to them.
Sometimes you may wish to i.e. greet the player who has been sent on a mission
or who is well known to the NPC in a diffrent way.
For that purpose, you can use the option in the edit options menu right next to
"..the player may answer with this text [dialog option "o_<nr>"]:" and switch that
from "by clicking on it" to "automaticly".
`"..the player may answer with this text [dialog option "o_<nr>"]:"` and switch that
from `"by clicking on it"` to `"automaticly"`.
When the NPC shows a dialog, it will evaluate all preconditions of all options. But
once it hits an option where selecting has been set to "automaticly" and all other
once it hits an option where selecting has been set to `"automaticly"` and all other
preconditions are true, it will abort processing the current dialog and move on to
the dialog stated in the automaticly selected option/answer and display that one.
@ -368,7 +349,7 @@ the dialog stated in the automaticly selected option/answer and display that one
If you want the NPC to answer with one of several texts (randomly selected), then
add a new dialog with options/answers that lead to your random texts and edit one
of these options so that it is "randomly" selected.
of these options so that it is `"randomly"` selected.
Note that random selection affects the entire dialog! That dialogs' text isn't shown
anymore, and neither are the texts of the options/answers shown. Whenever your NPC
ends up at this dialog, he'll automaticly choose one of the options/answers randomly
@ -389,25 +370,25 @@ and usually set to 5.
### 20. Giving things to the NPC
<a name="npc_wants"></a>
There are several ways of giving items to the NPC: trade, using an action where the
NPC wants a more or less special item, or an effect/result where the NPC just removes
the item from the player's inventory and thrashes it (requires `npc_talk_admin` priv
- or whichever priv you set in config.lua as `yl_speak_up.npc_privs_priv`).
There are several ways of giving items to the NPC:
* selecting `"Show me your inventory"` and putting it directly into the NPC's inventory (as owner)
* trading
* using an action where the NPC wants a more or less special item
* or an effect/result where the NPC just removes the item from the player's inventory and thrashes it (requires `npc_talk_admin` priv - or whichever priv you set in config.lua as `yl_speak_up.npc_privs_priv`).
Using an action might work in many situations. There may be situations where it
would be far more convenient for the player to just give the items to the NPC and let
it deal with it.
In order to activate this functionality, just enter edit mode and select the option
"I want to give you something.".
A new dialog named `d_got_item` will be created and an option shown to players in the
<br>In order to activate this functionality, just enter edit mode and select the option
`"I want to give you something.".`
<br>A new dialog named `d_got_item` will be created and an option shown to players in the
very first dialog where they can tell the NPC that they want to give it something.
The dialog `d_got_item` can have options like any other dialog - except that autoselect
<br>The dialog `d_got_item` can have options like any other dialog - except that autoselect
will be activated for each option. If there are no options/answers to this dialog or
none fits, the NPC will offer the items back automaticly.
Please make sure each option of the dialog `d_got_item` has a precondition that
inspects what was offered:
"an item the player offered/gave to the NPC" (precondition)
and an effect/result that deals with the item:
"an item the player offered to the NPC" (effect)
<br>Please make sure each option of the dialog `d_got_item` has..
* a precondition that inspects what was offered:<br>`"an item the player offered/gave to the NPC" (precondition)`
* and an effect/result that deals with the item:<br>`"an item the player offered to the NPC" (effect)`
Else the items will just be offered back to the player.