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] TokeNotes

1427341451

Edited 1427504737
This script enables the use of bar2 (Or any of the three bars), as a presentation layer for displaying data. Information entered in to the GMnotes section of a token will automatically be displayed to the GM (Or to the players - configurable via the standard roll20 token permissions interface). The script works by creating a specially formatted string (Substituting out problematic characters for unicode look-alikes), overflowing the 'bar2_value' field. This enables us to display popup information when tokens are selected, without expensive API calls. Git: <a href="https://github.com/defamai/Roll20/blob/master/Toke" rel="nofollow">https://github.com/defamai/Roll20/blob/master/Toke</a>... This script also requires my "Common Utilities" script: <a href="https://github.com/defamai/Roll20/blob/master/comm" rel="nofollow">https://github.com/defamai/Roll20/blob/master/comm</a>... This script may also be called programmatically: gmn.SetPopupData( myData, // The string or array to be displayed. token, // The token to operate on. gmn.gmNotesBar, // "bar2_value" by default size); // How far off center (In roughly token-width 70px increments) the message should be offset. Changelog: d4f90e91f464204c7e15f746855bd1e4d1aa01b3: Fixed underflow for smaller tokens, which was preventing the text from displaying. 8566fb781f2ecca22ab31aef928037fcafb359f0: Fixed a bug that was causing unicode characters to break the script. 7eb8b499fc5562ec1314316ef426be8d7f17cb52 : Added line-wrapping functionality.
1427359980
Ziechael
Forum Champion
Sheet Author
API Scripter
I will certainly be testing this.... extremely useful for many many things, thanks! Will let you know any feedback as and when i get chance :)
This is easily one script that should just be incoporated into everything. Honestly its the one thing missing from my games. I had been using the abilities tab as a description for such things etc. Thank you Chris, I hope you rise to script-god amongst Aaron and co.
Nvm it comes up with an error saying B is undefined? I imagine some of the other scripts are causing issues.
Saevar L. said: Nvm it comes up with an error saying B is undefined? I imagine some of the other scripts are causing issues. Odd! I just dropped it in to a fresh campaign, with no issues. Did you remember to grab the "Utilities" script linked in the OP?
Nevermind! I just saw that a B made it into the end of the script without me noticing lol! My bad. I'll test it again now. Since I don't have a chance to test this with players I was wondering if you could clarify on that setting you mentioned so Players can see it too. "(Or to the players - configurable via the standard roll20 token permissions interface)." I assume this just means the control of the player over the current token correct?
1427414034

Edited 1427414467
Saevar L. said: Nevermind! I just saw that a B made it into the end of the script without me noticing lol! My bad. I'll test it again now. Since I don't have a chance to test this with players I was wondering if you could clarify on that setting you mentioned so Players can see it too. "(Or to the players - configurable via the standard roll20 token permissions interface)." I assume this just means the control of the player over the current token correct? Given that the data is displayed via overflowing "bar2", any player that the "See (Or edit, if the player owns the token) bar 2" permission applies to will see that token's popup data. If no players have permissions over that attribute of the token, then no one but you will be able to see that data (Regardless of who controls it).
Yeap it all works perfectly and I see the logic of what you have said now. Thank you so much! It will come in handy so much now for players and myself as a DM in 5E at the least! Super easy to keep track of stuff in combat and key stuff like attack bonuses and Spell DCs etc. Extra stat things that could use tracking.
Love it, will check it out on the morrow when I have time. This is a great find!
The script is supposed to work just by setting the GM Notes info and clicking the token, right? I can't seem to get any result. Got the Utilities script running, but it doesn't seem to be doing anything.
Askren said: The script is supposed to work just by setting the GM Notes info and clicking the token, right? I can't seem to get any result. Got the Utilities script running, but it doesn't seem to be doing anything. Ensure that you have both the Utility script and the TokeNotes script enabled. Check to see if the "bar2" field is populated with a long string of text - If it's not, you've likely mucked something up!
This is what I get
Hmm! Send me a campaign invite, and I'll take a look? It's possible that some part of the import process mangled the unicode necessary for the script to function.
1427438790

Edited 1427443978
Okay, display issue with standard tokens + short text is fixed. New version is up.
1427468611
Spren
Sheet Author
This is probably the only thing that would make me upgrade to mentorship. Could you post a picture of what it looks like with a lot of text? Like a whole page of a book or something. I'm just curious how it handles lots of notes.
1427469361

Edited 1427469481
Sure. It doesn't automatically line-wrap at the moment (I broke up the lines manually), though that's a feature I'll add later today.
1427470095
Spren
Sheet Author
That is awesome and something I've been looking for for a LONG time. Thank you so much for making this!
I noticed a strange thing that breaks the script. I don't understand why, it might be to do with copy/paste. "Assassinates if it acts on first attack During its first turn, the assassin has advantage on attack rolls against any creature that hasnt taken a turn Any hit the assassin scores against a hasn’t hasn't" Breaks the script. Specifically the line with "hasn't" in it seems to do that. If I type it out, it works fine, however if i paste it in. It just breaks everytime. Dunno why. Just a note for those who find it crashes on them like this. URIError: URI malformed at decodeURIComponent (native) at evalmachine. :2851:22 at eval (
I've noticed that when I copy and paste from a PDF that the apostrophe comes across a little weird. I always go through and manually change them that seems to fix things.
1427498665

