Stat
This view is going to be, most likely, a staple in your character sheet design. As the name implies, it's designed to directly display stats within your sheet, with as little extra details as required. Be sure to read through all the properties of this one, it's a mighty one!
JSON Format
{
"type": "stat",
"id": ...,
"type": ...,
"margin_left": ...,
"margin_right": ...,
"margin_top": ...,
"margin_bottom": ...,
"is_visible": ...,
"validation_message": ...,
"stat": ...,
"edit_stat": ...,
"change_amount": ...,
"min_value_allowed": ...,
"max_value_allowed": ...,
"calculated_min_value_allowed": ...,
"calculated_max_value_allowed": ...,
"on_tap_event": ...,
"on_long_tap_event": ...,
"bottom_sheet_view": ...,
"bottom_sheet_in_edit_mode": ...,
"sheet_title": ...,
"stat_color": ...,
"name_color": ...,
"style": ...,
"always_show_sign": ...,
"edit_bottom_sheet_title": ...
}
Fields
| Field | Type | Required | Description |
|---|---|---|---|
id | String | ✓ | A unique identifier for the view. You can use it to reference view values in stat formulas by doing $view.view_id (where view_id is the id that was assigned to this view by you in the system definition) |
type | RPGViewType | ✓ | The type of this view. Note that these are all in camelCase. |
margin_left | double | Optional. How much margin to add to the left of this view. | |
margin_right | double | Optional. How much margin to add to the right of this view. | |
margin_top | double | Optional. How much margin to add to the top of this view. | |
margin_bottom | double | Optional. How much margin to add to the bottom of this view. | |
is_visible | StatFormulaComponent | Optional. A formula to specify if the view should be visible or not. Must return a bool. | |
validation_message | StatFormulaComponent | Optional. If this view is an input, you can define this formula to return a message when the input value is invalid. If the input is valid, you should return null. Otherwise, make the formula return the string that should be shown to the user. | |
stat | String | ✓ | The path to the stat that will display in this stat. Be wary that the name that will display in this view is the name of this stat! |
edit_stat | String | Optional. Defaults to null. Sometimes you'll want to display the value of one stat but have the player edit a different one when in edit mode (e.g: you might want to display an ability modifier, but when editing you would want the player to edit the ability score instead). This is exactly what this property is here for. | |
change_amount | double | Optional. Defaults to 1. When in edit mode, number stats will have an up and down arrow to edit the value. The change_amount determines how much a single tap on an arrow increments or decrements the value of the stat. If set to 0, this stat will NOT be editable by the user (ie: the app will not display the up and down arrow buttons). | |
min_value_allowed | double | Optional. Defaults to no minimum. The minimum value that this stat should be allowed to take. Only relevant for number stats. | |
max_value_allowed | double | Optional. Defaults to no maximum. The maximum value that this stat should be allowed to take. Only relevant for number stats. | |
calculated_min_value_allowed | StatFormulaComponent | Optional. Defaults to no minimum. Analogous to min_value_allowed, but allows you to calculate this value in runtime instead. This formula should compute to a valid number. If both this property and min_value_allowed are provided, the latter will take precedence. | |
calculated_max_value_allowed | StatFormulaComponent | Optional. Defaults to no maximum. Analogous to max_value_allowed, but allows you to calculate this value in runtime instead. This formula should compute to a valid number. If both this property and max_value_allowed are provided, the latter will take precedence. | |
on_tap_event | Event | Optional. Defaults to none. The event that should be fired when the player taps on this stat. Can be useful to, for example, trigger dice rolls. | |
on_long_tap_event | Event | Optional. Defaults to none. The event that should be fired when the player long-taps (long-presses) on this stat. Be wary, though, as including this property will not allow the user to enter into edit mode directly by long-pressing on this stat. | |
bottom_sheet_view | RPGView | Optional. Defaults to no view. If a view is provided here, the app will display this view as a bottom sheet when the user taps on the stat. This will be ignored if you have provided an on_tap_event. | |
bottom_sheet_in_edit_mode | bool | Optional. Defaults to false. If a bottom_sheet_view was provided, this flag will determine if that bottom sheet should start in edit mode or not. | |
sheet_title | StatFormulaComponent | Optional. Defaults to an empty string. Should be provided if a bottom_sheet_view is provided. The value of this formula will be used as the title for the sheet. | |
stat_color | StatFormulaComponent | Optional. Defaults to the textColor for the color scheme selected by the user. Should compute be a string for an RPGColors or a hex code for a color that will be used as the color for the stat value. | |
name_color | StatFormulaComponent | Optional. Defaults to the textColor for the color scheme selected by the user. Should compute be a string for an RPGColors or a hex code for a color that will be used as the color for the stat name. | |
style | StatRPGViewStyle | Optional. Defaults to block. The style that this view should display with. Block is better for main stats, list is more compact and should be used for longer lists of stats. | |
always_show_sign | bool | Optional. Defaults to false. For number stats, if a sign should always be prepended to the number (e.g: +5). | |
edit_bottom_sheet_title | StatFormulaComponent | Optional. Defaults to none. If provided, the app will try to display a bottom sheet to edit (add and subtract from) the stat value when the player taps on it. This will only work if both on_tap_event and bottom_sheet_view are omitted. |