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

Selected target calling current or max value

After several years of using Roll20 only at the tabletop, I'm trying to relearn everything I've forgotten and catch-up to all the new stuff. And that brings me to this macro I've been fiddling with. It's for a Call of Cthulhu game, but this is not system specific question. I've been hunting the Dice Reference and Macros Help pages, but have only succeeded in confusing myself. Any help is much appreciated. Ultimately, I want to be able to select a token, query which value (current or max) as a token action, and roll the value of an attribute (sanity_loss in this case) in the template. I can't figure out how to specify which value. Also, if someone were to suggest very nicely, is it even possible for the Roll20 team to add a second sanity_loss attribute (sanity_loss1 and sanity_loss2) or is everything written in stone because of the compendium? I originally had the bright idea of setting up a character sheet with every mythos entity as an attribute so that I wouldn't need a token; I would just have to make certain I spelled the name correctly. But I didn't have any better luck writing that one. It would be easy with an if/then but I reckon I'd have to learn about api scripts (on the to-do list, but pretty far down right now). Anyway, thanks for reading.
1589515801

Edited 1589515852
GiGs
Pro
Sheet Author
API Scripter
I'm not following exactly what you;re after. can you give a specific example of how you'd use the macro in a session, using actual attribute names and the calculations involved? For reference, this page shows the basics of grabbing attribute values:&nbsp; <a href="https://wiki.roll20.net/Macros#Attribute_Macros" rel="nofollow">https://wiki.roll20.net/Macros#Attribute_Macros</a>
Thanks for replying, GiGs. I've working through that page's examples, but at the end of two days my head spinning. By way of illustrating what, ideally, should happen: I have an Entity token with the attribute sanity_loss, it's current value is 1d3 and it's max value is 1d6. By selecting the token, a token action appears that will randomly determine the sanity loss. A query asks which value I want, then spits the rolled value out. I have thos so far: /r @{selected|sanity_loss|?{Current or Max}} I have not had success with it. I'll wrap in in the template, but I think I've got that figured.
1589519502
GiGs
Pro
Sheet Author
API Scripter
You can never build attribute calls from parts. So you cant do this /r @{selected|sanity_loss|?{Current or Max}} Instead you have to do this: /r ?{Current or Max|Current,@{selected|sanity_loss}|Max,@{selected|sanity_loss|max}} You can break that up so its a bit more clear, like so /r ?{Current or Max| Current,@{selected|sanity_loss}| Max,@{selected|sanity_loss|max}}
Wow. That works and it's amazing, thank you. I was going back over the Macro wiki page, and can't find where it illustrates the drop-down. here's the finished macro. Again, thanks. &amp;{template:callofcthulhu} {{roll_type=Sanity Loss}} {{title=@{selected|character_name}}} {{roll=[[?{Current or Max| Current,@{selected|sanity_loss}| Max,@{selected|sanity_loss|max}}]]}}
1589524336
GiGs
Pro
Sheet Author
API Scripter
You're welcome :) Dropdowns like this are called Queries, so that word will probably help find the relevant help articles.