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 0.2.0 - Now with Genre Templates!

1667457090

Edited 1682013520
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The basic functionality of the Supernotes remains the same, but this thread introduces a major new feature. Any Supernotes command can receive a template parameter, allowing you to choose from between 14 custom templates that should cover most common genres. You can of course, continue to use any of the supported sheet roll templates:  Default,  D&D 5th Edition by Roll20,  5e Shaped, Pathfinder by Roll20,  Pathfinder Community,  Pathfinder 2e by Roll20, and  Starfinder. How to use The new templates can be accessed by adding:  --template|templatename directly after the main command. You can then add any of the standard Supernotes commands to display art, token, bio, avatar and so forth. Examples: !gmnote --template|crt !pcnote --template|notebook --bio !pcnote --template|faraway --tokenimage All templates can use the "Send to Players" and "Make Handout" buttons at the bottom, though any note used to create a handout will use the default styling of a Roll20 handout. The text editor is too finicky otherwise and will result in better display across platforms and devices. I have tried to use web-safe fonts throughout (Mod scripts cannot use Google Fonts). As a bonus, all templates (including roll templates) now convert buttons to inline buttons, to eliminate the "Big Pink Button" syndrome. List of Templates generic . Just the facts, Ma'am. Nothing fancy here. dark . As above, but in reverse. crt . Retro greenscreen for hacking and cyberpunk. Or for reports on that xenomorph hiding on your ship. notebook . You know, for kids. Who like to ride bikes. Maybe they attend a school and fight vampires or rescue lost extraterrestrials gothic . Classic noire horror for contending with Universal monsters or maybe contending with elder gods. apoc . Messages scrawled on a wall. Crumbling and ancient, like the world that was. scroll . High fantasy. Or low fantasy—we don't judge. lcars . For opening hailing frequencies and to boldly split infinitives that no one has split before! faraway . No animated title crawl, but still has that space wizard feel. steam . Gears and brass have changed my life. western.  Return with us now to those thrilling days of yesteryear. dragon.  Three-fivey style wizard.  A fifth edition of templates. strange. Other kids who ride bikes and play D&D. One of those "worth a thousand word" things: This is now in One-Click and the gist test code link has been removed. Minor update : Templates have been exposed to other scripts under the object "Supernotes_Templates" Second post contains the original documentation for Supernotes 0.1.x
1667457097
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Full documentation (when this goes to One-Click, I'll consolidate the documentation) This script pulls the contents from a token's GM Notes field, as well as other fields that are not usually accessible to macros. If the token represents a character, you can optionally pull in the Bio or GM notes from the character. It can also return graphics and tooltip info. The user can decide whether to whisper the notes to the GM or broadcast them to all players. There is an option to add a footer to notes whispered to the GM. This footer creates a chat button to give the option of sending the notes on to the players. Finally, you can direct the note either to chat, or to a named handout. Images, API Command Buttons, Links and most special characters should pass through without issue. Images written in the markdown form of [x](imageURL) should parse correctly in both chat and handouts. This script as written is optimized for the D&D 5th Edition by Roll20 sheet, but can be adapted for most common sheets using the Configuration command below. Commands !gmnote  whispers the note to the GM !pcnote  sends the note to all players !selfnote  whispers to the sender of the command Parameters -- token  Pulls notes from the selected token's gm notes field. This is optional. If it is missing, the script assumes --token. This option does not require the token to have an associated character. -- charnote  Pulls notes from the gm notes field of the character assigned to a token. -- bio  Pulls notes from the bio field of the character assigned to a token. -- avatar  Pulls image from the avatar field of the character assigned to a token. -- 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 -- tooltip  Pulls the tooltip from a selected token. This option does not require the token to have an associated character. -- tokenimage  Pulls all the image from a selected token. This option does not require the token to have an associated character. -- notitle  This option suppresses the title in the chat output. It is useful for times when the GM might wish to show an image or note to the player without clueing them in wha the note is about. For instance, they may wish to reveal an image of a monster without revealing its name. This parameter can be added to any command. It is the only paramater for which this is true. Example !pcnote --image --notitle will pull the first of any images from the token's associate character sheet and send it to the chat without a title. --notitle may be added to the command in any order. -- id  supply this with a token id, and the script will attempt to read the notes associated with a specific token, or the character associate with that token. There is no space between --id and the token id. Only one token id may be passed. -- handout|Handout Name|  If this is present in the arguments, the note will be sent to a handout instead of chat. This can allow a note to remain usable without scrolling through the chat. It can also be used as a sort of floating palette. Notes in handouts can be updated. Running the macro again will regenerate the note. The string in between pipes will be used as the name of the note handout. If no handout by that name exists, Supernotes will create one and post a link in chat to open it. The title must be placed between two pipes.  --handout|My Handout|  will work.  --handout|My Handout  will fail. A note handout automatically creates a horizontal rule at the top of the handout. Anything typed manually above that rule will be persistent. Supernotes will not overwrite this portion. You can use this area to create Journal Command Buttons to generate new notes or to give some context to the existing note. All updates are live. -- help  Displays help. -- config  Returns a configuration dialog box that allows you to set which sheet's roll template to use, and to toggle the 'Send to Players' footer. Examples: !pcnote --bio  will send the contents of the selected characters bio to the chat for all players to see. !gmnote --charnote  will whisper the  character's  GMnotes to the GM This script will work well with the following Stupid Tricks (and many more): Invisible Tokens - The Notes Token (API version) Invisible Tokens - The Control Token Invisible Tokens - The Door Control Chat Menus Map Pins It also has good synergy with the Reporter script (also on One Click) Configuration When first installed, Supernotes is configured for the default roll template. It will display a config dialog box at startup that will allow you to choose a roll template based on your character sheet of choice, as well as the option to toggle whether you want the 'Send to Players' footer button to appear. You will need to edit the code of the script if you wish to create a custom configuration, or contact keithcurtis on the Roll20 forum and request an addition. The pre-installed sheets are: Default Template D&D 5th Edition by Roll20 5e Shaped, Pathfinder by Roll20 Pathfinder Community Pathfinder 2e by Roll20 Starfinder See previous post for custom genre templates For reference, here are the roll templates used for each sheet: Default Template const template = 'default'; const title = 'name'; const theText = ' '; D&D 5th Edition by Roll20 const template = 'npcaction'; const title = 'rname'; const theText = 'description'; 5e Shaped const template = '5e-shaped'; const title = 'title' const theText = 'text_big' Pathfinder Community const template = 'pf_generic'; const title = 'name' const theText = 'description' Pathfinder Official by Roll20 const template = 'npc'; const title = 'name' const theText = 'descflag=1}} {{desc' Pathfinder 2e by Roll20 const template = 'rolls'; const title = 'header' const theText = 'notes_show=[[1]]}} {{notes' Starfinder by Roll20 const template = 'sf_generic'; const title = 'title' const theText = 'buttons0' 0.0.5 Expanded utility of "--image" parameter 0.0.6 Added auto-configuration for most popular sheets 0.0.7 Fixed for breaking of certain accented characters and diacriticals 0.0.8 Added --notitle parameter 0.0.9 Added !selfnote 0.0.91 Improved pathfinder template usage, 0.1.0 Added the ability to use token id 0.1.1 Added Handout feature 0.2.0b Added Custom genre templates
1667457472

Edited 1667457882
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Reserved for future use, but for now, some more images . All imagery belongs to original copyright holders and is used for demonstration purposes.
1667466417
Oosh
Sheet Author
API Scripter
I am eternally jealous of your design genius, Keith. "Oh, it's just v0.2.0 of a little script", he says, quietly outclassing almost every roll template design on Roll20.
1667483855
timmaugh
Pro
API Scripter
Me, looking at pretty much anything Keith designs:
1667672674
Kurt J.
Pro
API Scripter
@keithcurtis - These are amazing :) any chance you could expose the templates object for other APIs to grab? I'd love to make using these templates an option in ScriptCards if the user has Supernotes installed as long as you are OK with that :)
1667674986
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I could try, but with my "mad doctor working in the lab late one night" style of programming, it might be difficult. Also, I don't know how to do that! :D Please take a look at the code and see if you can suggest how this might be accomplished. The CSS is in an object starting at line 88. It's basically designed to allow you to plug in a title and a "message" or "everything else".
1667676574

