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

Sheet Worker Changes on Dev - September 8th, 2017

1504904049
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
We pushed out a small update to sheet workers onto the Dev Server today. We've made a minor change to how default attributes are calculated in order to fix an undocumented problem. While we don't officially support having multiple attributes that share the same name, we've resolved an issue where default attributes were not being correctly set if there were more than one attribute with the same name and one was given a default and the other was not. Additionally we've added two more pieces of information to eventinfo for change events. These will now include eventinfo.previousValue and eventinfo.newValue. These are in the same spirit as the eventinfo.removedInfo that was added last month for the removal of repeating sections. The previousValue will give the value of the attribute before the change event that triggered the eventinfo and newValue will give the current value so that you don't need to getAttrs unless you need other information. Sheet authors, we'd appreciate it if you could take a minute to test your sheet works on dev and make sure there aren't any unexpected interactions or issues we need to fix before this goes live with the Fog and Functionality update.
1504927889
chris b.
Pro
Sheet Author
API Scripter
wow old and new values! This is awesome. This will really speed up calculations since we can calculate the difference, not have to go look up every value on the sheet, which could be 10 or more fields
1504967720

Edited 1504967798
Kryx
Pro
Sheet Author
API Scripter
It's possible to edit multiple fields at once via dragging from the SRD. Will that be supported for previousValue? It it not currently supported for field. It currently only returns 1 field as the changed field even though many could have changed.
1504971882
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Kryx said: It's possible to edit multiple fields at once via dragging from the SRD. Will that be supported for previousValue? It it not currently supported for field. It currently only returns 1 field as the changed field even though many could have changed. Are you saying you're not getting change events for every field changed by a compendium drop?
1504995275
Kryx
Pro
Sheet Author
API Scripter
Steve K. said: Are you saying you're not getting change events for every field changed by a compendium drop? When I drop a greatsword from the compendum I recieve the following eventInfo: { sourceAttribute: "repeating_offense_-ktcgu-7hpkxwifhecrj_properties", sourceType: "player" } All 5 attributes (Propertier, Weight, Damage Type, Item Type, and Damage) are added to the sheet, but the sheet only returns 1 field as being changed. My watch is simple: on(`change:repeating_offense`, (eventInfo) => { console.log('eventInfo', eventInfo); }); Though having 5 triggers for that event would be a very negative feature - it would exponentially increase calculations without additional code preventing multiple calculations in quick sucession.
1505157283
chris b.
Pro
Sheet Author
API Scripter
Things seem to work for the pathfinder sheet. In prod: before we were getting triggers on every field that is updated via compendium, which is why we changed our code around to only look for the Category field, and the other fields written to by the drop are either hidden or an unwatched field. I don't use the change:repeating_xyz at all. I haven't checked in awhile to see if it's still working that way.
1505175000
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hi Steve, These look really useful. I did have a question though. For the update to the 5e sheet, you are testing it as a drop-down sheet option on dev server. Is there a way for us community sheet authors to do similar?
1505176052
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Scott C. said: Hi Steve, These look really useful. I did have a question though. For the update to the 5e sheet, you are testing it as a drop-down sheet option on dev server. Is there a way for us community sheet authors to do similar? I'm not sure I understand your question. The new properties should be available to any sheet when pulling the eventinfo of a change event. I.E. on("change:repeating_inventory:itemmodifiers change:repeating_inventory:equipped", function( eventinfo ) { if(eventinfo.sourceType && eventinfo.sourceType === "sheetworker") { return; } var itemid = eventinfo.sourceAttribute.substring(20, 40); getAttrs(["repeating_inventory_" + itemid + "_itemmodifiers"], function(v) { if(v["repeating_inventory_" + itemid + "_itemmodifiers"]) { check_itemmodifiers(v["repeating_inventory_" + itemid + "_itemmodifiers"], eventinfo.previousValue ); }; }); });
1505177019
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Right, but according to your intro to the 5e OGL sheet thread: In preparation for that we have the beta version live on the Dev Server. We've updated the entire plumbing of the sheet and made a lot of changes. Pro users, it would be very useful to us if you'd copy a game from production to the dev server and let us know if the character sheet updates to the new version without causing any issues for your existing characters. It sounds like the next version of the 5e sheet is just the sheet that is used when you select the 5e ogl sheet on the dev server. Is it possible to do this for other sheets as well?
1505178809
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
I see what you're asking. Yes. When you've updated your sheet(s) and want them to be the default on Dev, I'll update it for you. This will only be until the end of the month though. When the Fog and Functionality update goes live, so will all dev changes, including these sheet changes.
1505182118
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
ah, ok, is that something that we could look at making a standard behavior? Might make rolling out sheet changes less disruptive.
1505185230
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Scott C. said: ah, ok, is that something that we could look at making a standard behavior? Might make rolling out sheet changes less disruptive. We're in the process of making major changes to how the Dev environment is going to work to make collaborating with a growing team much easier. I'll keep this request in mind when these changes start manifesting. 
1505185549
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Thanks Steve
1505644537

