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

keithcurtis said: I have confirmed that Supernotes is now available for one-click install. The configurations for various sheets have been made user-selectable as detailed in the documentation on the API page and on the first post of this thread. If you would like me to add any roll templates/sheets, please contact me in this thread or by PM. Just grabbed it, installed (disabled the old one), and got an API error about scripts being disabled due to no scripts existing for my campaign. So I re-enabled the old, non-one-click version.
1592353096
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Well that's frustrating. I'll ask about and see If I can find out the problem.
1592367879
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Still investigating. The code is correct. It works when using the import button on the API page, or when copying and pasting manually, but not when choosing from the one-click drop down.
keithcurtis said: Still investigating. The code is correct. It works when using the import button on the API page, or when copying and pasting manually, but not when choosing from the one-click drop down. That's weird. I hope you can figure this out. I always prefer running scripts from the one-click so I get the updates automatically.
1592402653
The Aaron
Roll20 Production Team
API Scripter
It seems to be affecting all 1-click scripts that were added yesterday.
1592411782
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Supernotes appears to be installing properly from One-Click now, as do others. At least in the test game I set up.
keithcurtis said: Supernotes appears to be installing properly from One-Click now, as do others. At least in the test game I set up. Just re-enabled the one-click and it's working fine now! I cannot stress how darn useful this script is to me. I use it to handle monster knowledge checks, to provide map notes complete with read-aloud text (in conjunction with the SendText snippet) and Roll20AM commands, and to deal with any info I want chunked and sent to Chat efficiently. 
1592452398
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Great to hear!
1594408392

Edited 1594408427
Keith, this is great! I have the "Send to Players" toggled to true, but the buttons are not showing up at the bottom of the roll template.. This is after calling supernotes via `!gmnotes` and having my notes  token selected with the information in the GM Notes  section. I'm probably missing something simple...
1594412737
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hm. Try toggling it off and on once more. I just installed on a fresh game and couldn't duplicate. The command is: !gmnote --config|sendtoPlayers
Tried running the config command again. Additionally, I removed the link I had in the notes and disabled all API scripts (Except SplitArgs) to test. Still no luck getting the footer links to show up.
1594417417

