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

Using templates and character sheet abilities for macros.

February 12 (5 months ago)

Edited February 12 (5 months ago)
Cron
Pro

Trying to do something similar to this here. However the example is using a ? for a prompted response. I just want a straight reply.

I want to use an image, say of a amulet. When you hover over it, it will show a tooltip Magic Jewelry. Then from a token action macro you can hit the macro and it will sent a list on magic Jewelry whispered to the player that hit it.

I understand the parts but I am not having luck fitting them together. I keep getting the template name but the rest of the info shows as text not in a template.

Here is what I got. I created a npc character sheet named Store. I made an abilities entry Magic Jewelry. From chat I can enter %{Store|Magic Jewelry} to list 2 test rings I put under Magic Jewelry. That works.

Its formatting for the template that has me messed up.

Should be something like this but this does not work. !&{template:default}{{name=Magic Jewelry}} %{Store|Magic Jewelry} 

Goal is to have a few of these. One ability for Armor, one for Melee weapons and so no to sort and give players a list of magic items by selecting an image/npc token of said categories.

Well, sometimes we all make mistakes - did you check the spelling? In what you have written, %{Store|Magic Jewelry} works, but %{Store|Magic Jewerly} doesn't.

But also, if you're using this as a token action, drop the bang at the start. Instead, to whisper it to the player who used the ability, set up a bunch of collections macros, each titled "character" (no quotes), each consisting of the name of one player character, in quotes. Then, give each player the permission for that macro, and only them - now you can begin the token ability macro with /w #character, and it'll whisper it to the relevant player.

February 12 (5 months ago)
Cron
Pro


Tuo said:

Well, sometimes we all make mistakes - did you check the spelling? In what you have written, %{Store|Magic Jewelry} works, but %{Store|Magic Jewerly} doesn't.

But also, if you're using this as a token action, drop the bang at the start. Instead, to whisper it to the player who used the ability, set up a bunch of collections macros, each titled "character" (no quotes), each consisting of the name of one player character, in quotes. Then, give each player the permission for that macro, and only them - now you can begin the token ability macro with /w #character, and it'll whisper it to the relevant player.


Thank you for spotting that, you type something out over and over again your bound to get errors lol. Sadly, still have the problem that is is not giving me a template. 

%{Store|Magic Jewelry} and !&{template:default}{{name=Magic Jewelry}} %{Store|Magic Jewelry} give me same results. Just text. No Template.



First, again, drop the !, it makes the parser not parse the template. Second, what's the content of %{Store|Magic Jewelry}?

February 12 (5 months ago)

Edited February 12 (5 months ago)
Cron
Pro

&{template:default}{{name=Magic Jewelry}} %{Store|Magic Jewelry} gives me the title bar and the list of contents as txt outside of a template.


**Rings**

Ring of Water Walking

Ring of Free Action


Is the contents of Store Abilities - Magic Jewelry. The line at top gives me this.


 I added extra lines to test it. Ring 1-5 and it cuts off instead of giving full list as it would in a template.

Yeah, the template content must be in double braces, so try 

&{template:default}{{name=Magic Jewelry
}} {{%{Store|Magic Jewelry}}}

When you have a template on a line, nothing outside double braces on that line is printed in chat - and when you have a line break outside double braces, what follows is no longer in the template. But keeping things within double braces, you keep things within the template.

February 12 (5 months ago)
Cron
Pro

Ahh, thank you. I was in my testing just putting the braces around the %{Store|Magic Jewelry} not both parts. Its aligning to the right. Do know a way to get it to align to the left?


This is closer to final. I have them as links to page so players and quickly view then and the shows requires attunement. 

Try

&{template:default}{{name=Magic Jewelry
}} {{=%{Store|Magic Jewelry}}}

That should put the template divider (the equation sign places the divider) as far left as it goes, and everything after it will be aligned to its right.

February 12 (5 months ago)
Cron
Pro

Thank you again, that's much better.

February 12 (5 months ago)
timmaugh
Forum Champion
API Scripter

FYI, Cron... when your template wasn't showing after you sent this command:

!&{template:default}{{name=Magic Jewelry}} %{Store|Magic Jewelry}

...it was because you were between solutions. Tuo got your template to show by having you remove the bang at the start of the line... that takes you to one of the solutions. The other solution, which I think you were trying for since your link goes to a solution I worked up a few days back, is to include the:

{&simple}

...tag somewhere in the line.

What's happening is that the bang sends the message to the API sandbox instead of the chat (this is how we run script commands). If a script caught the message, it could construct an output (a new message) to hit the chat. Since no script is picking up the message, nothing gets output. But...

...if you have the Metascript Toolbox installed, you can include {&simple} in a message to output the message to chat. This is useful if, for instance, you need to return a value from something you can't get via a standard Roll20 construction, like the top value of a token (i.e., the Y value of the upper left corner):

@(selected.top)

That uses Fetch. Since metascripts only function in a bangsy message, we have to start it with a bang, then include the {&simple} tag to output the message:

!@(selected.top){&simple}

If you go back to the page you linked, you'll see the option that starts with a bang also includes {&simple}. It might *look* like it's on a separate line because of the way the Roll20 site wraps lines, but it's there.