Edited 1427499027
Fixed: Looks like roll20 is using escape/unescape in place of encodeuri/decodeuri internally. The script now makes use of unescape instead of decodeURIComponent to properly handle characters such as ’ (%u2019). Thanks for all of the feedback, everyone! :)
The only down side of this script is that large amounts of script basically make selection token icons impossible. Since the box is "stretched" to suit the needs of the text contained. It overflows the icon statuses since it will just select the token bar 2 instead. Not a big thing and I doubt it can be worked around outside of keeping word wrapping. As a tip to help anyone who needs word wrapping. Use this site. <a href="http://textmechanic.com/Add-Remove-Line-Breaks.htm" rel="nofollow">http://textmechanic.com/Add-Remove-Line-Breaks.htm</a>... Just set line breaks to about 80 with word wrap on and you'll get easily wrapped text formatted nicely.
1427504648

Edited 1427504707
Yeah, can't really help that - Tis a side-effect of the method utilized. I would love to see official support for this sort of feature in the future, though this hack will have to suffice for the time being. New version is up, adding automatic line-wrapping functionality.
Having never used the API before, but really wanting this script, how exactly do I set it up? Do I just copy/paste the two scripts into the API in my game?
Yes, that is correct.
1427982511
Alicia
Sheet Author
Quick question: By using this mod, are you prevented from assigning a value as normal to the bar?
Alicia G said: Quick question: By using this mod, are you prevented from assigning a value as normal to the bar? The two are mutually exclusive; Either you can set a value in 'bar2' as normal (Even while using this mod), or you can use it to display data (By filling the 'gmnotes' field for the token in question). This mod works by overflowing one of the three bar values (I chose 'bar2', because it is the right-most bar). Thus, one of these must be sacrificed if this presentation layer is to be utilized.
Hey, I was pointed to this thread by another user, seemed to be a lot what I was looking for, and I even got it to work! Thanks. Only thing, I used this as something of a map legend (clicking a token and a map description comes up). It works but the text seems very large and flows of the map. Also, after I deleted the text from the token (in the DM only field), it keeps displaying it on the map (to the side of the token). I have to delete the whole token to get rid of this. Am I missing a refresh thingy or something? Sorry if the question is vague, fairly new to all this.
Great script, Chris! Unfortunately, I'm having the same issue as Fillem. Once text is saved in the GM Notes, there doesn't seem to be a way to alter the pop-up output.
Sorry for the slowish response, been busy! To update the popup text, you merely need to update the gmnotes text. The script should detect this change, and update the popup accordingly. I'm not sure what's behind the issue you two have reported. I can't reproduce it locally. PM me an invite to a campaign in which you're experiencing the issue, and I'll take a look.
No problem Chris, totally understandable! I think I may have actually figured out the problem. I'm assuming it's probably clashing with another script that I have installed, my guess would be Aaron's "isGM" script (which I make use of for his TokenMod script). Is it possible that either this script, or your Utilities script, might conflict with Aaron's isGM and/or TokenMod script?
1430751500
The Aaron
Pro
API Scripter
(Side note: I believe I took that dependency out of the current version of TokenMod)
In that case, I have some more experimenting to do. Thanks for the heads up Aaron! BTW your TokenMod script is amazing !
1430759974
The Aaron
Pro
API Scripter
Thanks! Let me know if you run into any problems, I'll be happy to help with it! =D
I still have Aaron's IsGM script loaded locally for some old legacy scripts I haven't gotten around to updating. Definitely doesn't clash with that. I don't use TokenMod, so I can't comment on that.
Made a suggestion post to officially support this as a function. Anyone believes I have missed anything. Let me know. <a href="https://app.roll20.net/forum/post/1932224/tokenotes-offical-support-for-them/#post-1932224" rel="nofollow">https://app.roll20.net/forum/post/1932224/tokenotes-offical-support-for-them/#post-1932224</a>
Neat, I voted it up. :)
Sorry for not getting back about this sooner! It seems that I was wrong about the problem I'm having. I CAN update the text in the GM Notes section, and the updated text will reflect accordingly. However, if I try to DELETE all of the text in the GM Notes area, that seems to break the connection between the GM Notes section and Bar2. For example, here's the test I just ran: I typed the text string "Test test test" into GM Notes, and it reflected accurately as per the TokeNotes script. I then updated the text to read "Test test test test", which also reflected accurately. I then updated the text to read "Test", which again reflected accurately. I updated the text to read "T", which continued to reflect accurately. I deleted the final "T" from step 4, removing all text from the GM Notes section, but the "T" continued to display beside the token when I had it selected. So it seems removing all text from GM Notes is removing the connection between the GM Notes section and Bar2. I can still manually delete the string of text from Bar2 manually, but I can no longer add text to GM Notes and have it shown as it should with the TokeNotes script. I should also point out that I disabled all other scripts and exclusively tested Utilities and TokeNotes, and the problem didn't seem to go away. I also created a new Test campaign just to be sure, but the same error occurred. Here's the error message that the API Output Console spits out: /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ ReferenceError: gmNotesBar is not defined at evalmachine. :96:10 at eval ( Hope this helps in trying to track down the problem, and thanks again for your work on this!
Found the error for the above. on line 71 replace obj.set(gmNotesBar, ""); with obj.set(gmn.gmNotesBar, "");
Jon M. said: Found the error for the above. on line 71 replace obj.set(gmNotesBar, ""); with obj.set(gmn.gmNotesBar, ""); Sure as sunshine, that worked! Thanks Jon! And thanks again Chris for this amazing piece of work you've put together here!
Whoops, you're right. Fixed, thanks!