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:Object Properties

From Roll20 Wiki

Jump to: navigation, search
API ScriptAuthor: manveti
Version: 0.1
Last Modified: 2015-06-11
Code: ObjectProperties
Dependencies: None
Conflicts: None

ObjectProperties allows the user to get and set properties of specified objects. This provides quick access to token IDs, image URLs, etc., as well as the ability to set token bar values, move tokens, and various other tricks which would otherwise require (very small) specialized scripts.

It is recommended that this script be used in conjunction with the CommandShell module, which will improve output formatting and command discovery.


Syntax

!getprop [options] [properties]
!setprop [options] <property-value pairs>
Formally:

S → getprop options properties
S → pagesize options property-value pairs
optionsoption options
options → ε
option → -string
option → --string
option → -string string
option → --string string
propertiespropertiesstring
properties → ε
property-value pairs property-value pairs property-value pairs
property-value pairs string string

Parameter Values
options The !pagesize command accepts the following options:
  • -h, --help: Displays a help message and exits.
  • -t T, --type T: Specifies the type (e.g. graphic) of objects specified after this argument. Can be passed multiple times to get properties of objects of different types (see examples below). Does not directly specify any objects (use -i, -n, etc., described below).
  • -i ID, --id ID: Specifies the ID of an object. This should come after a -t option to specify the type for more efficient lookup. Can be passed multiple times to specify multiple objects.
  • -n NAME, --name NAME: Specifies the name of an object, for types which have a "name" property. This should come after a -t option in order to be unique (without a type, this will affect all objects with the specified name).
  • -r, --relative: When setting properties, the new value will be added to the existing value, rather than overwriting it.

Examples

!getprop
Will display all properties of each selected object.
!getprop -t graphic -i -Jp3illTx5IjO2NMoxEC name
Will display the name of the specified graphic object (token).
!getprop -n Fighter _id _type
Will display the ID and type of all objects named "Fighter" (e.g. a character and its associated tokens).
!getprop _pageid
Will display the ID of the page containing the selected object (an easy way for a GM to get the ID of the page currently being viewed).
!setprop -r top 70 left -70
Will move the selected object(s) one square down and one square left.
!setprop top +70 left -70
CAUTION: Unlike the previous command, this will move the selected object(s) to the coordinates (-70,70), or off the left edge of the map along the first horizontal grid line.
!setprop -r bar1_value -3
Will subtract 3 from bar 1 of the selected token(s).
!setprop bar1_value -3
CAUTION: Will set bar 1 of the selected token(s) to "-3".

Changelog

v0.1 (2015-06-11)

  • Initial release