PDA

View Full Version : Add Annotations to Any "misc" Fields on the Character Sheet



MostTornBrain
March 20th, 2022, 20:58
Hi,

I made a very small extension that will allow adding formatted-text annotations to any "misc" numeric field on the character sheet. I find over time I often will forget where the values I entered for "misc" actually came from, so this allows one to enter a description, or a link to a section of the rules, etc.

I tested this with PFRPG 1E, but I think it should work with any ruleset as it is adding behavior to the number field from the CoreRPG.

This was mostly done as a learning exercise to get myself more familiar with different features within the FGU Lua scripting environment, but I think others might find it useful.

The extension works by overriding the "basicnumber" template and looks for any writeable fields on a charsheet that contain the string "misc" as part of the name. All of those detected fields will get some extra logic applied to add a small widget in the corner as a visual indication of whether an annotation has been attached or not. Also, the field will have a tooltip of the note's plain text if it exists. One can then add annotations to such misc fields by CTRL-clicking on the field. This will bring up a formatted-text editor and behind the scenes the contents will be saved to part of the charactersheet XML.

Here are some screenshots showing what this looks like in operation:
52096
In the above image, the small triangle in the lower right of a field indicates it can be annotated. If the triangle has a blue halo, it means it currently has a note attached. (I reused the combobox icon so hopefully this will coexist with any themes as it should piggyback on the combobox icon changes made for any theme.)

Here's a screenshot showing the hovertext tooltip of an annotation.
52097

Here's a screenshot showing the formatted-text editor (mostly styled after the MOTD windowclass).
52098

Feedback is welcomed. I figured this out with lots of trial and error, so if you notice I did anything in a less than ideal way, feel free to let me know. I tried to do as much of the parsing and caching of values "up-front" as possible during the initial display of the character sheet to hopefully reduce the processing overhead of adding custom handling to all the "misc" fields.

One potentially "quirky" thing is how I set the title of the formatted-text editor when annotating a field. I use the name of the misc field from the node. In most cases the title ends up self-explanatory (such as "saves.fortitude.misc"), but for the misc fields for all the skills, having a title like "skillist.id-00025.misc" isn't very descriptive. :-D Hopefully one remembers what field they were annotating in this case.

This is currently on github - under MIT license: https://github.com/MostTornBrain/MiscAnnotations
It is also freely available on the Forge: https://forge.fantasygrounds.com/shop/items/567/view

If someone else wants to repurpose this code into an existing extension or do something better with it, feel free.

Cheers,
Brian

bmos
March 20th, 2022, 22:05
This is a great idea!
You could even make the notes a list of notes and each one could have a bonus associated to it which add up to the value in the field iteself.
I had considered doing that last year for my Permanent Bonuses and Ability Drain extension for Pathfinder.

MostTornBrain
March 20th, 2022, 23:00
This is a great idea!
You could even make the notes a list of notes and each one could have a bonus associated to it which add up to the value in the field iteself.
I had considered doing that last year for my Permanent Bonuses and Ability Drain extension for Pathfinder.

Thanks! I'm happy you like it. I love your Permanent Bonuses and Ability Drain extension - I was originally writing custom effects for ability bonuses but didn't like how you don't see "at a glance" what the total is on the character sheet, then I discovered your extension a week or two ago. After seeing how helpful it was, your extension led me to reconsider the types of things that can be done to the character sheet. I missed being able to handwrite notes on a physical piece of paper, and was trying to think of how to add the ability to annotate some places unobtrusively, yet have the notes easily viewable.

There is the "Notes" tab on the character sheet already, of course, but for some reason I always forget it's there and just use it for more general campaign notes or character background info.

Cheers,
Brian

Zacchaeus
March 20th, 2022, 23:04
Nice one.

GKEnialb
March 22nd, 2022, 00:37
Well done! This will be really useful - I vote you put it on the Forge.

MostTornBrain
March 22nd, 2022, 17:48
I put this extension on the Forge.

https://forge.fantasygrounds.com/shop/items/567/view

Please let me know if you notice any issues. I tested with 3.5/PFRPG, 4E, and 5E and it appears to work with all of those character sheets. It should work with any ruleset where the character sheet has numeric fields with "misc" in the underlying name.

Also, as I mentioned previously, I have no issues with someone repurposing this into a larger extension if that makes more sense.

Cheers,
Brian

Morenu
June 7th, 2022, 12:37
This is EXACTLY what I needed! Thanks!

FYI your forge link says "unlisted Product" which makes this hard to find IMO, adding either core rpg or PF1e/3.5 (or whatever it works with) makes it easier to find in forge.

AND, I have a few more boxes that would be awesome to have the note option added to them. these are all boxes I have manually edited at one point for someone and then have to annotate why in the note tab.

53046

(the bottom part is the top of the Combat Tab, my label didn't save)

Thanks again!

rocketvaultgames
February 2nd, 2024, 22:47
The extension still seems to work fine, but I'm getting the following in chat whenever I CTRL-Click to change a note:

"anchor_bottom_utilitybox - DEPRECATED - 2023-05-30 - Contact ruleset/extension/forge author"