Edited 1594418088
I found the issue! I was actually typing in the following as the command phrase for the call: !gmnotes It was recognizing the !gmnote  portion due to the .match() function being used on the if statement validating the command. I figured out a simple update to the regex that will handle scenarios where the user tacks on anything except white space immediately after !(gm|pc)note . on('chat:message', function(msg) { if ('api' === msg.type && msg.content.match(/^!(gm|pc)note(?!\S)/) && playerIsGM(msg.playerid)) { let match = msg.content.match(/^!gmnote-(.*)$/);
1594435423
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Good catch! Thank you! I'll put that in the update.
1594435880

Edited 1594436345
GiGs
Pro
Sheet Author
API Scripter
Why are the two match statements in that snippet different? They wont catch the same code. It looks to me like the match on the if line will be false for the match in the second line, so if it does start !gmnote- , it will never reach that line. Maybe this would be better? if ('api' === msg.type && msg.content.match(/^!(gm|pc)note\b/) && playerIsGM(msg.playerid)) { let match = msg.content.match(/^!gmnote-(.*)$/); The \b looks for an end of word, so will match !gmnote and !gmnote- , but not !gmnotes . (And the pc versions too.) I havent looked deep into the code, I'm assuming that second match is specifically for gmnotes and is meant to exclude pcnotes?
Glad to help!
Hi Keith! Been working with Supernotes a lot; I love this script so much!! Found another issue that could be fixed in the next update. I've been copying in text from the 3rd edition Forgotten Realms campaign book PDF I bought off DriveThruRPG and it's loaded with malformed URIs.  In the current version of Supernotes, you're getting the notes, decoding the unicode, then decoding the URI.. . forEach ( o   =>  {     if  ( regex ) {         message  =  _ . filter ( decodeURIComponent ( decodeUnicode ( o . get ( 'gmnotes' ))). split ( / ( ?: [ \n\r ] + | <br \/? > ) / ), ( l )  =>  regex . test ( l )). join ( ' \r ' );     }  else  {         message  =  decodeURIComponent ( decodeUnicode ( o . get ( 'gmnotes' )));     } I was getting a `malformed URI` error that resulted in the code crashing. Turns out this was happening due to the URIcomponents being escaped. Here's my fix for the issue: . forEach ( o   =>  {     let   gmnotes  =   decodeURIComponent ( unescape ( decodeUnicode ( o . get ( 'gmnotes' ))));     if  ( regex ) {         message  =  _ . filter ( gmnotes . split ( / ( ?: [ \n\r ] + | <br \/? > ) / ), ( l )  =>  regex . test ( l )). join ( ' \r ' );     }  else  {         message  =   gmnotes ;     }     whom  =   o . get ( 'name' ); }); Thanks!
1594654208
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I won't be able to check this out and get it into the new version that drops tomorrow, but I will look into it. Tomorrow's version will correct for accidental pluralization of the command, and will let you choose first image, all images or indexed image for tokens which have multiple images in the bio field. I discovered while testing with the drow that some monsters have multiple artwork.
Sweet! Just wanted to pass the fix along since it worked for my use case.
1594701534
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Can you PM me with some sample data that was breaking before? I'd like to test against that and other use cases before I commit the code. Thanks in advance.
1594861109
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Updated version in one-click (0.0.5). I have expanded the use cases for the image tag. This will mean that --image works slightly differently than before, but it's now doing what it should have been doing according to the docs, returning the first image. There are now three options for the image parameter: --image  Pulls first image from the bio field of the character assigned to a token, if any exists. Otherwise returns notice that no artwork is available --images  Pulls all images from the bio field of the character assigned to a token, if any exist. Otherwise returns notice that no artwork is available --image[number]  Pulls indexed image from the bio field of the character assigned to a token, if any exist. --image1 will pull the first image, --image2 the second and so on. Otherwise returns first image if available. If no images are available, returns notice that no artwork is available
I'll pull an example from the PDF I was using tomorrow and send it to you!
Did some more testing this morning and I cannot seem to replicate the issue. I'm using the latest one-click build in my test campaign.
Keith, a question. Is it possible for players to have access to the !pcnotes --token command? I want to be able to put a token down on a map, populate the GM notes field with info, and have the party be able to send that info to chat themselves by running !pcnotes --token on the given token. Is this feasible?
1595651557
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Anybody can run !pcnote, or !gmnote, for that matter. The security is that you can only run it on a token you control. I use !pcnote for making  Map Pins .
keithcurtis said: Anybody can run !pcnote, or !gmnote, for that matter. The security is that you can only run it on a token you control. I use !pcnote for making  Map Pins . Ah, so by implication, that means the token has to be linked to a character sheet, right? It can't just be a freestanding token on its own?
1595653092
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Correct. But you can link as many tokens to a single sheet as you want. My campaign city map has about 80 tokens, each with a symbol denoting what kind of location is being described, but only one sheet, called "Site". This sheet has a Token Action button linked to an ability called "Info". This abilitiy is just "!pcnote". Here is a video of the setup.
1595653269

Edited 1595654040
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hmm. Now that I think about it, it doesn't need to be attached to a character sheet. I only do it for the convenience of having the automatic token action button. You can use a generic token, and just type !pcnote into chat. You still don't need to be a gm. Just make sure to give permissions on the token to "All Players".
keithcurtis said: Hmm. Now that I think about it, it doesn't need to be attached to a character sheet. I only do it for the convenience of having the automatic token action button. You can use a generic token, and just type !pcnote into chat. You still don't need to be a gm. Just make sure to give permissions on the token to "All Players". Ok, that's what I had figured. But last night, I had a token representing a city on a map, with info in the notes field. I gave my players the !pcnote --token command in a macro, and set permissions on the token to all players. But nothing happened. Maybe I'll try linking it to a character sheet (which I routinely do for dungeon notes and other uses of Supernotes).
1595692145
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Try testing with a  Dummy Account . It's much quicker and less hassle than waiting till you can get your players available.
I just tested with one of my players, and it still doesn't work. I created a character named Map Pins, assigned control to all players. Then selected a token, assigned it to represent Map Pins, and changed its name to a specific map location. Put some info in the token's GM Notes field. My player tried !pcnote and !pcnote --token on the token, and nothing happened. She was unable to get the info to appear in Chat, though I could.
1595780210
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hmm. Did a little checking. Apparently I do ask for GM status. Apparently none of my players has been using map pins since I switched over, and I've gotten no reports. :/ I think you can do a quick fix by grabbing the code from the Roll20 repo and do a manual install, changing line 25 from:         if ('api' === msg.type && msg.content.match(/^!(gm|pc)note\b/) && playerIsGM(msg.playerid)) { to         if ('api' === msg.type && msg.content.match(/^!(gm|pc)note\b/)) { but I haven't tested. I'll put that into the next pull, if I can find the time to test.
keithcurtis said: Hmm. Did a little checking. Apparently I do ask for GM status. Apparently none of my players has been using map pins since I switched over, and I've gotten no reports. :/ I think you can do a quick fix by grabbing the code from the Roll20 repo and do a manual install, changing line 25 from:         if ('api' === msg.type && msg.content.match(/^!(gm|pc)note\b/) && playerIsGM(msg.playerid)) { to         if ('api' === msg.type && msg.content.match(/^!(gm|pc)note\b/)) { but I haven't tested. I'll put that into the next pull, if I can find the time to test. Thanks, Keith! I'll try the quick fix tonight and see if it works. Edit: Also, do you have a link to the 0.0.5 version? On github, all I see is 0.0.4.
1595791785
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The link in the top post has now been updated to point at the copy in my fork of the Roll20 Repo. (or you can get the latest One Click version from the Roll20 repo itself.) When I started scripting, I really didn't know how Github worked. I still am learning.
keithcurtis said: The link in the top post has now been updated to point at the copy in my fork of the Roll20 Repo. (or you can get the latest One Click version from the Roll20 repo itself.) When I started scripting, I really didn't know how Github worked. I still am learning. Thank you! I have the One-Click version already, but I need the github version to try out that fix you suggested.
keithcurtis said: Hmm. Did a little checking. Apparently I do ask for GM status. Apparently none of my players has been using map pins since I switched over, and I've gotten no reports. :/ Typical players. ;) I think this is why I'm compulsive about checking in with my players and making sure they're using the options available to them. I found out after like a year that one of my players hadn't been using the macro quick bar, and wasn't even sure what the rest of us were talking about when we kept telling him to drag attacks and spells from his sheet to the quick bar. :D
Your fix worked, Keith! Thank you. Now my players can use !pcnote to access info on map tokens, effectively giving us the map pin functionality I've been wanting since I started using Roll20. This is going to be so useful when they hit the big city in my campaign!
1595803288
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Before Supernotes, I used to use three different scripts to get its functionality. PCNote used to be standalone and didn't have that restriction. Thanks for helping to winnow that out.
1595804915
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Pull request submitted. This should be live on Tuesday if all goes well.
keithcurtis said: Pull request submitted. This should be live on Tuesday if all goes well. Excellent, and happy to help. It's such a great script.
1595825184

Edited 1595825218
Could you add a nullcheck when the GM Info field is empty? I know you're not supposed to use it under that circumstance (maybe show a 'GM Field is empty msg'), but it helps not having to reset the API Sandbox everytime that happens (it triggers an URI malformed error).
1595827900
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I'll look at it. I haven't run into that error myself though. I get an empty roll template, of course, but no API error.
Maybe it's something else then. I'll try to reproduce the issue.
1597947562

Edited 1597947617
I am unable to get my images that macro within chat to send to players in their chat. I have it set to true. Got the macros down to work for me as the gm, but my players cannot see linked images within their own chat box. using macro !pcnote avatar to link it. !gmnote also works. 
1597948175

Edited 1597948281
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi Preston! You need the double dashes in the macro: !pcnote --avatar It took me a while to see the problem. I was looking right past it. :D You can also run  !pcnote --config and turn the footer on. That will give you a link to preview the image as GM before sending to players. I use that method to prevent Horrible Surprises, such as putting the wrong art in the character.
Ran into an error on Friday night where using Supernotes on a token with info in the GM field crashed the API. Couldn't figure it out for the life of me, then narrowed it down tonight to the fact that my text had a ç in the body (as in the word façade). Replacing it with a regular c fixed the issue. It's not major or anything, just hilarious that the little cedille could cause so much trouble!
Ran into a similar problem, but not with ç but rather ä/ö/ü. But what I thought was rather strange is that the script only seems to have a problem with them when they are in the tokens gm notes and i want to call them with !gmnote --token. --charnote and --bio seem to work just fine with them in the corresponding field? And I was wondering why, because I couldnt see a problem with the script itself?
1603208244
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Yeah, I can repeat the problem. I'll see what I can discover.
1607201610
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
It took me a while (I had a huge backlog of freelance and advertising work to get through), but with the Aaron's kind assistance, the problem has been identified and fixed. I'll try and get it into the next script pull.
keithcurtis said: It took me a while (I had a huge backlog of freelance and advertising work to get through), but with the Aaron's kind assistance, the problem has been identified and fixed. I'll try and get it into the next script pull. Thanks! Feature request for the next version of Supernotes: the ability to hide the character sheet name when using the bio image option. I currently like to throw that bio image into chat when my players first encounter a monster they haven't seen before, but I don't want them to see the character sheet name ("chuul" or "void dragon" or whatnot) for that monster until they've made a monster knowledge check. Being able to just show them the bio image without any name would be great.
1610344852
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That would be handy. I ran into that issue myself just yesterday. I'll see about putting it in.