Edited 1667677917
Kurt J.
Pro
API Scripter
keithcurtis said: I could try, but with my "mad doctor working in the lab late one night" style of programming, it might be difficult. Also, I don't know how to do that! :D Please take a look at the code and see if you can suggest how this might be accomplished. The CSS is in an object starting at line 88. It's basically designed to allow you to plug in a title and a "message" or "everything else". I'm sure TheAaron would have a better way of doing it, but I moved the "let templates = {...}" section to right after the API_Meta (and changed templates to Supernotes_Templates): var API_Meta = API_Meta || {}; API_Meta.Supernotes = { offset: Number.MAX_SAFE_INTEGER, lineCount: -1 }; { try { throw new Error(''); } catch (e) { API_Meta.Supernotes.offset = (parseInt(e.stack.split(/\n/)[1].replace(/^.*:(\d+):.*$/, '$1'), 10) - (4)); } } let Supernotes_Templates = { generic: { boxcode: `<div style='color: #000; border: 1px solid #000; background-color: white; box-shadow: 0 0 3px #000; display: block; text-align: left; font-size: 13px; padding: 5px; margin-bottom: 2px; font-family: sans-serif; white-space: pre-wrap;'>`, titlecode: `<div style='font-weight:bold; color:#fff; background-color:#404040; margin-right:3px; padding:3px;'>`, textcode: "</div><div><div style='padding:3px;'>", buttonwrapper: `<div style='display:block; margin-top:5px'>`, buttonstyle: `style='display:inline-block; color:#ce0f69; background-color: transparent;padding: 0px; border: none'`, playerbuttonstyle: `style='display:inline-block; color:#ce0f69; background-color: transparent;padding: 0px; border: none;'`, buttondivider: ' | ', handoutbuttonstyle: `style='display:inline-block; color:#ce0f69; background-color: transparent;padding: 0px; border: none;'`, footer: "" }, etc... and then changed what used to be on line 88 to: let templates = Supernotes_Templates; to avoid having to change anything else in the code since I changed the variable name to "Supernotes_Templates" to make it more friendly to other name scopes. It was a fairly simply matter on the ScriptCards end to add a way to override the default formatting to use one of your templates by name, withe the result being:
1667680549
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I think that should work. Today is game prep for me, but I'll make those changes, and if I run into any issues, I'm sure we could hammer them out.
1667867619
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Kurt: Made the changes and all seems to be good. Script Cards should be able to call these, plus whichever extras I add. It's too late for this week's PR, but it should be in One Click next Tuesday.
1667870618
Kurt J.
Pro
API Scripter
keithcurtis said: Kurt: Made the changes and all seems to be good. Script Cards should be able to call these, plus whichever extras I add. It's too late for this week's PR, but it should be in One Click next Tuesday. Awesome :) Thanks so much Keith. Your CSS work is just beautiful.
1667876579
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Aw, gee whiz. :) If you can think of a major genre that is not covered, let me know and I'll try to sneak something in before the PR.
1667909020
David M.
Pro
API Scripter
This will be a fun new addition to Scriptcards. Those templates are great, Keith, and thanks to you both!
1667942763
Kurt J.
Pro
API Scripter
keithcurtis said: Aw, gee whiz. :) If you can think of a major genre that is not covered, let me know and I'll try to sneak something in before the PR. Hmm... The only one that comes to mind right away would be a "western" theme (Deadlands or Weird Frontiers type games). Also, if you get the chance, can you update the temporary code location so I can test with the new version? I'd like to try to update with next week's PR as well.
1667943658
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Kurt J. said: keithcurtis said: Aw, gee whiz. :) If you can think of a major genre that is not covered, let me know and I'll try to sneak something in before the PR. Hmm... The only one that comes to mind right away would be a "western" theme (Deadlands or Weird Frontiers type games). Also, if you get the chance, can you update the temporary code location so I can test with the new version? I'd like to try to update with next week's PR as well. Oops. Thought I had done that. It has been updated.
1667949797

