Module: chat.trigger
Overview
This module allows defining magic spells
in chat that execute commands
.
Color Boxes
◉ Use chat.trigger
to create chat commands
.
The regex
in chat.replace
is used to find
the target pattern in the given string
.
The regex
in chat.trigger
is used to match
the target pattern against the given string
.
You can define a chat command
like !report
or !noclip
in other games.
◉ To define a simple magic spell in chat string.
Regex: magic
Commands: say magic!
◉ To define a complex magic spell with arguments in chat string.
Regex: i am (.+)
Commands:
-
say You just said: $0
-
say Hello $1
◉ To define a shortcut for chat display module with Styled Chat mod.
Regex: (?<=^|\\s)item(?=\\s|$)
Commands: run as fake-op %player:name% chat display item
Configurations
The following JSON content is provided for reference only. It must NOT be copied directly into the configuration directory, as it does not represent valid JSON syntax.
- File Name:
config.json
- File Content:
Click to see the default
content...
{
/* Use `regex` expression to define `triggers`. */
"triggers": [
{
"regex": "magic",
"commands": [
"say magic!"
]
},
{
"regex": "i am (.+)",
"commands": [
"say You just said: $0",
"say Hello $1"
]
},
{
"regex": "(?<=^|\\s)item(?=\\s|$)",
"commands": [
"run as fake-op %player:name% chat display item"
]
},
{
"regex": "(?<=^|\\s)inv(?=\\s|$)",
"commands": [
"run as fake-op %player:name% chat display inv"
]
},
{
"regex": "(?<=^|\\s)ender(?=\\s|$)",
"commands": [
"run as fake-op %player:name% chat display ender"
]
}
]
}