You can now set and change custom variables on items using conditions and actions!
You can store either text, like "Hello, world!" in a variable, or a number!
This update adds four new actions: "setVariable", "deleteVariable", "addToVariable" and "subtractFromVariable"
Code (Text):
action: setVariable
variable: "myCustomVariable"
value: 64
It also adds new placeholders for variables! Just use {variable.variableName}
Code (Text):
action: sendMessage
messages:
- "The value of myCustomVariable is {variable.myCustomVariable}"
- "The value of myOtherVariable is {variable.myOtherVariable}"
- "If we add them together we get {{variable.myCustomVariable} + {variable.myOtherVariable}}"
It also adds a new condition, "ifVariables", that lets you check whether or not a variable meets certain conditions! You can even use placeholders here!
Code (Text):
action: sendMessage
ifVariables:
myCustomVariable: "> 10"
myOtherVariable: " = {variable.myCustomVariable}"
message: "This message will only send if myCustomVariable is > 10 and myOtherVariable is equal to myCustomVariable!"
Variables are unique to each item — one player's myCustomItem could have a variable set to 10, and another player's myCustomItem could be set to 5, so be careful when allowing players to stack items with variables on them!
More info will be added on the wiki soon:
https://github.com/jojodmo/CustomItems/wiki/Variables