Edited 1667949896
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Kurt J. said: Hmm... The only one that comes to mind right away would be a "western" theme (Deadlands or Weird Frontiers type games). How's this?
KeithCurtis, Where is the Beta code. I'd be happy to test it. Looks great! thx
1667955021

Edited 1667955051
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
joeuser said: KeithCurtis, Where is the Beta code. I'd be happy to test it. Looks great! thx Hi joeuser! Bottom of the first post. But here is the link .
KeithCurtis,  thank you. I missed it.
1668037146
Kurt J.
Pro
API Scripter
keithcurtis said: Kurt J. said: Hmm... The only one that comes to mind right away would be a "western" theme (Deadlands or Weird Frontiers type games). How's this? Looks good to me :) I thought of a couple more: Cyberpunk (neon, bright colors, etc.) and Shadowrun (near-black circuitry, dark red hilights, probably similar to "crt", but with a different color scheme and more "detail bits"... I know that isn't very descriptive, lol)
1668038810
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Cool. I'll work on something along those lines for the next update.
Super cool! Thanks for this! It works great with ScriptCards. I was able to edit the styles and the changes took. One question. How can I add a style, say SubTitle or Table-Header or something, then apply the style to specific text from within a ScriptCard script? Not sure if this is a Keith or Kurt question, but there it is. Thanks!
1668285982
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Probably a Kurt question. Supernotes is built to pass through most in-line CSS and HTML, but I didn't design the templates with Script Cards in mind. There are only two insertion points in the templates as used by Supernotes: Title and Message (description).
1668668643
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Now in one-click! Upcoming templates: wizard dragon
I came to the forums wondering why my !gmnote was displaying oddly (top part default box formatting, bottom part simple text formatting, some end parts not even showing) and am pleasantly surprised to see this update! Switched to using a template (generic for now) and my problem is mostly solved. Some of the longer gmnotes spill out of the template. Other feedback: could you make the in-note link color for templates stand out a bit more? The gray/black in the generic template blends in with the text. Thank you! You are an inspiration.
1668736764
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Thanks Danielle! Out of curiosity, I am concerned about the problems you reported with the regular template. Can you give any repro steps so I can track down what's going on? Name of sheet and or chosen roll template Sample text that is not passing correctly Supernotes is basically passing on HTML and inline CSS from the original source, and though it does some cleanup, there's alsways the possibility of the source overriding the styles set by the script.
1668736905
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The next One-Click version will correct a small custom templates error where using the "Show to Players" button displaying in a note that has just been sent to players. Script merges may be delayed due to the American holiday next week.
keithcurtis said: Thanks Danielle! Out of curiosity, I am concerned about the problems you reported with the regular template. Can you give any repro steps so I can track down what's going on? Name of sheet and or chosen roll template Sample text that is not passing correctly Supernotes is basically passing on HTML and inline CSS from the original source, and though it does some cleanup, there's alsways the possibility of the source overriding the styles set by the script. I use the DnD 5e by Roll20 sheet. In this case, I've only played around with token GM notes. I have a blank character sheet set up with a default transparent token and a `!gmnote` token action for room notes. I believe I copied the text directly from the handouts into the token. This is what I noticed earlier today. Simpler blocks of text I was able to somehow tweak the line breaks to make it work. Changing the token action to `!gmnote --template|generic` fixed most of the notes. One particularly long one ended like this though: Hopefully this helps. I haven't tested it on anything else.
1668750873