Edited 1505644659
Natha
KS Backer
Sheet Author
API Scripter
Steve K. said: Additionally we've added two more pieces of information to eventinfo for change events. These will now include eventinfo.previousValue and eventinfo.newValue. These are in the same spirit as the eventinfo.removedInfo that was added last month for the removal of repeating sections. The previousValue will give the value of the attribute before the change event that triggered the eventinfo and newValue will give the current value so that you don't need to getAttrs unless you need other information. Sheet authors, we'd appreciate it if you could take a minute to test your sheet works on dev and make sure there aren't any unexpected interactions or issues we need to fix before this goes live with the Fog and Functionality update. I did a few tests on the eventinfo.newValue / previousValue novelty, and it seems to work fine. I didn't obvisouly tested all the possibilities on every sheet I made, but everything seem fine. Great new feature! Kudos to the devs. EDIT : PS : and it seems faster (obviously) when it allows to get rid of some getAttrs()
1505715456
Jakob
Sheet Author
API Scripter
The eventInfo.previousValue is very nice. Allows me to do some things I could not have done before without a workaround...
Hi,  Just wondering, now with the new npc sheet spellcasting sections i haven't been able to invoke the "%{selected|repeating_spell-npc_$0_spell}" call as a macro. What would I need to use to I assign spells to macros buttons now? Looks great btw! Cheers. 
The NPC spells on the new version of the 5e OGL character sheet now follow the same attributes as PC spells. So repeating_spell-npc_$0_spell no longer works but repeating_spell-SPELLLEVEL_$0_spell does. You will need to re-add the spells to the NPC and update your macros similar to how you would utilize PC spells.
1506413083

Edited 1506413347
Jakob
Sheet Author
API Scripter
You have merged the dev code (for sheets) into master. Does that mean that these sheet worker changes will go live with the next update? Is it safe to push sheet changes which rely on the new features (newValue/previousValue) already?
1506422692
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Jakob said: You have merged the dev code (for sheets) into master. Does that mean that these sheet worker changes will go live with the next update? Is it safe to push sheet changes which rely on the new features (newValue/previousValue) already? Yes and yes.
1506425936
Jakob
Sheet Author
API Scripter
Steve K. said: Jakob said: You have merged the dev code (for sheets) into master. Does that mean that these sheet worker changes will go live with the next update? Is it safe to push sheet changes which rely on the new features (newValue/previousValue) already? Yes and yes. Very nice, thank you for the quick response.
For some reason everything has changed in all the sheets when I logged on today, and its clearly bugged out. Animal Handling say [animal_handling-core] instead, in red. And the "other proficiencies and traits" box is cleared and says [proficiency_u] instead, also in red... Is this because of something you guys are working on? Or is this a bug on our side. It happens to all my players, in all our games.
1506444712
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Addexio said: For some reason everything has changed in all the sheets when I logged on today, and its clearly bugged out. Animal Handling say [animal_handling-core] instead, in red. And the "other proficiencies and traits" box is cleared and says [proficiency_u] instead, also in red... Is this because of something you guys are working on? Or is this a bug on our side. It happens to all my players, in all our games. We're in the process of rolling out an update and our automated process that handles new translations didn't work. A fix should be income soon.
1506449074
Jakob
Sheet Author
API Scripter
Have the changes actually been rolled out? My new sheet code is live, but eventInfo.newValue spits out undefined from what I can see in the console...
1506449417
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Should be live, yes.
1506450866

Edited 1506452871
Jakob
Sheet Author
API Scripter
Steve K. said: Should be live, yes. I just did some testing, eventInfo.newValue and eventInfo.previousValue don't work on the live server, which breaks some parts of my sheet, unfortunately. EDIT: To be more verbose, code that worked perfectly well on the test server does not work anymore. And just logging eventInfo shows that it has no newValue or previousValue properties. <input name="attr_test" type="text"> <script type="text/worker"> on("change:test", function (event) { console.log(event); }); </script>
1506461305
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Okay, give it a try now. Let me know if you're still seeing any issues.
1506488829
Jakob
Sheet Author
API Scripter
Everything works fine now, thank you.
1506497760
Natha
KS Backer
Sheet Author
API Scripter
Working fine. Very nice feature. Updated all sheet workers that can use the "newvalue" directly, instead of a single getAttrs, on all my sheets, and pushed them to github today.
1506530988
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Steve, I'm still not getting the newvalue/prevvalue in the eventInfo. I've reloaded the campaign, resaved the sheet. Any other ideas?
1506538606
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Scott C. said: Steve, I'm still not getting the newvalue/prevvalue in the eventInfo. I've reloaded the campaign, resaved the sheet. Any other ideas? You might have the old code cached. Try hard reloading or clearing your cache to see if that makes a difference.
1506540002

