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

[Script] [D&D 5e OGL Sheet] Paladin Aura

1585232514
Layton
API Scripter
Update 1.0.6 is done! 1.0.6 Paladins now have a Token Ability (ToggleAuraTarget) that allows them to toggle whether NPCs and Players receive a buff to saving throws from their Paladin Aura. Updated code here!
No worries, just wanted to make sure I didn't screw something up when pasting the code =D
1585311185
Layton
API Scripter
Loads of work done today! Update 1.0.10 is done! 1.0.10 Fixed charactermancer compatibility issues. Reduced chat output when multiple paladins are detected for the first time. 1.0.9 Improved first-time-run message. 1.0.8 In the config there is now a CLEAR ALL button that allows a GM to clear all settings, attributes, and abilities in the game. NPC saving throw regions no longer show on their sheet when all save bonuses are equal to their relevant attribute modifiers. 1.0.7 Fixed status marker config error for clean installs. Grab the latest update here!
1585501285

Edited 1585501472
Layton
API Scripter
Update 1.0.11 - Optimizations! Thanks to a friendly user, it was brought to my attention that the lack of optimization in the API was causing problems in token-heavy games. The new update should help with that. Changes: 1.0.11 Optimized API massively. API will now again only run on the player-ribbon page. Improved code readability. Get the updated API code here.
Layton said: Update 1.0.11 - Optimizations! Thanks to a friendly user, it was brought to my attention that the lack of optimization in the API was causing problems in token-heavy games. The new update should help with that. Changes: 1.0.11 Optimized API massively. API will now again only run on the player-ribbon page. Improved code readability. Get the updated API code here. this code puts my script machine on loop and doesnt complete.
1586184036
Layton
API Scripter
Things Could Get Dicey said: Layton said: Update 1.0.11 - Optimizations! Thanks to a friendly user, it was brought to my attention that the lack of optimization in the API was causing problems in token-heavy games. The new update should help with that. Changes: 1.0.11 Optimized API massively. API will now again only run on the player-ribbon page. Improved code readability. Get the updated API code here. this code puts my script machine on loop and doesnt complete. Thats a problem! I'll backdate right now and try and find the cause. Have you anything that could help me? Are you sure its this script?
Amazing Idea! Looking forward to the shaped version! Thank you for all the hard work.
1586218040
Layton
API Scripter
Things Could Get Dicey said: Layton said: Update 1.0.11 - Optimizations! [...] this code puts my script machine on loop and doesnt complete. I could replicate an infinite loop on version 1.0.10 but not the newest, 1.0.11. Because of this, I shan't be backdating the script as I said I would. If you can give me any details on the issue and check your version I'd be very appreciative, thanks.
1586221689

Edited 1586222450
Layton said: Things Could Get Dicey said: Layton said: Update 1.0.11 - Optimizations! [...] this code puts my script machine on loop and doesnt complete. I could replicate an infinite loop on version 1.0.10 but not the newest, 1.0.11. Because of this, I shan't be backdating the script as I said I would. If you can give me any details on the issue and check your version I'd be very appreciative, thanks. Not really a big deal but it does not measure correctly if the token is larger than a medium. Had a paladin drink a potion of growth and it made him a large. I imagine this situation will not happen often, just thought I would mention.
1586222460