Edited 1668753404
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Shoot. THANK YOU! There is indeed a bug I introduced. For anyone having this issue, if you cant wait for the next Code Merge, import the raw script  and delete line 300:                         message = ((undefined !== message) ? message.replace(/\[([^\]]*?)\]\(([^\)]*?)\)(?<!\.jpg\)|\.png\)|\.gif\)|\.webm\)|\.jpeg\))/gim, "<a " + buttonstyle + "href='$2'>$1</a>").replace(/<p>/gm, "<div>").replace(/<\/p>/gm, "</div>").replace("padding:5px'></div><div>", "padding:5px'>") : ""); It was for parsing custom templates and should not have been repeated here. I have sent a PR for the next merge, and my apologies to anyone inconvenienced by this. Normally this wouldn't have been an issue, but I did not test on pasted text, which can contain unexpected HTML or CSS code. Something in the Waterdeep handout caused a bad parse.
1668752140
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Danielle said: Other feedback: could you make the in-note link color for templates stand out a bit more? The gray/black in the generic template blends in with the text. This will require some more intensive testing to make sure I don't break anything. The links that are not looking pink in that template are usually links are auto generated by Roll20 from the [name of handout] journal link sort of command or by using the  link button in the text editor. It is built to handle markdown style links: [name of link](link address) Still, it should behave better. I just am a little gun shy about more breakage... Thanks for the feedback!
1668753310
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I was wrong. It turned out to be super-easy. Barely an inconvenience. In the next update, on custom templates, markdown links, and links to compendiums and journals will all display in the template link color. Link colors in regular roll templates will display as inline links of the color dictated by the template.
1668767475