Edited 1506540182
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hmm, clearing the cache and completely closing the browser didn't help. I still get just this as the logged eventInfo:  Starfinder-Log:  eventInfo: {"sourceAttribute":"repeating_ability_-kuftsinu-xryfmonoxr_damage_checkbox","sourceType":"player"} as the log output. Same result whether I use firefox or Chrome. The game that this is occurring on is  Starfinder Sheet Dev . I'll also try this on my computer at home after work.
1506544586
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
So newValue and previousValue will only show up on change events and removedInfo will only show up on removed events. Outside of that I'm not sure why just you wouldn't be seeing the events.  If you do just a simple use case are you still having no luck? I.E. Jakob's snippet from yesterday?
1506546905

Edited 1506547501
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Ok, figured out the cause of it. It looks like when working with repeating sections, it depends on the change event that you use to trigger the function for whether the previousValue/newValue are passed or not. The below code shows both types: <fieldset class='repeating_prev'>     <input name='attr_track_value' type='text'> </fieldset> <script type='text/worker'> console.log('***===___ Test Starting ___===***');     on('change:repeating_prev',(event)=>{ //This event will not have previousValue or newValue         console.log('change:repeating_prev event = '+JSON.stringify(event));     });     on('change:repeating_prev:track_value',(event)=>{ //This event will have previousValue and newValue         console.log('change:repeating_prev:track_value event = '+JSON.stringify(event));     }); </script> I find the first option to be a much easier one to work with as I don't need to specify all of the attributes that make up a repeating section in the eventhandler and I don't have to edit the eventhandler every time I add/remove an attribute from a section. Thanks, Scott
1506868449
jflo
API Scripter
The  EventInfo section of the Sheet Worker wiki page remains pretty sparse. Can we get the docs updated? It'd be nice if the wiki pages had a "last updated" field at the top so we could decide if we should be looking for a solution in the wiki or here in the forums.
1506994608
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
jflo said: The  EventInfo section of the Sheet Worker wiki page remains pretty sparse. Can we get the docs updated? It'd be nice if the wiki pages had a "last updated" field at the top so we could decide if we should be looking for a solution in the wiki or here in the forums. We'll update this wiki. Thanks for pointing out that this got missed in our documentation sweep for this update.
1506999680

Edited 1507001178
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Steve, any plans to get the eventinfo to be properly passed for all change events?
1507050348
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Scott C. said: Steve, any plans to get the eventinfo to be properly passed for all change events? How do you mean?
1507052668
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
See my bug report just a few replies up: Scott C. said: <fieldset class='repeating_prev'>     <input name='attr_track_value' type='text'> </fieldset> <script type='text/worker'> console.log('***===___ Test Starting ___===***');     on('change:repeating_prev',(event)=>{ //This event will not have previousValue or newValue         console.log('change:repeating_prev event = '+JSON.stringify(event));     });     on('change:repeating_prev:track_value',(event)=>{ //This event will have previousValue and newValue         console.log('change:repeating_prev:track_value event = '+JSON.stringify(event));     }); </script> I find the first option to be a much easier one to work with as I don't need to specify all of the attributes that make up a repeating section in the eventhandler and I don't have to edit the eventhandler every time I add/remove an attribute from a section. Thanks, Scott
1507254225
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Steve, is this intended behavior for the change events to not send the same eventinfo? or is this a bug that needs to be fixed? Thanks, Scott
1507604634
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hey Steve, I know you're busy,but just checking in to see what the final call on this as far as bug vs intended behavior is.
1507653533
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Scott C. said: Hey Steve, I know you're busy,but just checking in to see what the final call on this as far as bug vs intended behavior is. Sorry to not update here. This change should be live. Let me know if you're not seeing the new pieces of info on a repeating section trigger.
1507654761
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Thanks Steve, and sorry for the pestering. I'll report back with an update.
Just a question, is anyone else having an issue where the old section of spells for NPCs are still casting with the proper spell save DC and the new spells section just says 0, even when adjusting the npc spellcaster level, adding a modifier to the spell save dc, or changing the output to spellcard and back to attack?
1508340122
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
EXUNForgiv3n said: Just a question, is anyone else having an issue where the old section of spells for NPCs are still casting with the proper spell save DC and the new spells section just says 0, even when adjusting the npc spellcaster level, adding a modifier to the spell save dc, or changing the output to spellcard and back to attack? I'm assuming you're talking about the 5E OGL sheet. The thread for asking questions about the sheet is available  here . However, to answer your question make sure it's set to be a "SPELLCASTING NPC", that it's "SPELLCASTING ABILITY" is not set to none, that it's "MAGIC CASTER LEVEL" is greater than 0, and that it has a CHALLENGE rating.