Character Vault
Any Concept / Any System
Compendium
Your System Come To Life
Roll20 for Android
Streamlined for your Tablet
Roll20 for iPad
Streamlined for your Tablet

Personal tools

Script:StateBrowser

From Roll20 Wiki

Jump to: navigation, search
API ScriptAuthor: manveti
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 → state options path string
optionsoption options
options → ε
option → -string
option → --string
option → -string string
option → --string string
pathstring.path
pathstring
path → ε

Parameter Values
options The !state command accepts the following options:
  • -h, --help: Displays a help message and exits.
  • -s, --set: Sets the value of an already-existing object within state. Both path and value arguments must be provided.
  • -S, --forceset: Sets the value of an object within state, creating it and any intermediate objects if necessary. Both path and value arguments must be provided.
  • -d, --delete: Deletes an object within state. Will propmt for confirmation before deleting. The path argument must be provided.
  • -D, --forcedelete: Deletes an object within state without prompting for confirmation. The path argument must be provided.
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. If state.foo.bar does not exist, an error will be generated.
!state -s foo.bar "{'blah': 'bloh'}"
Sets state.foo.bar to an object with a single property: "blah", with value "bloh", assuming that state.foo.bar exists. If state.foo.bar does not exist, an error will be generated.
!state -s foo.bar.baz 42
Sets state.foo.bar.baz to 42. If state.foo.bar didn't already exist, it will now be {'baz': 42}.
!state -d foo.bar
If state.foo.bar exists, prompts the user to confirm deletion. Then (if the user clicks the button to confirm) deletes state.foo.bar. If state.foo.bar does not exist, an error will be generated.
!state -D foo.bar
Immediately deletes state.foo.bar if it exists. If it does not exist, an error will be generated.

Changelog

v0.1 (2015-07-24)

  • Initial release