变量: variable
Tip
This objective is different. You cannot complete it, it will also ignore defined events and conditions. You can start it and that's it. While this objective is active though, everything the player types in chat (and matches special pattern) will become a variable. The pattern is . So if you type that, it will create a variable called , which will resolve to string. These are not global variables, you can access them as objective properties. Let's say you defined this objective as in your objectives.yml file. You can access the variable in any conversation, event or condition with - and in case of this example, it will resolve to . The player can type something else, and the variable will change its value. Variables are per-player, so my variable will be different from your variable, depending on what we were typing in chat. You can have as much variables here as you want. To remove this objective use event - there is no other way.key: value``key``value``var``%objective.var.key%``value``key``key``objective delete
You can also use event to change variables stored in this objective. There is one optional argument, . If you use it, the objective won't be modified by what players type in chat.variable``no-chat
官方例子
Example
variable