Edited 1668767539
Kurt J.
Pro
API Scripter
keithcurtis said: I was wrong. It turned out to be super-easy. Barely an inconvenience. Wow, wow, wow, wow, wow........................ wow :)
1668774397
timmaugh
Pro
API Scripter
I'm gonna need you to get all the way off my back about the "difficult" thing.
1668784021
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Well let me get off of that thing. Being difficult is tight!
keithcurtis said: I was wrong. It turned out to be super-easy. Barely an inconvenience. I've still just barely begun to learn web dev, but I knew you could do it! Thanks!
1668883364
Pat
Pro
API Scripter
Hi Keith, It looks like this update broke the --handout integration with your "report" script.&nbsp; &nbsp;S upernotes appears to be overwriting the entire handout instead of inserting the notes below the table&nbsp;&nbsp; Lost a bit of work due to this.&nbsp; I set up my world map according to these instructions:&nbsp;&nbsp; <a href="https://app.roll20.net/forum/post/10381135/script-reporter-1-dot-x" rel="nofollow">https://app.roll20.net/forum/post/10381135/script-reporter-1-dot-x</a> &nbsp; &nbsp; Specifically referencing the&nbsp;"How to build a city navigator" section. All was working well until this supernotes update....
1668893220
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Well shoot. I am sorry for that. I did not run into that in my testing. It looks like I need to go back and do some debugging. Question: did you make the adjustment to the code I listed several posts up? If you want to revert to the older code in the meantime, you can download it directly from here .
1668894448
Pat
Pro
API Scripter
I didn't make any adjustments, just noticed&nbsp; the report handout behavior changed after the latest 1-click update.&nbsp;
1668896765
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I found the offending code. Line 348 is looking for the horizontal rule that tells the script to keep everything above the rule and replace everything below. It was changed from looking for &lt;hr&gt; to looking for &lt;HR&gt;, probably to account for some edge case. It should be a case insensitive search. Changing&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; notes = notes.split('&lt;HR&gt;')[0] + '&lt;!---End Report---&gt;'; to &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; notes = notes.split(/&lt;hr&gt;/i)[0] + '&lt;!---End Report---&gt;'; fixes it, at least in a quick test. I'll do some more rigorous testing before the next merge. Again, my deep apologies to anyone for whom this has caused an issue. My only explanation is that I am at best an amateur at coding. I posted it as manually installed beta code for a week or two without receiving any reports. I'll try to be more diligent.
1668999065
Pat
Pro
API Scripter
Thanks for quick response. I appreciate the help and all the great tools you share with us Keith.
1669004611

