Repeating Section
From Roll20 Wiki
Page Updated: 2022-04-19 |
Main Page: Character Sheet
Repeating Sections are a specific part of character sheets which works in a particular way.
Contents |
Using
Some of the features of Repeating Sections do not work when the Character Sheet is in a separate window. |
In addition to fields, your character sheet may feature one or more repeating section , where you can dynamically change a list by adding/reordering/removing entries to them.
How the Repeating sections buttons look may vary between character sheets for different systems, but this is how the buttons usually look:
- Add: Click on the &-button in the bottom-left corner of the repeating section to add a new entry.
- Modify: Click the ( "Modify/Lock"-button to enable deleting existing entries, or reorganizing them.
- Reorder: Press and hold the ≡-symbol of a specific row, and then drag it up- or downwards to change it's position. (left side)
- Delete: Press the #-icon of of a specific row, to delete it. You get no warning, so it's deleted right away. (right side)
- When you're done deleting/re-ordering things, click on the )(bottom right) to exit the edit mode for the rep section
Macro
Main Page: Macros#Referencing Repeating Attributes
Attributes in repeating sections can either be referenced by their row index(changes if you reorder), or by their RowID(unique ID is generated for each row when they are created, staying the same even if you reorder them)
Row Index starts from 0
, so the first item is $0
.
Attribute Example
repeating_inventory_$0_itemname
or repeating_inventory_-MtISxbdM5dmT1rsJG96_itemname
Breakdown:
-
repeating
- indicates the attribute if from a repeating section -
_
separator between each component of the rep section attribute reference. -
inventory
Name of the Repeating section (this name cannot contain underscores) -
$0
- row index, tells which row's attributes to check from.$0
,$1
,$2
etc.-
-MtISxbdM5dmT1rsJG96
alternatively, use the unique RowID to reference same thing even if it's reordered.
-
-
itemname
- the actual name of the attribute. (this name may contain underscores)
So, in a D&D 5E by Roll20-game, if you have a character named "Bob" with at least one item in their inventory, and you type @{Bob|repeating_inventory_$0_itemname}
in the chat, it will return you the name of the item.
@{Alice|repeating_inventory_$0_itemcount} // refers to the first row by index @{selected|repeating_inventory_-KC0zCLum1Rq3V5wssyE_itembonus} //reference by RowID
Lists of some sheet's normal and repeating section attributes:
API
Most APIs which can read or interact with character sheets can also do so with rep sections. Here are a few direct examples:
- Script:ChatSetAttr#Add_new_thing_to_Repeating_Section
- ScriptCards#Repeating_Section_Access_.28--R.29
- Script:Ammo#Examples
- Meta-Toolbox: APIs like Script:Fetch or InsertArg(Forum) have options for this.
Sheet Coding
For info on coding rep sections for character sheets, see: Character Sheet Development/Repeating Section
Sheetworkers involving repeated sections may end up more complicated than ones mode for regular sections.