ParseSpell - TheComputerGeek2/MagicSpells GitHub Wiki
spell-class: ".targeted.ParseSpell"
targeting
cast argument values:
Value | Supported |
---|---|
entity |
true |
location |
false |
entity_from_location |
false |
Description:
This spell is used to edit a string variable.
Configuration:
Since 4.0 Beta 13 these options support dynamic values through string expressions.
Option | Description | Type | Default |
---|---|---|---|
operation |
Valid operations: translate (normal ), difference , append , and regex (regexp ) |
String | "normal" |
parse-to-variable |
Variable to store the result in after the operation is complete. | String |
Translate:
This mode changes the variable value to a new value if the expected-value
matches the current value of variable-to-parse
.
Option | Description | Type |
---|---|---|
variable-to-parse |
Variable to check. | String |
expected-value |
A string, but "any" can be used as a wildcard. | String |
Difference:
This mode checks the difference between two variables and stores the result.
Option | Description | Type |
---|---|---|
first-variable |
First variable to check against. | String |
second-variable |
Second. | String |
Append:
This mode first checks if the expected-value
matches the current value of variable-to-parse
. If it does, it appends parse-to
onto the value of variable-to-parse
, and stores this new value string.
Option | Description | Type |
---|---|---|
expected-value |
A string, but "any" can be used as a wildcard. | String |
variable-to-parse |
Variable to check. | String |
parse-to |
The value to append. | String |
Regex:
This mode can store returned matched text or do text replacement.
Option | Description | Type |
---|---|---|
variable-to-parse |
Variable value to match or perform replacements on. | String |
expected-value |
A regex object (in string format). Use this for help: https://regexr.com/ | String |
parse-to |
If this value is specified, it will be used as the replacement text for the first thing that is matched. If it's empty, the result will instead be all the matched text. | String |
Example of the "normal" operation:
parse:
spell-class: ".targeted.ParseSpell"
target-self: true
# operation - normal (default)
variable-to-parse: Greeting
expected-value: Hello
parse-to-variable: Greeting
parse-to: Goodbye