Edited 1586222550
I am getting that token status marker to show but the stats on the sheet stay the same. Is there something I might be doing wrong?
1586251033
Layton
API Scripter
Anthony V. said: Not really a big deal but it does not measure correctly if the token is larger than a medium. Had a paladin drink a potion of growth and it made him a large. I imagine this situation will not happen often, just thought I would mention. That's a really good point, and one that I hadn't considered! I'll add it to the issues.
1586251326
Layton
API Scripter
Anthony V. said: I am getting that token status marker to show but the stats on the sheet stay the same. Is there something I might be doing wrong? I have an idea for what might be causing this. I'll do my best to adjust the code asap and get back to you. For now, was the character built using the charactermancer ? If they were, it's how my API is trying to accommodate that which is causing the issue.
1586272318
Layton
API Scripter
Update 1.0.12 - Large Tokens - Functions properly with 2x2 and larger tokens. - Issues may be present with non-square tokens. Download Here
Layton said: Anthony V. said: I am getting that token status marker to show but the stats on the sheet stay the same. Is there something I might be doing wrong? I have an idea for what might be causing this. I'll do my best to adjust the code asap and get back to you. For now, was the character built using the charactermancer ? If they were, it's how my API is trying to accommodate that which is causing the issue. They were made with the charactermancer yes. And thank you on the quick update!
1586544157
Layton
API Scripter
Anthony V. said: They were made with the charactermancer yes. And thank you on the quick update! This issue should be solved within the next few days :)
1586874691
Layton
API Scripter
Anthony V. said: I am getting that token status marker to show but the stats on the sheet stay the same. Is there something I might be doing wrong? I've been over this issue multiple times and I think its to do with the sheet, not my API. If the "globalsavemod" attribute is being changed by the API (you can see this in the cog tab of your character sheets) but the save bonuses are not updating, there's nothing I can do to fix the issue. If the "globalsavemod" attribute is not being changed, please reply to this and I'll look at the issue from another angle. Note: This has nothing to do with the charactermancer, the issue is now present on all the paladins in my API testing game.
That's been an issue for several months, regarding how API interacts with sheetworkers. Unfortunately all the official threads about the bug have auto-closed :/
1586876824
Layton
API Scripter
Persephone said: That's been an issue for several months, regarding how API interacts with sheetworkers. Unfortunately all the official threads about the bug have auto-closed :/ That sucks. Thanks for the info though, I had no idea.
1586877382
Layton
API Scripter
Update 1.0.13 - Paladin's are Updated on Health Change Code auto-runs when any character's HP is changed to or from 0. Minor bugs fixed to do with NPCs receiving buff. Download Here.
1586877948
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Persephone said: That's been an issue for several months, regarding how API interacts with sheetworkers. Unfortunately all the official threads about the bug have auto-closed :/ The issue has been going on for well over a year by now. I keep hearing rumors of refactoring the sheet, but no official announcement of when this might happen, or even if it will address the issue. I've reported variations on it several times. There are some serious issues with how the official sheet is built that make it difficult to work with.
1586883282
Layton
API Scripter
keithcurtis said: There are some serious issues with how the official sheet is built that make it difficult to work with. Do you usually work with the Shaped Sheet? If so, I've been looking for some help with the Shaped Sheet's repeating modifiers section.
1586889299
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I used to use the Shaped Sheet religiously; it's a powerful sheet. But then development dried up, and I decided to go with the supported sheet as a hedge against future headaches. I might be able to help if the question isn't too technical. :)
1586944608
Layton
API Scripter
keithcurtis said: I used to use the Shaped Sheet religiously; it's a powerful sheet. But then development dried up, and I decided to go with the supported sheet as a hedge against future headaches. I might be able to help if the question isn't too technical. :) Keeping the question as short as possible then, what is the easiest way to create, destroy, and modify repeating attributes in the modifiers section of that sheet? I tried a ridiculous amount of methods to get it working and had no success. Unfortunately, now my Shaped sheet development is at a stop because of it. I could create the attributes, but couldn't edit them. Is there a weird rule that repeating attributes cannot be found with findObjs() ? Thanks for your time by the way.
1586962733
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Ha! I hoped it wouldn't be an API question. I may have a scripter badge, but only through slow, laborious work and some good help. You might want to look at how ChatSetAttr manages this. It can create and destroying repeating items.  Jakob  is the author.
1586965858
Layton
API Scripter
keithcurtis said: Ha! I hoped it wouldn't be an API question. I may have a scripter badge, but only through slow, laborious work and some good help. You might want to look at how ChatSetAttr manages this. It can create and destroying repeating items.  Jakob  is the author. That should be enough info for me to make progress, thanks! :D
@Layton this is a really cool script. Just the indicator is great so far. Looking forward to the end result. Could you just create the repeating attribute the first time the Paladin has someone in their aura and enable it off and on as they go in or out?
FYI, characters other than the Paladin are getting the ToggleAuraTarget action. Is that intended?
1587024655
Layton
API Scripter
Crimson Prime said: FYI, characters other than the Paladin are getting the ToggleAuraTarget action. Is that intended? That is not in intended, and the API actually does far more ty an just the indicator, but the Roll20 5e Sheet is having issues.  I'll go over my work for the ToggleAuraTarget ability, but if you have any more information you can give me about those tokens & their charactersd appreciate it :) 
Ok... that's funny... the only characters NOT getting ToggleAuraTarget are the Paladins :) Thanks again!
1587072872
Layton
API Scripter
Crimson Prime said: Ok... that's funny... the only characters NOT getting ToggleAuraTarget are the Paladins :) Thanks again! That's really weird! I'll work on this tomorrow and post any updates ASAP.
1587113279
Layton
API Scripter
Update 1.0.14 - Bug Fix Fixed an issue with the ToggleAuraTarget paladin ability being given to all non-paladin characters. Download Here.
That worked! There were still ToggleAuraTarget abilities on non-Paladins. The CLEAR ALL option under !pa config cleared them. I'm inclined to suggest that the creation of macros/abilities be config options. For example, !pa config macros !pa config action <Target> <actionName> It was handy to have them automagically appear, but I had renamed one to Aura (to shorten the action bar) and then got another ToggleAuraTarget when the Sandbox restarted. I also don't really need the macros now that the script is set up (except maybe the one global toggle) but if I delete them they'll reappear. Any luck with a global save modifier? Thanks again for the work! 
I also noticed my IDE was complaining about '==' and '!=', and suggested '===' and '!==' to avoid type conversion. My JavaScript-fu is weak but I'm guessing the latter is better, esp in an environment where the comparison is against external data.
1587247149
Layton
API Scripter
Crimson Prime said: That worked!  Glad to hear it! Crimson Prime said: I'm inclined to suggest that the creation of macros/abilities be config options. For example, !pa config macros !pa config action <Target> <actionName> I had renamed one to Aura (to shorten the action bar) and then got another ToggleAuraTarget when the Sandbox restarted.  That's definitely something to work on, so I'll add that to the GitHub issues, thanks. Crimson Prime said: I also don't really need the macros now that the script is set up (except maybe the one global toggle) but if I delete them they'll reappear. This was intentional, but another config option that says "Fix Macro Changes: True/False" definitely couldn't hurt, so I'll add that too :) Crimson Prime said: Any luck with a global save modifier? There is a global save modifier (named "globalsavemod") on the sheet already, but when I set it it doesn't update the values it should be. This isn't an issue with my work, but an issue with the sheet. I could maybe add a work around, but it should be unnecessary :/ Crimson Prime said: Thanks again for the work!  You're welcome! Thanks for the suggestions, they're all extremely helpful, and it's lovely to get such nice feedback on the first API I've publicly released.
Layton said: There is a global save modifier (named "globalsavemod") on the sheet already, but when I set it it doesn't update the values it should be. This isn't an issue with my work, but an issue with the sheet. I could maybe add a work around, but it should be unnecessary :/ So I think the issue starts here. Each saving throw is a button. If you inspect a saving throw button, the value uses global_save_mod. Something like: < button type = "roll" name = "roll_intelligence_save" value = "@{wtype}&{template:simple} " + "{{rname=^{intelligence-save-u}}} {{mod=@{intelligence_save_bonus}}} " + "{{r1=[[@{d20}+@{intelligence_save_bonus}@{pbd_safe}]]}} " + "@{rtype}+@{intelligence_save_bonus}@{pbd_safe}]]}} " + "{{global=@{ global_save_mod }}} @{charname_output}" data - i18n = "intelligence" class = "btn ui-draggable" > Intelligence < /button> The global_save_mod isn't the globalsavemod on the gear page. It's a sum off the Global Save Modifiers under the saving throw buttons. I'm wondering if globalsavemod is even used. So I'm thinking the way to get the Paladin Aura to correctly apply to a saving throw invoked from the D&D 5e Sheet is to add it as a repeating attribute under Global Save Modifiers, and then toggle it on and off.  As Keith mentioned, it should be doable with ChatSetAttr. The create version isn't working. I can't get the syntax right for setting NAME and ROLL. But turning it on and off worked. But once it's created it could be any index, so figuring out how not to create multiples and which index to use or identifying it's ID is still a mystery.  !setattr --sel --repeating_savemod_-CREATE_global_save_mod_name| Paladin Aura|2 !setattr --sel --repeating_savemod_$0_global_save_active_flag|[[1-(1*@{selected|repeating_savemod_$0_global_save_active_flag})]] I haven't grokked the ChatSetAttr code well enough to figure out how to do it programmatically. It looks extraordinarily simple and elegant. But it's time to sleep now and probably have JavaScript nightmares.
Oh... one other feature to consider is turning off the Aura from a Paladin when they go unconscious. 
1587298832
Layton
API Scripter
Crimson Prime said: Oh... one other feature to consider is turning off the Aura from a Paladin when they go unconscious.  This is already done :) the paladin aura re-calculates whenever a character gets to or leaves 0 hit points, and paladins that are at 0 hit points have no aura. Crimson Prime said: If you inspect a saving throw button, the value uses global_save_mod. Weird! I'll look into that attribute and its counterparts. Crimson Prime said: I'm wondering if globalsavemod is even used. It definitely should  be. I know this because if a user manually sets the value on the sheet the saving throw bonuses adjust accordingly. However, when the value is set using the Attribute.setWithWorker() function, the save bonuses are not  updated. That is the sheet issue. I'll definitely look into global_save_mod though, and see if I can adjust that instead. I'm learning how the API interacts with repeating attributes currently.
Oh. That would explain the error I’m seeing an error in the log: Reference: checkSourceForSheetworker is not defined... I’m guessing globalsavemod got renamed to global_save_mod but they missed some. I get the impression that the value on the gear page should simply reflect what is set in the repeating list on the core page, i.e. is it supposed to be an output, not an input?
1587316782
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Layton said: It definitely should  be. I know this because if a user manually sets the value on the sheet the saving throw bonuses adjust accordingly. However, when the value is set using the Attribute.setWithWorker() function, the save bonuses are not  updated. That is the sheet issue. And it is a long-standing issue. If you come up with a programmatic solution, I for one would be really pleased to hear it. This also happens with global damage bonus.
1587462647

