Script:StateBrowser
From Roll20 Wiki
API ScriptAuthor: manveti
Version: 0.1
Last Modified: 2015-07-24
Code: StateBrowser
Dependencies: None
Conflicts: None
Version: 0.1
Last Modified: 2015-07-24
Code: StateBrowser
Dependencies: None
Conflicts: None
StateBrowser allows a user to view and modify properties of the state object.
It is recommended that this script be used in conjunction with the CommandShell module, which will improve output formatting and command discovery, and will allow whitespace to be preserved in property values.
Syntax
!state [options] [path] [value]
Formally:
S
→ stateoptions
path
string
options
→option
options
options
→ ε
option
→ -string
option
→ --string
option
→ -string string
option
→ --string string
path
→ string.path
path
→ string
path
→ ε
Parameter | Values |
---|---|
options | The !state command accepts the following options:
|
path | Path of object within state to affect, in dot-notation (e.g. "foo.bar" to affect state.foo.bar). |
value | Value to which to set object, in JSON. |
Examples
- !state foo.bar
- Displays the value of
state.foo.bar
, assuming it exists. Ifstate.foo.bar
does not exist, an error will be generated.
- Displays the value of
- !state -s foo.bar "{'blah': 'bloh'}"
- Sets
state.foo.bar
to an object with a single property: "blah", with value "bloh", assuming thatstate.foo.bar
exists. Ifstate.foo.bar
does not exist, an error will be generated.
- Sets
- !state -s foo.bar.baz 42
- Sets
state.foo.bar.baz
to 42. Ifstate.foo.bar
didn't already exist, it will now be {'baz': 42}.
- Sets
- !state -d foo.bar
- If
state.foo.bar
exists, prompts the user to confirm deletion. Then (if the user clicks the button to confirm) deletesstate.foo.bar
. Ifstate.foo.bar
does not exist, an error will be generated.
- If
- !state -D foo.bar
- Immediately deletes
state.foo.bar
if it exists. If it does not exist, an error will be generated.
- Immediately deletes
Changelog
v0.1 (2015-07-24)
- Initial release