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

Difference between revisions of "Repeating Section"

From Roll20 Wiki

Jump to: navigation, search
m
(referencing in macros)
Line 19: Line 19:
 
==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>
@{selected|repeating_items_$1_itembonus}       // refer second item by index
+
@{Alice|repeating_inventory_$0_itemcount}         // refers to the first row by index
@{selected|repeating_items_-KC0zCLum1Rq3V5wssyE_itembonus} //reference by RowID
+
@{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]]
 
==Sheet Coding==
 
==Sheet Coding==
 
</noinclude>
 
</noinclude>
For info on [[BCS|coding]] rep sections for character sheets, see: '''[[BCS/Repeating Section]]'''
+
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:Macros]]
 
</noinclude>
 
</noinclude>

Revision as of 14:42, 13 January 2022

Main Page: Character Sheet

Using

Example of deleting & reordering a repeating section on the D&D 5E by Roll20-sheet.


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 many 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:

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.