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

[PF] Hinky Macro

June 14 (8 years ago)

Edited June 14 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
So, I'm trying to build a customized spellbook macro for use with the Pathfinder sheet. The one that you can trigger with the button is great, but I want a little extra information in mine (like how many spells available out of how many possible, # of a spell prepared in the button). I had one setup like this before the sheet updated but, silly me, I deleted it when the sheet came out with its own. Now that I'm trying to rebuild it, it's not working like it did before.
The macro I have is this (so far):

/w @{character_name} &{template:pf_generic} {{header_image=@{header_image-pf_generic}}} {{character_name=@{character_name}} {{character_id=@{character_id}}} {{name=Spells}}{{test}}{{Lvl 1 Spells @{spellclass-0-level-1-spells-per-day} | @{spellclass-0-level-1-spells-per-day|max} }} {{[@{repeating_spells_-KK9IHhDzxPwexeV0Who_name}](~repeating_weapon_-KK9IHhDzxPwexeV0Who_roll)}
But it gives me this as output:


For some reason, the max field is not populating. I also had to put html entities in for the @, {, and } for some reason when I didn't need those anywhere else (or in the original version of this macro that I deleted). Any of you macro mavens have any ideas?

-Scott
June 14 (8 years ago)
I found "spellclass-0-level-1-spells-per-day_max" within the sheet's HTML; try replacing the vertical bar with an underscore.
June 14 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
hmmm, nope, same output (with the _ in place of the | of course).
June 14 (8 years ago)
Did you remove the HTML entities?
June 14 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
ah, no I didn't. doing that, it gives a number, however it is incorrect. It gives 0, when it should be 2.
June 14 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
The attribute spellclass-0-level-1-spells-per-day exists in the attribute list, and has the correct number in its max field. Which I thought was accessed by adding |max onto the end of the attribute name.

June 14 (8 years ago)

Edited June 14 (8 years ago)
I might try re-entering the information into the corresponding sheet field.

Also, what is it that happens when you use @{spellclass-0-level-1-spells-per-day|max} (i.e with the vertical bar, unescaped)?

Scott C. said:
The attribute spellclass-0-level-1-spells-per-day exists in the attribute list, and has the correct number in its max field. Which I thought was accessed by adding |max onto the end of the attribute name.

Yes; that is how a |max field is called called. However, some sheet authors don't like working with |max fields for various reasons, preferring to instead use a separate Attribute.
June 14 (8 years ago)

Edited June 14 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

Silvyre said:

I might try re-entering the information into the corresponding sheet field.

Also, what is it that happens when you use @{spellclass-0-level-1-spells-per-day|max} (i.e with the vertical bar, unescaped)?
It gives me this (using |max or _max):


Scott C. said:
The attribute spellclass-0-level-1-spells-per-day exists in the attribute list, and has the correct number in its max field. Which I thought was accessed by adding |max onto the end of the attribute name.

Yes; that is how a |max field is called called. However, some sheet authors don't like working with |max fields for various reasons, preferring to instead use a separate Attribute.
True, I know The Strange sheet is that way, but (at least before the update) the pathfinder sheet used the max field for everything that I've ever had to reference. Also, I have another macro

Edit: Ah-ha. Figured out what I did last time to get it to work. For some reason it requires being told which character you are referencing when calling the |max value (at least of these fieds, not sure about others); so it needed a selected| or name| tag.
June 14 (8 years ago)

Scott C. said:

Edit: Ah-ha. Figured out what I did last time to get it to work. For some reason it requires being told which character you are referencing when calling the |max value (at least of these fieds, not sure about others); so it needed a selected| or name| tag.

Oh, of course. That totally slipped my mind. I'm glad you figured it out!
June 14 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
No problem, it slipped mine too (obviously ;) ). Why does it require the tag for the max field?
June 14 (8 years ago)
vÍnce
Pro
Sheet Author
How timely.  I just added this to the beta.  ;-)
Each level shows spells per day/max, and each spell shows number prepared.

June 14 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Nice, Vince
When will it hit prod?
June 14 (8 years ago)
vÍnce
Pro
Sheet Author
Not sure.  We usually try out things in beta and let everyone "chew" on them a bit.  Small simple things(like above) often get out pretty fast.  Larger more complex changes often take more testing.  Wish I could give you a better answer. ;-) 
June 15 (8 years ago)

Edited June 15 (8 years ago)
Vince, to replicate something akin to that wouldn't you use:
/w @{selected|player-name} @{selected|PC-whisper} &{template:pf_generic}
{{character_name= @{selected|character_name}}} {{name=Spellbook}}
{{Level 0 [@{selected|spellclass-0-level-0-spells-per-day}/@{selected|spellclass-0-level-0-spells-per-day|max}] }}

{{[@{selected|spellclass spell-row number stuff/unique id name} [@{selected|spellclass spell row-id or unique id prepped}]](~selected|spellclass spell row number/unique id) =
[@{selected|spellclass spell-row number stuff/unique id name} [@{selected|spellclass spell row-id or unique id prepped}]](~selected|spellclass spell row number/unique id)}} 
And then repeat the last section for each spell(s)? And if someone felt like working on it ( I might in the event of me making a magic user ) they could set up all of the spell books for each class the character has and set up a drop query so that people can choose which class/ level and then click the ability button and *POP* the ability is fired right from the spell book.

Edit: Spaced the code out a little to make it a little easier to read.
June 15 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
That's pretty much what I was doing, but since it's coming to the built in spellbooks, there's no longer a need for it. Also, getting the spell book to work in a drop query would be a lot of html escapes for all those ending '}'. Way easier to just a make a macro that calls each spellbook, and then you've just got 3 token actions (assuming your character has 3 different spellcasting classes) and you click on the one that you want.
It's pretty cool when what people are making macros for eventually becomes an actual part of the entire community (at least those that use the updated sheets). If they keep adding stuff along those lines, then I don't know what I'll do for making macros. lol