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

From Roll20 Wiki

Revision as of 10:26, 30 September 2020 by Andreas J. (Talk | contribs)

Jump to: navigation, search
API ScriptAuthor: Jakob
Version: 1.10
Last Modified: 2020-09-07
Code: ChatSetAttr
Dependencies: None
Conflicts: Possible for other scripts editing character stats


ChatSetAttr allows you to create, modify, or delete characters' attributes via chat commands (or macros containing these commands). (Version 1.10 is newer than v1.9 and v.1.8.)

This script is a utility that allows the user to create, modify, or delete character attributes via chat messages or macros. There are several options that determine which attributes are modified, and which characters the attributes are modified for. You can also d

The script is called by the command

  • !setattr [--options], for creating or modifying attributes
  • !delattr [--options], for deleting attributes
  • !setattr-config is used for changing Global Configs


Contents

Selecting a target

One of the following options must be specified; they determine which characters are affected by the script.

  • --all will affect all characters in the game. USE WITH CAUTION. This option will only work for the GM. If you have a large number of characters in your campaign, this will take a while to process all attribute changes.
  • --allgm will affect all characters which do not have a controlling player set, which typically will be every character that is not a player character. USE WITH CAUTION. This option will only work for the GM.
  • --charid charid1, charid2, ... allows you to supply a list of character ids, and will affect characters whose ids come from this list. Non-GM Players can only affect characters that they control.
  • --name name1, name2, ... allows you to supply a list of character names, and will look for a character with this name to affect. Non-GM Players can only affect characters that they control.
  • --sel will affect all characters that are represented by tokens you have currently selected.

Examples

  • !setattr --sel --Strength|15 will set the Strength attribute for 15 for all selected characters.
  • !setattr --name John --HP|17|27 --Dex|10 will set HP to 17 out of 27 and Dex to 10 for the character John (only one of them, if more than one character by this name exists).
  • !delattr --all --gold will delete the attribute called gold from all characters, if it exists.
  • !setattr --sel --mod --Strength|5 will increase the Strength attribute of all selected characters by 5, provided that Strength is either empty or has a numerical value - it will fail to have an effect if, for example, Strength has the value 'Very big'.
  • !setattr --sel --Ammo|%Ammo_max% will reset the Ammo attribute for the selected characters back to its maximum value.
   If the current value of attr1 is 3 and the current value of attr2 is 2, !setattr --sel --evaluate --attr3|2*%attr1% + 7 - %attr2% will set the current value of attr3 to 15.

Inline roll example

&{template:default} {{name=Cthulhu}} !modattr --silent --charid @{target|character\_id} --sanity|-{{Sanity damage=[[2d10+2]]}} --corruption|{{Corruption=Corruption increases by [[1]]}}!!! {{description=Text}}

This will decrease sanity by 2d10+2 and increase corruption by 1 for the character selected.

Global Configurations

There are three global configuration options which can be toggled either on the One Click Install-page, or by entering !setattr-config in chat.

  • playersCanModify, will give players the possibility of modifying characters they don't control
  • playersCanEvaluate, will give players the possibility of reading the stats of characters they don't control, with the --evaluate option
  • useWorkers, will determine if the script triggers sheet workers on use. Should normally be toggled on.

Conflicts

This script might conflict with other API that edits character stats, but shouldn't be an issue unless some other script is made to automatically edit same stats as ChatSetAttr. If you have an Ammo Tracking script that reduces the ammo spent from the character, it shouldn't be a problem unless you also incorporated CharSetAttr into the diceroll.

Links

Related Pages

  • Complete Guide to Macros & Rolls‎
    • q Text Chat - where the roll results appear, & info on the common chat commands
    • Dice Reference - Comprehensive list of how the Roll20 dice-rolling syntax works, and list the features available
    • Macros - How to create macros, and other info on how the Roll20 qText Chat works, like referencing stats on character sheets, roll queries, nesting macros & initiative
    • Roll Templates - a method of formatting roll results in the chat, with some extra functions
    • API(Pro Only) - API commands can be used in the qText Chat