`,
+ buttonstyle: `style='display:inline-block !important; color:#333; text-decoration: underline; background-color: transparent;padding: 0px; border: none'`,
+ playerbuttonstyle: `style='display:inline-block; font-size: 14px !important; color:#333; text-decoration: underline; background-color: transparent;padding: 0px; border: none'`,
+ buttondivider: `|`,
+ handoutbuttonstyle: `style='display:inline-block; font-size: 14px !important; color:#333; text-decoration: underline; background-color: transparent;padding: 0px; border: none'`,
+ whisperStyle: `'background-color: #729aa5; color:#eee; display:block; text-align:center; font-family: "Arial"; padding:5px; margin: 15px -20px 10px -20px'`,
+ whisperbuttonstyle: `style='display:inline-block; color:#eee; text-decoration: underline; background-color: transparent;padding: 0px; border: none'`,
+ footer: ``
}
};
@@ -270,13 +411,44 @@ return text;
const decodeUnicode = (str) => str.replace(/%u[0-9a-fA-F]{2,4}/g, (m) => String.fromCharCode(parseInt(m.slice(2), 16)));
- const version = '0.2.2';
+ const version = '0.2.4';
log('Supernotes v' + version + ' is ready! --offset ' + API_Meta.Supernotes.offset + 'To set the template of choice or to toggle the send to players option, Use the command !gmnote --config');
on('chat:message', function(msg) {
if ('api' === msg.type && msg.content.match(/^!(gm|pc|self)note\b/)) {
let match = msg.content.match(/^!gmnote-(.*)$/);
let selectedObject = msg.selected;
+
+//################## EXPERIMENTAL TO GET TOKEN ID FROM SUPPLIED VALUE
+if(msg.content.includes("--token|")){
+ virtualTokenID = msg.content.split(/--token\|/)[1].split(/\s/)[0];
+sendChat ("notes","success. Virtual token id is " + virtualTokenID);
+ if (virtualTokenID.length !== 20 && virtualTokenID.charAt(0) !== "-"){
+ sendChat ("notes","this is not a token id :" + virtualTokenID);
+ sendChat ("notes","player page id :" + Campaign().get("playerpageid"));
+
+ selectedObject = findObjs({
+ _type: "graphic",
+ _id: virtualTokenID,
+ });
+ log ("selectedObject is " + selectedObject);
+ // selectedObject = theToken[0];
+ }
+ if (selectedObject){
+ sendChat ("notes", "number of 'selected' objects is " +selectedObject.length);
+ } else{
+ sendChat ("notes", "no passed value");
+ }
+//sendChat ("notes","virtual ID is " + selectedObject[0].get("_id"));
+}
+//################## EXPERIMENTAL TO GET TOKEN ID FROM SUPPLIED VALUE
+
+
+
+
+
+
+
//define command
let command = msg.content.split(/\s+--/)[0];
let sender = msg.who;
@@ -310,29 +482,6 @@ let selectedObject = msg.selected;
let templates = Supernotes_Templates;
-//################## EXPERIMENTAL TO GET TOKEN ID FROM SUPPLIED VALUE
-if(msg.content.includes("--token|")){
- virtualTokenID = msg.content.split(/--token\|/)[1].split(/\s/)[0];
-
- if (virtualTokenID.length !== 20 && virtualTokenID.charAt(0) !== "-"){
- sendChat ("notes","this is not a token id :" + virtualTokenID);
- sendChat ("notes","player page id :" + Campaign().get("playerpageid"));
-
- let theToken = findObjs({
- _type: "graphic",
- name: virtualTokenID,
- _pageid: Campaign().get("playerpageid")
- });
- selectedObject = theToken;
- }
-
-sendChat ("notes","virtual ID is " + selectedObject[0].get("_id"));
-//sendChat ("notes","real selected token is " + virtualTokenID);
-
-
-//msg.selected[0]._id = virtualTokenID;
-
-}
function sendMessage(whom, messagePrefix, template, title, theText, message, tokenID, playerButton, handoutButton) {
@@ -360,9 +509,24 @@ sendChat ("notes","virtual ID is " + selectedObject[0].get("_id"));
case "dark":
chosenTemplate = templates.dark;
break;
+ case "roll20light":
+ chosenTemplate = templates.roll20light;
+ break;
+ case "roll20dark":
+ chosenTemplate = templates.roll20dark;
+ break;
case "scroll":
chosenTemplate = templates.scroll;
break;
+ case "scroll2":
+ chosenTemplate = templates.scroll2;
+ break;
+ case "vault":
+ chosenTemplate = templates.vault;
+ break;
+ case "osrblue":
+ chosenTemplate = templates.osrblue;
+ break;
case "lcars":
chosenTemplate = templates.lcars;
break;
@@ -384,12 +548,27 @@ sendChat ("notes","virtual ID is " + selectedObject[0].get("_id"));
case "wizard":
chosenTemplate = templates.wizard;
break;
+ case "path":
+ chosenTemplate = templates.path;
+ break;
+ case "treasure":
+ chosenTemplate = templates.treasure;
+ break;
case "steam":
chosenTemplate = templates.steam;
break;
+ case "gate3":
+ chosenTemplate = templates.gate3;
+ break;
+ case "choices":
+ chosenTemplate = templates.choices;
+ break;
case "apoc":
chosenTemplate = templates.apoc;
break;
+ case "news":
+ chosenTemplate = templates.news;
+ break;
case "roman":
chosenTemplate = templates.roman;
break;
@@ -454,7 +633,7 @@ whisper= whisper.replace(/<\/span>
/i,"")
playerButton = ((undefined !== playerButton) ? playerButton.replace(/\[([^\]]*?)\]\(([^\)]*?)\)(?$1") : "");
handoutButton = ((undefined !== handoutButton) ? handoutButton.replace(/\[([^\]]*?)\]\(([^\)]*?)\)(?$1") : "");
whisper = ((whisper.length>0) ? "
" + whisper + "
" : "");
-log ("whisper = " + whisper);
+//log ("whisper = " + whisper);
return sendChat(whom, messagePrefix + '&{template:' + template + '}{{' + title + '=' + whom + '}} {{' + theText + '=' + message + whisper + playerButton + handoutButton + '}}');
}
@@ -474,7 +653,7 @@ log ("whisper = " + whisper);
controlledby: "all"
});
let noteHandoutid = noteHandout.get("_id");
- sendChat('Supernotes', `Supernotes has created a handout named
${handoutTitle}.
Click
here to open.`, null, {
+ sendChat('Supernotes', `/w gm Supernotes has created a handout named
${handoutTitle}.
Click
here to open.`, null, {
noarchive: true
});
}
diff --git a/Supernotes/script.json b/Supernotes/script.json
index b28f86898d..2a92dbc75f 100644
--- a/Supernotes/script.json
+++ b/Supernotes/script.json
@@ -1,7 +1,7 @@
{
"name": "Supernotes",
"script": "Supernotes.js",
- "version": "0.2.3",
+ "version": "0.2.4",
"description": "# Supernotes\r*by keithcurtis, expanded from code written by the Aaron.*\r\rThis script pulls the contents from a token's GM Notes field and sends them to chat, based on a user-selectable roll template. If the token represents a character, you can optionally pull in the Bio or GM notes from the character. The user can decide whether to whisper the notes to the GM or broadcast them to all players. Finally, there is the 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.\r\rThis script as written is optimized for the D&D 5th Edition by Roll20 sheet, but can be adapted easily suing the Configuration section below.\r\r* [SuperNotes forum thread](https://app.roll20.net/forum/post/8293909/script-supernotes)\r\r\r## Commands:\r\r**!gmnote** whispers the note to the GM\r\r**!pcnote** sends the note to all players\r\r**!selfnote** whispers the note to to the sender\r\r\r## Paramaters\r\r*--token* Pulls notes from the selected token's gm notes field. This is optional. If it is missing, the script assumes --token\r\r*--charnote* Pulls notes from the gm notes field of the character assigned to a token.\r\r*--bio* Pulls notes from the bio field of the character assigned to a token.\r\r*--avatar* Pulls the image from the avatar field of the character assigned to a token.\r\r--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\r\r*--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\r\r*--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.\r\r*--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.\r\r*--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.\r\r*--handout|Handoutname|* 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 break.\rA 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.\r\r--template[templatename] Instead of using the configured sheet roll template, you can choose from between more than 10 custom templates that cover most common genres. Add the template command directly after the main prompt, followed by any of the regular parameters above. The current choices are:\r**template|generic.** Just the facts, ma'am. Nothing fancy here.\r**template|dark.** As above, but in reverse.\r**template|crt.** Retro greenscreen for hacking and cyberpunk. Or for reports on that xenomorph hiding on your ship.\r**template|notebook.** You know, for kids. Who like to ride bikes. Maybe they attend a school and fight vampires or rescue lost extraterrestrials\r**template|gothic.** Classic noire horror for contending with Universal monsters or maybe contending with elder gods.\r**template|apoc.** Messages scrawled on a wall. Crumbling and ancient, like the world that was.\r**template|scroll.** High fantasy. Or low fantasy—we don't judge.\r**template|lcars.** For opening hailing frequencies and to boldly split infinitives that no one has split before!\r**template|faraway.** No animated title crawl, but still has that space wizard feel.\r**template|steam.** Gears and brass have changed my life.\r**template|western.** Return with us now to those thrilling days of yesteryear!\r**template|wizard.** Like those ones that live on the coast\r**template|dragon.** Third Edition goodness!\r\r*--help* Displays help.\r\r*--config* Returns a configuration dialog box that allows you to set which sheet's roll template to use, and to toggle the '\r Players' footer.\r\r\r## Configuration\r\rWhen 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 '\r Players' footer button to appear.\r\rYou 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:\r\rDefault Template, D&D 5th Edition by Roll20, 5e Shaped, Pathfinder by Roll20, Pathfinder Community, Pathfinder 2e by Roll20, Starfinder, Starfinder, Call of Cthulhu 7th Edition by Roll20",
"authors": "Keith Curtis",
"roll20userid": "162065",
@@ -12,5 +12,5 @@
"character.represents": "read"
},
"conflicts": [],
- "previousversions": ["0.0.4","0.0.5","0.0.6","0.0.7","0.0.8","0.0.9","0.0.91","0.1.0","0.1.1","0.1.2","0.1.3","0.1.4","0.2.0","0.2.1","0.2.2","0.2.3"]
+ "previousversions": ["0.0.4","0.0.5","0.0.6","0.0.7","0.0.8","0.0.9","0.0.91","0.1.0","0.1.1","0.1.2","0.1.3","0.1.4","0.2.0","0.2.1","0.2.2","0.2.3","0.2.4"]
}