Senior Member
Join Date: Dec 2008
Posts: 124
|
I know we can't add to the xml export used for printing, but I'm trying to figure out a way to denote ritual spells in the export. In the very short term, I've created copies of spells, replaced the original, and added *ritual* to the end of the description. In my xsl transform, I find that value, set a variable, and strip it out of the text. I do not enjoy this, and I'm reluctant to want to do it for every ritual spell. So here's the question:
Given that there is a tag on the spell that denotes if it's a ritual, is there an eval script or something else that I can use at a high level to automatically add to the end of the description text? To be clear, I am looking for a solution that is NOT to modify each individual manually, but something that would also work for any new spells that get added by default (i.e. due to the ritual tag). Thanks! DM, exRealmWorker, Character Sheet Hacker, Gamer |
#1 |
Senior Member
Join Date: Sep 2017
Posts: 602
|
Off the top of my head, something like:
Code:
~find every spell with the ritual tag foreach pick in hero from BaseSpell where "Helper.RitualSpel" ~set the name to be the name & ritual eachpick.field[livename].text = eachpick.field[name].text & " (Ritual)" nexteach Throw this eval script onto an adjustment, add that adjustment to the hero. Found an issue with or have a suggestion for the 5e Community Pack? Please post it here at our GitHub. Feel free to stop by the Lone Wolf Development Subreddit, for discussion of any and all LWD products and community efforts! Last edited by Fenris447; February 17th, 2022 at 11:26 AM. |
#2 |
Senior Member
Join Date: Dec 2008
Posts: 124
|
There were some minor updates to the script, but overall, you got me there. I can see the updated description in the app. Thank you Fenris.
The only catch? The XML export does not use that description, or I'm updating the wrong thing. DM, exRealmWorker, Character Sheet Hacker, Gamer |
#3 |
Senior Member
Join Date: Sep 2017
Posts: 602
|
Oh I was going for updating the name of the spell. What are you using for description? My first try for that would be the CustDesc field. But I have no idea if that goes into the printing.
Found an issue with or have a suggestion for the 5e Community Pack? Please post it here at our GitHub. Feel free to stop by the Lone Wolf Development Subreddit, for discussion of any and all LWD products and community efforts! |
#4 |
Senior Member
Join Date: Dec 2008
Posts: 124
|
You got me close enough that I figured it out anyway. Even though it was no joy on the final result.
In the end, the script was: Code:
doneif (tagis[Helper.Disable] <> 0) ~find every spell with the ritual tag foreach pick in hero from BaseSpell where "Helper.RitualSpel" ~set the name to be the name & ritual eachpick.field[CustDesc].text = eachpick.field[descript].text & " *ritual*" nexteach DM, exRealmWorker, Character Sheet Hacker, Gamer |
#5 |
Member
Join Date: May 2021
Posts: 84
|
There may be some differences, since I am messing around in pathfinder, but it seems like the XML custom output just uses the original descript field.
It does seem to use the livename field for the name, and adding a spell descriptor tag (like the good or evil descriptors) using sDescript.Good is added to the xml output. If 5E doesn't have spell descriptors, maybe add a new school tag for Rituals, if that gets added to output. You can limit the changes to output only by checking for state.isoutput like this: Code:
if (state.isoutput <> 0) ~ make whatever changes endif |
#6 |
Senior Member
Join Date: Sep 2017
Posts: 602
|
Quote:
Now that is awesome. Never knew that. I've yet to have a need to alter output only, but what a great tool to have in my back pocket. And perfect for OP's needs! Found an issue with or have a suggestion for the 5e Community Pack? Please post it here at our GitHub. Feel free to stop by the Lone Wolf Development Subreddit, for discussion of any and all LWD products and community efforts! |
|
#7 |
Senior Member
Join Date: Dec 2008
Posts: 124
|
Quote:
Unfortunately, I get an error when I try to set the descript field: Only derived fields can generally be modified via scripts Which upon research *could* be able to be gotten around with a "trustme", but that still throws a compilation error, so maybe not. I've tried the trustme both in and out of the loop to set each spell's descriptor. Which leads all the way down to this script: Code:
doneif (field[pIsOn].value = 0) doneif (state.isoutput <> 1) ~find every spell with the ritual tag foreach pick in hero from BaseSpell where "Helper.RitualSpel" ~set the name to be the name & ritual eachpick.field[sNameMod].text = "*r*" nexteach +1 for Fenris +1 for Ploturo DM, exRealmWorker, Character Sheet Hacker, Gamer |
|
#8 |
Senior Member
Join Date: Sep 2017
Posts: 602
|
sNameMod is used in the community pack a lot, so it's not the best idea. Though you could do
eachpick.field[sNameMod].text &= "*r*" That adds to any existing sNameMod, but might be overridden if sNameMod is changed later in the timing. As for the derived fields, descript isn't a modifiable one. But you had the right answer earlier; set CustDesc to descript + whatever you wanna add on. Found an issue with or have a suggestion for the 5e Community Pack? Please post it here at our GitHub. Feel free to stop by the Lone Wolf Development Subreddit, for discussion of any and all LWD products and community efforts! |
#9 |
Senior Member
Join Date: Dec 2008
Posts: 124
|
Quote:
Unfortunately, the export doesn't use the CustDesc, so it doesn't help me any. DM, exRealmWorker, Character Sheet Hacker, Gamer |
|
#10 |
|
|