Edited 1587466808
Layton
API Scripter
Crimson Prime said: I also noticed my IDE was complaining about '==' and '!=', and suggested '===' and '!==' to avoid type conversion. My JavaScript-fu is weak but I'm guessing the latter is better, esp in an environment where the comparison is against external data. The difference is minimal. In specific cases Roll20 will return the text string 'undefined' instead of the type "undefined". Using 'undefined' == undefined will return true, but using 'undefined' === undefined will return false. I use double equals intentionally because of this and many other small issues in the same vein. For optimization though you make a great point. I'll try and remove them replace the == with === wherever possible.
I notice that the help mentions this: "The API may have bad interactions with non-square tokens." All my player character tokens are round tokens. Will this make the script unusable for me? What kind of "bad interactions" are we talking about?  
1590251762

Edited 1590251833
All images (and therefore tokens) are technically rectangles in the mathematical sense. For circular tokens there are parts that are transparent that you can't see, but they are there. Circles mean that the image usually is a square (an equilateral rectangle). I think the warning is there for games where a horse token (for example) is 1x2 squares in size instead of 2x2.
1590252379
Layton
API Scripter
Jay R. said: I notice that the help mentions this: "The API may have bad interactions with non-square tokens." All my player character tokens are round tokens. Will this make the script unusable for me? What kind of "bad interactions" are we talking about? Exactly as @Rabulias said, when I use the term "square" I mean 1x1 or 2x2 in grid size, not 1x2 etc.  Round tokens that take up a "square" space are fine. 
Thank you both! My paladin just hit level 6 so I am definitely going to install this script ahead of our next session. :)
The script won't work for me. It either silently fails or I get this: Possible infinite loop detected, shutting down.
1590399132
Layton
API Scripter
Jay R. said: The script won't work for me. It either silently fails or I get this: Possible infinite loop detected, shutting down. Dammit I've tried replicating this so many times (so that I can fix it) but it seems to be a bug only others can make appear :'( I'll spend a good bit of time trying to recreate this error and post here if I can find a fix. 
Layton said: Jay R. said: The script won't work for me. It either silently fails or I get this: Possible infinite loop detected, shutting down. Dammit I've tried replicating this so many times (so that I can fix it) but it seems to be a bug only others can make appear :'( I'll spend a good bit of time trying to recreate this error and post here if I can find a fix.  Good luck! I am dying to be able to use this script. :)
1591095252
Layton
API Scripter
Jay R. said: Layton said: Dammit I've tried replicating this so many times (so that I can fix it) but it seems to be a bug only others can make appear :'( I'll spend a good bit of time trying to recreate this error and post here if I can find a fix.  Good luck! I am dying to be able to use this script. :) I've tested with an empty campaign, and with a campaign that only has a few characters in. This has given me no issues. I think the issue could be that the API cannot run fast enough with so many tokens on map or characters in the journal? I'll be working whenever I get some time to reduce the processes in the script, but I'm not sure how much I can do. If you want a quick work-around, you could create a new campaign and move essential characters over, or send any non-essential characters into the archive. I'll post here about any updates.
Layton said: If you want a quick work-around, you could create a new campaign and move essential characters over, or send any non-essential characters into the archive. Just FYI, Archived items (characters, maps, and handouts) are still loaded into the game's memory and can contribute to lag. The Archive mechanism is more for visual cleanup than anything else.
Layton said: Jay R. said: Layton said: Dammit I've tried replicating this so many times (so that I can fix it) but it seems to be a bug only others can make appear :'( I'll spend a good bit of time trying to recreate this error and post here if I can find a fix.  Good luck! I am dying to be able to use this script. :) I've tested with an empty campaign, and with a campaign that only has a few characters in. This has given me no issues. I think the issue could be that the API cannot run fast enough with so many tokens on map or characters in the journal? I'll be working whenever I get some time to reduce the processes in the script, but I'm not sure how much I can do. If you want a quick work-around, you could create a new campaign and move essential characters over, or send any non-essential characters into the archive. I'll post here about any updates. Thanks for the update. I try to get rid of non-essential stuff in my campaign, but it's still unavoidably large. My maps don't usually have tons of tokens, but I definitely have lots of characters and handouts in the journal. I'll try purging some at some point.