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

CHATSETATTR help

I am wanting to make a NPC generator. I am having issues getting the base attr to match the random max attr. Example. !setattr --sel -- body|max|[[1d10]] i want body to = body|max. I have tried different variations and can not find any one talking about how to do this.  My idea was this. !setattr --sel -- body|max|[[1d10]] -- body|=@{body|max}  but did not work.  Please help.
1601146926
GiGs
Pro
Sheet Author
API Scripter
You're running into two problems-  one syntax error, and one very fundamental roll20 problem: the Order of Operations. The syntax error: you cant do this: @{body|max}. It will look for a character named body,  and an attribute named max.  Whenever you use the |max syntax, you must  include something to tell roll20 which character to use, like @{selected|body|max) or @{Frodo|body|max}. The second problem is a killer though. When you start  a macro, roll20 checks all attribute calls (like @{selected|body|max}) mentioned in the macro, and replaces the call with the value. It does this before proceeding with the macro. So with this: !setattr --sel --body|max|[[1d10]] --body|=@{selected|body|max}  It is getting the body_max before doing anything else. Lets say it's currently 0. The above line becomes !setattr --sel --body|max|[[1d10]] --body|=0 Because it uses attribute values as they were before the macro started. The only way around this problem in this case (since your value is based on a roll) is to create a custom API script.
Ok, that makes alot of sense. It is not a killer on the generator just have to set the attributes manually when I open the sheet the first time. The api still saved me 10 mins work for each npc I make. Because Cyberpunk does not have a compendium with baddies like D&D does I have to make all of the NPCs the players encounter. The generator sets skills, stats, and equipment based on the role. !setattr --sel -- role|Netrunner -- euro|[[1d100*100]] -- rep|[[1d6]] -- body|max|[[1d10]] -- cool|max|[[1d10]] -- dex|max|[[1d10]] -- emp|max|[[1d10]] -- int|max|[[1d10]] -- luck|max|[[1d10]] -- move|max|[[1d10]] -- ref|max|[[1d10]] -- tec|max|[[1d10]] -- wil|max|[[1d10]] -- interface|[[1d10]] -- perception|[[1d10]] -- ranged|[[1d10]] -- brawling|[[1d10]] -- melee|[[1d10]] -- basictech|[[1d10]] -- cybertech|[[1d10]] -- systems|[[1d10]] -- electronics|[[1d10]] -- cyberdeck|[[1d10]] -- security|[[1d10]] -- programing|[[1d10]] -- stealth|[[1d10]] -- w1e|1 --  w1|Dai Lung Cybermag 15 -- w1mod|-1 -- w1dam|1d6+1 -- w1clip|max|10 -- w1rof|2 -- w1type|Pistol [50m] -- w2|Nomad .357 Magnum Lever-Action Carbine -- w2mod|0 -- w2dam|2d6+3 -- w2clip|max|9 -- w2rof|1 -- w2type|Rifle [400m] -- w3|Kendachi MonoKnife -- w3mod|1 -- w3dam|2d6 -- w3clip|max|0 -- w3rof|2 -- w3type|Melee [5m] -- ar2e|1 -- a2|Light Armor Jacket -- mar2|10 -- ar2|max|10 -- a2enc|0  Thank you for the help. You always come through for me.
1601149305
GiGs
Pro
Sheet Author
API Scripter
Aww, shucks, thank you! Btw one way to handle this would be to have two macros. One to set the initial attributes, with the rolls. Then a second macro to set all the attributes whose values depend on those rolls. Then it's just two clicks to do them all. It'll still save a lot of time and work around the order of operations issue.
That is a great idea and I will only have to make one version of that because it will only have to fill in the stats.
!setattr --sel --body|@{selected|body|max} --cool|@{selected|cool|max} -- dex|@{selected|dex|max} -- emp|@{selected|emp|max} -- int|@{selected|int|max} -- luck|@{selected|luck|max} -- move|@{selected|move|max} --ref|@{selected|ref|max} -- tec|@{selected|tec|max} -- wil|@{selected|wil|max} This worked had to remove the = sign. Thank you again.
1601153466
GiGs
Pro
Sheet Author
API Scripter
Great :)