Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - D&D 5th Edition SRD

Notices

Reply
 
Thread Tools Display Modes
Ambush
Senior Member
 
Join Date: Dec 2008
Posts: 121

Old February 17th, 2022, 10:20 AM
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
Ambush is offline   #1 Reply With Quote
Fenris447
Senior Member
 
Join Date: Sep 2017
Posts: 600

Old February 17th, 2022, 11:22 AM
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
You may need to experiment with the timing, and which fields you're modifying and using (name, thingname, shortname, livename, etc.).

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.
Fenris447 is offline   #2 Reply With Quote
Ambush
Senior Member
 
Join Date: Dec 2008
Posts: 121

Old February 17th, 2022, 01:35 PM
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
Ambush is offline   #3 Reply With Quote
Fenris447
Senior Member
 
Join Date: Sep 2017
Posts: 600

Old February 17th, 2022, 02:16 PM
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!
Fenris447 is offline   #4 Reply With Quote
Ambush
Senior Member
 
Join Date: Dec 2008
Posts: 121

Old February 17th, 2022, 06:36 PM
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
Ambush is offline   #5 Reply With Quote
ploturo
Member
 
Join Date: May 2021
Posts: 84

Old February 20th, 2022, 01:39 AM
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
That way if you want to make a change to the spell's livename (for example) for the xml output that you don't want to show up within the regular app, you can. The changes would show up on all types of 'output', like the printed character sheet(s) and stat blocks too.
ploturo is offline   #6 Reply With Quote
Fenris447
Senior Member
 
Join Date: Sep 2017
Posts: 600

Old February 20th, 2022, 08:13 AM
Quote:
Originally Posted by ploturo View Post
If 5E doesn't have spell descriptors, maybe add a new school tag for Rituals, if that gets added to output.
It doesn't, but that's a good alternate approach! Although you'll forever see that ritual "school" in your own data files, which would bother me. But YMMV.

Quote:
Originally Posted by ploturo View Post

You can limit the changes to output only by checking for state.isoutput like this:
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!
Fenris447 is offline   #7 Reply With Quote
Ambush
Senior Member
 
Join Date: Dec 2008
Posts: 121

Old February 21st, 2022, 08:00 AM
Quote:
Originally Posted by ploturo View Post
You can limit the changes to output only by checking for state.isoutput like this:
Thanks for that addition, Ploturo, that's pretty cool.

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
And this does what I need it to do. It's not the prettiest solution, but it's functional and only shows up on the output xml. I don't love playing with the name field, because it's technically an identifier here, and I also don't love using sNameMod, because I don't know if this will blow up something else somewhere along the way, but it works. And that's good enough for now.

+1 for Fenris
+1 for Ploturo

DM, exRealmWorker, Character Sheet Hacker, Gamer
Ambush is offline   #8 Reply With Quote
Fenris447
Senior Member
 
Join Date: Sep 2017
Posts: 600

Old February 21st, 2022, 11:41 AM
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!
Fenris447 is offline   #9 Reply With Quote
Ambush
Senior Member
 
Join Date: Dec 2008
Posts: 121

Old February 21st, 2022, 04:43 PM
Quote:
Originally Posted by Fenris447 View Post
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*"
I'll update my local implementation with that.

Quote:
Originally Posted by Fenris447 View Post
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.
Unfortunately, the export doesn't use the CustDesc, so it doesn't help me any.

DM, exRealmWorker, Character Sheet Hacker, Gamer
Ambush is offline   #10 Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 06:05 AM.


Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.