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

[OGL Sheet] 'Clickable' Macro help to output selected token info (almost there, I think :o )

Hi! I'm trying to set up a marco that lists the names of certain token info, and then if I click I get the description.  For example, for traits I have (I'm only listing one repeating level of the traits -- once I figure it out I'll expand): /w gm &{template:default} {{name=TRAITS for @{selected|npcd_name}}} {{ [@{selected|repeating_npctrait_$0_name} ](~selected|repeating_npctrait_$0_desc) }} It lists a clickable trait name (e.g., "Innate Spellcasting), but when I click on it I get an error.  I'm guessing because it's trying to run a macro (like an attack), but the trait description isn't a macro.  Can what I'm describing above be done? (The reason I'm attempting this is, not blessed with more than 2 monitors (one I use for recording sessions), I'm trying to reduce the number of times I need to open a character sheet.  I'd rather just click on a token and get the info I need that way, as my screen fills up quickly with character sheets, especially in combat), and I can't see the main screen / tokens.) Thanks!
1485133406
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
You'll want to use API command buttons (API access not required). <a href="https://wiki.roll20.net/API:Chat" rel="nofollow">https://wiki.roll20.net/API:Chat</a>
Thanks Scott. &nbsp;I'll look into it. &nbsp;I used to be a programmer back in the day... :o .
1485483666

Edited 1485484843
All - I found&nbsp; this forum post which is pretty much what I was looking for as well. &nbsp;The "+" option doesn't seem to be working in my game (it's supposed to help avoid the "no attribute" errors, but I'm getting them. &nbsp;Either way, something to start with :) !
1485487320
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Ah, sorry, I wasn't very clear in my previous post. Try this: /w gm &{template:default} {{name=TRAITS for @{selected|npcd_name}}} {{ [@{selected|repeating_npctrait_$0_name} ](!&amp;#13;/w gm @{selected|repeating_npctrait_$0_desc}) }}
1485487632

Edited 1485487664
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Note, that I would recommend saving this as an ability on a character sheet, name it something like "gm macros". You can still have it on your macro bar at the bottom or refer to it in a global macro via %{gm macros|traits}, but if you put the code itself in a global macro, that html encoding will be eaten everytime you open and resave the macro.
Thanks Scott -- I'm working with this now!
Playing around with this, and unfortunately certain characters in the Traits text (e.g., parenthesis / round brackets) break the results of the macro :( . Really trying to find a way to pull info from Character Sheets without having to keep a number of sheets open (e.g., during battles). &nbsp;Not a complaint -- I love Roll20 and the help here. &nbsp;I'm having trouble pulling it all together. &nbsp;It's not the end of the world though!
1485623006
Jakob
Sheet Author
API Scripter
Brett M. said: Really trying to find a way to pull info from Character Sheets without having to keep a number of sheets open (e.g., during battles). &nbsp;Not a complaint -- I love Roll20 and the help here. &nbsp;I'm having trouble pulling it all together. &nbsp;It's not the end of the world though! I know it's not helping, but *cough* Shaped sheet *cough*.
1485629713

Edited 1485629886
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Ah, that's actually fairly easy to fix. HTML encode the @ (&amp;#64;) of the attribute call(s) in the api command button. This will make it so the attribute is not replaced with its contents until you click the button. So my macro from earlier would look like this: /w gm &{template:default} {{name=TRAITS for @{selected|npcd_name}}} {{ [@{selected|repeating_npctrait_$0_name} ](!&amp;#13; /w gm &amp;#64;&#123;selected|repeating_npctrait_$0_desc&#125;) }}
1485629802

Edited 1485629858
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
New post, as editing will eat those nice html encodings, but I'd try it with out replacing the { and } as I didn't think those broke the buttons. EDIT: realized, I misread your post and you were referring only to parentheses, I've gone in and fixed my example.
Thanks Scott. Jakob said: I know it's not helping, but *cough* Shaped sheet *cough*. I keep thinking that's the way to go. &nbsp;As a former programmer, I love a challenge, but personally I'd rather spend the time playing / developing my game :) . Do you know how well it works with the published modules (e.g., LMoP or SKT)? &nbsp;I asked that question&nbsp; here but haven't seen a response. &nbsp;Thanks!
1485657674
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
No problem, As for the conversions, I know it has handling for it, but I don't know if it is internal to the sheet or requires the companion script.
Thanks again!