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

Token Mod in Powercard with multiplication

1710432703

Edited 1710776978
Hi every ones, I've got a problem with my script. Story short : One of my player became a Werewolf, and his constitution upgrade by 4, so I try to make the macro to switch token side (which I succeed) and alter the bar 1 (the hp) by 2 per level, since he got +4 constituiton and I want it to progress with the player and not having to come back to modify the script at each level up.  My probleme : I found on a 3 years old forum page that I need inline roll to make the bar1|+/-[[@{level}*2]] to work, but with my powercard script I don't know why the bar 1 become $[[0]] or $[[1]] when I use my script. When I use the normal bar1|+/-@{level} it work fine, it's when I want to make it multiplie the level for the constitution boost given by the transformation. If you can help, it would be very appreciated. Here is my script so far ^^  !power {{  --whisper|  --bgcolor|#274e13  --orowbg|#d9d9d9   --name|Teg turns into his ?{Which Form?|Human|Beast} form!  --?? ?{Which Form?} == Human ??|//You see the beast twitch heavily as its fur fall off and the bones break and reshape to take the human anatomy of Teg.//  --?? ?{Which Form?} == Human ?? api_token-mod|_ids @{selected|token_id} _set currentside|1 bar1|-@{level}  --?? ?{Which Form?} == Beast ??|//You see Teg begin to shake and twitch violently as an echo of breaking bones reach your ears. You see Teg's flesh tearring and fur growing as his body shapes itself to a savage beast.//   --?? ?{Which Form?} == Beast ?? api_token-mod|_ids @{selected|token_id} _set currentside|2 bar1|+@{level} }}  
1710467071
Andrew R.
Pro
Sheet Author
First, I recommend you migrate your PowerCards to ScriptCards. PowerCards is maintained by the same person who wrote ScriptCards, and ScriptCards is actively developed.  Second, I’ll have a look at your problem when I get home and can use my computer.  Meanwhile, what game system and character sheet are you using? I can setup a test game if you tell me. 
Hi Andrew, thanks for the reply ^^. I'm using d&d 5e with the standard roll20 sheet. For ScriptCards, I didn't know it existed, I slow down the use of various mod to lighten up my games, I will have a look on it ^^.
1710727332
timmaugh
Pro
API Scripter
Hey, Daran... just to help you understand those inline rolls... When you use an inline roll, your text: [[@{level} * 2]] ...becomes... $[[0]] That's what we call a "roll marker". Every roll has an index, so your first roll is $[[0]], your next roll is $[[1]], and so on. Not every roll index appears in the message because sometimes you have nested rolls: [[ [[1d20]]d10 ]] In that situation, the inner roll would get the first index (0, if there were no preceding roll resolutions), and the outer roll would get 1. All that would be left in the command line after that was finished would be the outer-most roll, or: $[[1]] The data for the roll is on the message, so when the roll marker hits the chat output, the Roll20 chat pane knows what data to display; it shows you the roll result rather than the roll marker. Most scripts can do something similar, looking up the index from the roll marker to know what value to assign to the roll marker that is left in the command line. However, PowerCards doesn't do this unpacking. In fact, PowerCards rerolls inline rolls and uses its own random generation using the same roll equation, so there's really a double confusion! Andrew's point is a good one that ScriptCards is a better solution than PowerCards for a situation like this. Though, if you were not aware of it, I would also encourage you to look up other scripts that are staples of a lot of game functionality: ChatSetAttr, TokenMod, GroupInit. If you're feeling adventurous after all of that, you can add the Metascript Toolbox. =D
Thank you timmaugh for your reply ^^ I will look certainly at scriptcard, and thank you for your clarification about the inline roll ^^. By the way, I got few script on my side (chatsetattr, tokenMod, GroupIni, DeathTracker, ApplyDamage, GroupChek, MonsterHitDie, and some more ;) ), but that's true I didn't look up recently for the new script out :)
I finally manage to find a way to counter my issue (Try to learn about Scripcard and realise it may be a bit difficult with my schedule to find time to learn the new syntax of this script). I create a new attribute called transformation which I will change manually instead of going inside de macro to find the right place to change it. Thank you very much for your help ^^