Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Update HP using Chat Command?

1643721952

Edited 1643722094
As a player, is there a way to update your character's HP via a Chat Command? For example: DM says my character takes 57 HP of damage I type into the text chat: /foo name=MyName HP=[[{hp} - 57]] Something like Doing math in the chat , but also assigning that value to HP? I have looked through the API documentation but couldn't find the right syntax to use in the text chat (if that's even possible). Hoping the community here can point me in the right direction. 
1643723599
timmaugh
Forum Champion
API Scripter
You definitely need the API for this (which is a Pro perk -- required of the game creator if you want to use them in a game). But just having the API doesn't give you access to the commands you want automatically. You have to have a script that connects what-you-type-into-chat to game-effect-you-want-to-happen. There are many that have been written... ChatSetAttr is a script that can affect attributes, or, if your token represents the character and your bars are linked to the appropriate attributes on your character sheet, you can use TokenMod. Alternatively, there are other "all in one" combat systems out there like CombatMaster, or systems for particular systems, depending on what you're playing.
What an excellent response. Thank you so much for that. My biggest takeaway is that there is no method that I can leverage without involving the creator, and I wouldn't want to impose. However, if I were to run a game in the future, I would totally be open to leveraging Pro and writing scripts. This also seems like an ideal use case for TokenMod. Thanks again!
Sorry, follow up question. Let's say TokenMod is available in the Text Chat. If my character is named 'Phil' and I want to subtract 3 from his HP, would this be the correct syntax to type into the chat? !token-mod --set bar1_value|-3 --ids @{Phil}
It would require the GM to set the script configuration to allow players to use the '--ids' function with this command: !token-mod --config players-can-ids|on Then the command would need the token_id argument: !token-mod --set bar1_value|-3 --ids @{Phil|token_id}
1643748532
The Aaron
Roll20 Production Team
API Scripter
In this case, you actually would use a character_id: !token-mod --set bar1_value|-3 --ids @{Phil|character_id} You might also want a ! on the end of the adjustment to make sure it stays bounded between (0,Max): !token-mod --set bar1_value|-3! --ids @{Phil|character_id}