Difference between revisions of "Repeating Section"
From Roll20 Wiki
Andreas J. (Talk | contribs) m |
Andreas J. (Talk | contribs) m (API examples) |
||
(7 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<noinclude>{{revdate}} | <noinclude>{{revdate}} | ||
− | {{main|Character Sheet}}</noinclude> | + | {{main|Character Sheet}} |
− | + | '''Repeating Sections''' are a specific part of [[character sheets]] which works in a particular way.</noinclude> | |
==Using== | ==Using== | ||
[[File:5e-spells-rep-section-example.gif|thumb|500px|Example of deleting & reordering a repeating section on the [[D&D 5E by Roll20]]-sheet.|right]] | [[File:5e-spells-rep-section-example.gif|thumb|500px|Example of deleting & reordering a repeating section on the [[D&D 5E by Roll20]]-sheet.|right]] | ||
Line 8: | Line 8: | ||
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. | 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 | + | 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 <span style="font-family:Pictos;">&</span>-button in the bottom-left corner of the repeating section to add a new entry. | + | * '''Add:''' Click on the {{button|1 = <span style="font-family:Pictos;">&</span>}}-button in the bottom-left corner of the repeating section to add a new entry. |
− | * '''Modify:''' Click the {{lock}} "Modify/Lock"-button to enable deleting existing entries, or reorganizing them. | + | * '''Modify:''' Click the {{button|{{lock}}}} "Modify/Lock"-button to enable deleting existing entries, or reorganizing them. |
− | ** '''Reorder:''' Press and hold the '''<big>≡</big>'''-symbol of a specific row, and then drag it up- or downwards to change it's position. (left side) | + | ** '''Reorder:''' Press and hold the {{button|'''<big>≡</big>'''}}-symbol of a specific row, and then drag it up- or downwards to change it's position. (left side) |
− | ** '''Delete:''' Press the <span style="font-family:Pictos;">#</span>-icon of of a specific row, to delete it. You get no warning, so it's deleted right away. (right side) | + | ** '''Delete:''' Press the {{button|1 = <span style="font-family:Pictos;">#</span>}}-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 {{Unlock}}(bottom right) to exit the edit mode for the rep section | + | ** When you're done deleting/re-ordering things, click on the {{button|{{Unlock}}}}(bottom right) to exit the edit mode for the rep section |
− | < | + | <noinclude> |
==Macro== | ==Macro== | ||
{{main|Macros#Referencing Repeating Attributes}} | {{main|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 {{code|0}}, so the first item is {{code|$0}}. | ||
+ | |||
+ | '''Attribute Example''' | ||
+ | |||
+ | {{code|repeating_inventory_$0_itemname}} or {{code|repeating_inventory_-MtISxbdM5dmT1rsJG96_itemname}} | ||
+ | |||
+ | Breakdown: | ||
+ | * {{code|repeating}} - indicates the attribute if from a repeating section | ||
+ | * {{code|_}} separator between each component of the rep section attribute reference. | ||
+ | * {{code|inventory}} Name of the Repeating section (this name cannot contain underscores) | ||
+ | * {{code|$0}} - row index, tells which row's attributes to check from. {{code|$0}}, {{code|$1}}, {{code|$2}} etc. | ||
+ | ** {{code|-MtISxbdM5dmT1rsJG96}} alternatively, use the unique [[RowID]] to reference same thing even if it's reordered. | ||
+ | * {{code|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 {{code|<nowiki>@{Bob|repeating_inventory_$0_itemname}</nowiki>}} in the chat, it will return you the name of the item. | ||
<pre> | <pre> | ||
− | @{ | + | @{Alice|repeating_inventory_$0_itemcount} // refers to the first row by index |
− | @{selected| | + | @{selected|repeating_inventory_-KC0zCLum1Rq3V5wssyE_itembonus} //reference by RowID |
</pre> | </pre> | ||
+ | Lists of some sheet's normal and repeating section attributes: | ||
+ | * [[D&D 5E by Roll20#Directly Referencing Attributes]] | ||
+ | * [[PF2E#Directly Referencing Attributes|Pathfinder 2E#Directly Referencing 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 {{fpl|9097236/ InsertArg}} have options for this. | ||
==Sheet Coding== | ==Sheet Coding== | ||
</noinclude> | </noinclude> | ||
− | For info on [[BCS|coding]] rep sections for character sheets, see: '''[[ | + | For info on [[BCS|coding]] rep sections for character sheets, see: '''[[Character Sheet Development/Repeating Section]]''' |
<noinclude> | <noinclude> | ||
[[Sheetworkers]] involving repeated sections may end up more complicated than ones mode for regular sections. | [[Sheetworkers]] involving repeated sections may end up more complicated than ones mode for regular sections. | ||
− | + | ||
[[Category:Character Sheets]] | [[Category:Character Sheets]] | ||
+ | [[Category:Repeating Section]] | ||
+ | [[Category:Macros]] | ||
</noinclude> | </noinclude> |
Latest revision as of 13:50, 19 April 2022
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 |
[edit] 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
[edit] 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:
[edit] 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.
[edit] 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.