Edited 1669005662
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Probably not next update, but the one after: strange:
1671319342
Pat
Pro
API Scripter
keithcurtis said: I found the offending code. Line 348 is looking for the horizontal rule that tells the script to keep everything above the rule and replace everything below. It was changed from looking for &lt;hr&gt; to looking for &lt;HR&gt;, probably to account for some edge case. It should be a case insensitive search. Changing&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; notes = notes.split('&lt;HR&gt;')[0] + '&lt;!---End Report---&gt;'; to &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; notes = notes.split(/&lt;hr&gt;/i)[0] + '&lt;!---End Report---&gt;'; fixes it, at least in a quick test. I'll do some more rigorous testing before the next merge. Hi Keith, Latest One Click version still appears to have the above bug with the &lt;hr&gt; tag...
1671350107
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hm.. If I look at the One click and my own repo, and import the script into a fresh game to read the provided code, I see the revised line in each, splitting on the regex expression&nbsp; /&lt;hr&gt;/i instead of the string&nbsp; '&lt;HR&gt;' . Or are you saying you are still having problems with the unwanted and destructive behavior? Since changing the code, I have not run into the code deleting issue again.
1676443155
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Minor update coming, mostly to fix a meta-numbering issue to work better with ScriptInfo by timmaugh.
Keith, you are the best. Appreciate all you do. While we've got you looking at this script again, here's a feature request if it's easy: when "Make Handout" is triggered, can the script grab the selected token image and set the token image as the new Handout's Image?
1676665360
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Good idea. It's currently in a PR for updating the Metascript line numbering for Scriptinfo, but that's certainly doable. I'm thinking maybe there should be an option for token and an option for avatar. And of course the base option of neither.
1676698230
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Chris said: Keith, you are the best. Appreciate all you do. While we've got you looking at this script again, here's a feature request if it's easy: when "Make Handout" is triggered, can the script grab the selected token image and set the token image as the new Handout's Image? I want to do a more through job at this, but if you want the ability right away, import the script instead of installing it (so you can get to the code), and after the line that says: &nbsp;noteHandout.set("notes", notes + "&lt;h3&gt;" + whom + "&lt;/h3&gt;" + message + playerButton + handoutButton) ...add the line: &nbsp;noteHandout.set("avatar", tokenImage+"?12345678"); That should work.™
keithcurtis said: I want to do a more through job at this, but if you want the ability right away, import the script instead of installing it (so you can get to the code), and after the line that says: &nbsp;noteHandout.set("notes", notes + "&lt;h3&gt;" + whom + "&lt;/h3&gt;" + message + playerButton + handoutButton) ...add the line: &nbsp;noteHandout.set("avatar", tokenImage+"?12345678"); That should work.™ Thanks Keith. I added your suggested line of code and tested™ the addition in two ways. When the selected token is an image in "My Library," the script works as advertised, creating a handout and properly setting the image. When the selected token is from my marketplace purchase, however, the script triggers the infamous Roll20 ERROR: "You cannot set the imgsrc or avatar of an object unless you use an image that is in your Roll20 Library. See the API documentation for more info." I haven't actually been keeping track of where things now stand with the infamous problem of accessing marketplace images with the API. Thanks Keith.
1676913646
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I've had really odd and inconsistent results with marketplace images. It mystifies me. Use this instead: if(!tokenImage.includes("marketplace")){noteHandout.set("avatar", tokenImage+"?12345678")}
1676943828
GiGs
Pro
Sheet Author
API Scripter
I thought marketplace images were an absolute no-go when using scripts?
1676945724
timmaugh
Pro
API Scripter
I think the proscription is against a script creating something on the game board using a marketplace image. But I could be wrong...