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

Is it possible to update or revise the [Summon] Script?

1500993905
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The original script thread is&nbsp; here (Gist link <a href="https://gist.github.com/GM-King/9544706" rel="nofollow">https://gist.github.com/GM-King/9544706</a> ), but it doesn't look like it has been touched in some time. It also doesn't quite do what I would like it to do. The intent is (and it works marvelously for this) to allow the API to place a creature, in the number specified, on the map next to the selected token. This is great for summoners and conjurers, but it falls a little short from what I would like to make it do, and the modifications are likely more complex than I am comfortable making. Currently, instead of actually placing a token, it seems like it reads the token image link info from the referenced character sheet, pulls the referenced image from the library and sets up a brand new token based on this information. This has several shortcomings. 1) The token is set up according to the script's preferences, not the default for the campaign (bar values are different). This part I could change. 2) The process does not honor auto numbering of tokens with the " %%NUMBERED%%" tag in their name. This part is beyond me. Further, although I haven't tested this, I suspect it can only pull images from a particular user's library. This would not be useful for a GM to set up a conjuration spell for a more tech-challenged player. Can this script be modified or rewritten to allow pulling an actual configured token to the tabletop by any player who has control over said sheet, honoring presets and autonumbering?
1500994103
Ziechael
Forum Champion
Sheet Author
API Scripter
In case Aaron's previous tweaking to my version do some or all of what you want i'll paste it here... also gives someone (I sense Aaron lurking) a good start point for any future features: // on('ready',function(){ &nbsp; &nbsp; var getCleanImgsrc = function (imgsrc) { &nbsp; "use strict"; &nbsp; var parts = imgsrc.match(/(.*\/images\/.*)(thumb|med|original|max)(.*)$/); &nbsp; if(parts) { &nbsp;return parts[1]+'thumb'+parts[3]; &nbsp; } &nbsp; return; }, summonToken = function(character,pageid,baseX,baseY,baseW,baseH){ "use strict"; var page=getObj('page',pageid); baseW=baseW||70; baseH=baseH||70; character.get('defaulttoken',function(defaulttoken){ &nbsp;var dt = JSON.parse(defaulttoken); &nbsp;if(dt && getCleanImgsrc(dt.imgsrc)){ dt.imgsrc=getCleanImgsrc(dt.imgsrc); dt.left=((baseX+baseW+dt.width)&gt;page.get('width') ? baseX-dt.width : baseX+baseW); dt.top=((baseY+baseH+dt.width)&gt;page.get('height') ? baseY-dt.width : baseY+baseH); dt.pageid = pageid; createObj('graphic',dt); &nbsp;} else { sendChat('','/w gm Cannot create token for &lt;b&gt;'+character.get('name')+'&lt;/b&gt;'); &nbsp;} }); }; on("chat:message", function(msg) { if (msg.type == "api" && msg.content.indexOf("!summon ") === 0)&nbsp; { var GM = ""; var size1 = 0; var size2 = size1; var s = 0; var inputName = ""; var howMuch = 0; var amount = 0; // Amount of summoned monsters. var mod = 0; // Modifier to amount. var skip = false; var action = "Summons "; var section = msg.content.split(" "); // Breaks API call into sections. if (section.length &gt; 1) { for (var j=1;j&lt;section.length;j++) { if (typeof parseInt(section[j]) === 'number' && Math.round(parseInt(section[j])) % 1 == 0 || section[j].length &lt;= 4 && section[j].toLowerCase().search("d") != -1 && /\dd/.test(section[j]) || section[j].toLowerCase() == 'cust') { if (section[j].toLowerCase() == 'cust') { var howMuch = j; break; } else { if (j != section.length-1) { for (var m = j+1; m &lt; section.length; m++) { if (typeof parseInt(section[m]) === 'number' && Math.round(parseInt(section[m])) % 1 == 0 || section[m].length &lt;= 4 && section[m].toLowerCase().search("d") != -1 && /\dd/.test(section[m])) { skip = true; } else { skip = false; } } } else { skip = false; } if (skip == false) { var howMuch = j; break; } } } } if (howMuch &gt; 0) { for (var k=1;k&lt;howMuch;k++) { if (k == howMuch-1) { inputName = inputName + section[k]; } else { inputName = inputName + section[k] + " "; } } if (section[howMuch].toLowerCase().search("d") != -1) // If user chose to roll. { if (section[howMuch].indexOf("+") != -1) { mod = section[howMuch].split("+"); // If user specified a modfier. section[howMuch] = mod[0]; mod = parseInt(mod[1],10); } var count = 0; var diceRoll = section[howMuch].split("d"); diceRoll[0] = diceRoll[0].replace(/\D/g,''); diceRoll[1] = diceRoll[1].replace(/\D/g,''); var lowEnd = parseInt(diceRoll[0]); var highEnd = parseInt(diceRoll[1]); while (count &lt; lowEnd)&nbsp; { amount = amount + randomInteger(highEnd); // Rolls dice. count++; log("Summoner: rolls a " + amount) } } else if (section[howMuch].toLowerCase() != 'cust') { var amount = parseInt(section[howMuch],10); // Creates variable for number of summoned monsters. } else { amount == 1; } amount = amount + mod; } else if (howMuch == 0) { if (section[section.length-1].length == 1) { s = 1; howMuch = section.length - 2; } amount = 1; for (var k=1;k&lt;section.length-s;k++) { if (k == section.length-1-s) { inputName = inputName + section[k]; } else { inputName = inputName + section[k] + " "; } } } if (section.length &gt; (howMuch+1) && section[howMuch].toLowerCase() != "cust") { if (section[howMuch+1].toLowerCase() == "f") { size1 = -63; size2 = size1; } else if (section[howMuch+1].toLowerCase() == "d") { size1 = -56; size2 = size1; } else if (section[howMuch+1].toLowerCase() == "t") { size1 = -35; size2 = size1; } else if (section[howMuch+1].toLowerCase() == "l") { size1 = 70; size2 = size1; } else if (section[howMuch+1].toLowerCase() == "h") { size1 = 140; size2 = size1; } else if (section[howMuch+1].toLowerCase() == "g") { size1 = 210; size2 = size1; } else if (section[howMuch+1].toLowerCase() == "c") { size1 = 280; size2 = size1; } else if (section[howMuch+1].toLowerCase() == "cust") { if (typeof section[howMuch+2] != 'undefined') { size1 = parseInt(section[howMuch+2]); } else { sendChat(msg.who, "/w gm Please ensure the \"cust\" tag is followed by two values (every 70 = 1 square)."); // If monster is not in character list. } if (typeof section[howMuch+3] != 'undefined') { size2 = parseInt(section[howMuch+3]); } else { sendChat(msg.who, "/w gm Please ensure the \"cust\" tag is followed by two values (every 70 = 1 square)."); // If monster is not in character list. } } } else if (section[howMuch].toLowerCase() == "cust") { if (typeof section[howMuch+1] != 'undefined') { size1 = parseInt(section[howMuch+1]); } else { sendChat(msg.who, "/w gm Please ensure the \"cust\" tag is followed by two values (every 70 = 1 square)."); // If monster is not in character list. } if (typeof section[howMuch+2] != 'undefined') { size2 = parseInt(section[howMuch+2]); } else { sendChat(msg.who, "/w gm Please ensure the \"cust\" tag is followed by two values (every 70 = 1 square)."); // If monster is not in character list. } } } else { sendChat(msg.who, "/w gm No monsters specified to summon"); // If user writes too many things. } var check = findObjs({ _type: "character", name: inputName },{caseInsensitive: true})[0]; if (typeof check == 'undefined') { sendChat(msg.who, "/w gm Monster of name \"" &nbsp;+ inputName + "\" does not exist."); // If monster is not in character list. } else { var list = findObjs({ _type: "character", name: inputName},{caseInsensitive: true}); var characterId = list[0].id; // Extract character ID from character sheet var characterName = list[0].get('name'); // Extract character name from character sheet var characterImage = getCleanImgsrc(list[0].get('avatar')); // Extract character image URL from character sheet var character; if (!characterImage) { sendChat(msg.who, "/w gm Monster of name \"" &nbsp;+ inputName + "\" has a marketplace image or is missing. &lt;code&gt;"+list[0].get('avatar')+"&lt;/code&gt;"); &nbsp; &nbsp; // Error message } else { var selected = msg.selected; _.each(selected, function(obj) { var tok = getObj("graphic", obj._id); // Create variable for selected token (for summoned monster positioning) var HP = findObjs({ _type: "attribute", name: "hitpoints", _characterid: characterId },{caseInsensitive: true})[0]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//finds the health from charactersheet if (typeof HP == 'undefined') { HP = "-1"; } else { HP = (HP) ? HP.get("current") : 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Changes HP to useable string } var SP = findObjs({ _type: "attribute", name: "speed", _characterid: characterId },{caseInsensitive: true})[0]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//finds the speed from charactersheet if (typeof SP == 'undefined') { SP = "-1"; } else { SP = (SP) ? SP.get("current") : 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Changes SP to useable string } var AC = findObjs({ _type: "attribute", name: "armorclass", _characterid: characterId },{caseInsensitive: true})[0]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// finds the ac from charactersheet if (typeof AC == 'undefined') { AC = "-1"; } else { AC = (AC) ? AC.get("current") : 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Changes AC to useable string } if (amount == 0) { amount = 1; } else if (amount &gt; 20) { var tooMany = amount; amount = 20; log("Summoner: User specified " + tooMany + " monsters. Scaling to 20.") // If user spams the field. } for (var i=0;i&lt;amount;i++) { if (HP == "-1" && AC == "-1" && msg.content.toLowerCase().search("torch") != -1) { action = "Lights" createObj("graphic",&nbsp; { represents: characterId, &nbsp; // Links new token to charactersheet left: tok.get("left")+70, top: tok.get("top"), width: 70+size1, height: 70+size2, name: characterName, pageid: tok.get("pageid"), imgsrc: characterImage, layer: "objects", light_radius: 40, light_dimradius: 20, light_otherplayers: true }); } else if (HP == "-1" && AC == "-1") { character = getObj('character',characterId); if(character){ summonToken( character, tok.get('pageid'), tok.get('left'), tok.get('top'), tok.get('width'), tok.get('height') ); } else { sendChat('','/w gm No character for id: &lt;b&gt;'+characterId+'&lt;/b&gt;'); } } else { character = getObj('character',characterId); if(character){ summonToken( character, tok.get('pageid'), tok.get('left'), tok.get('top'), tok.get('width'), tok.get('height') ); } else { sendChat('','/w gm No character for id: &lt;b&gt;'+characterId+'&lt;/b&gt;'); } } } }); if (amount &gt; 1) { inputName = inputName + "s"; // If more than 1 summon, adds plural. } else if (amount == 1 && action == "Lights") { amount = " a"; inputName = "torch"; } if (typeof amount === 'number') { amount = amount.toString(); } sendChat(msg.who, GM + action + amount + " " + inputName + "!"); // Announces how many and what Summoner has summoned. } } } }); });
1500994469
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Wow, almost perfect. (I wish the search features on the forum... searched). The only thing lacking is translating "%%NUMBERED%%" to the actual numbers. Thanks!
1500994484
The Aaron
Pro
API Scripter
This script was written before the API had access to defaulttoken, so that should be easy to add in now. &nbsp;As for %%NUMBERED%%, I can add an external function to notify it of newly created tokens so it can apply logic.
1500994644
The Aaron
Pro
API Scripter
Oh look, I already added the default token stuff.. =D &nbsp;Thanks Z!
1500999553
The Aaron
Pro
API Scripter
Ok. You'll need TokenNameNumber v0.5.12:&nbsp; <a href="https://github.com/shdwjk/Roll20API/blob/master/To" rel="nofollow">https://github.com/shdwjk/Roll20API/blob/master/To</a>... King's script revised to number tokens: /* This is an improved Summoning API that was built upon. Original author: Brandon W. Original here: <a href="https://app.roll20.net/forum/post/466778/scipt-au" rel="nofollow">https://app.roll20.net/forum/post/466778/scipt-au</a>... Special thanks to Brian for helping me with some of the script. I hope this serves others well, do not hesistate to contact me regarding bugs or improvements. -GM King Usage: 1. Select token you want the monster to appear next to. 2. In chat, type "!summon (name of monster) (number to summon)" without brackets or quotation marks. 3. By default the monster will take up a 5x5 ft square (medium or small creature). To summon larger creatures add a letter to the end of the message: F= Fine, D = Diminutive, T= Tiny, L = large, H = Huge, G = Gargantuan, C = Colossal, cust = customised size (this tag must be followed by two numbers, see examples). 4. You can also summon a torch that will give 40 ft of vision with 20 ft of dim light (torch must be in the name). NB. The name of the monster must be in your character sheet list and the image must be the token image you wish to use (marketplace images do not work). Examples: !summon torch !summon eagle !summon eagle 2 !summon eagle 1d3 !summon eagle 1d3+1 !summon cave troll 1d3+1 H !summon flame sphere cust 140 140 NB. When making a custom size every 70 = 1 square. */ /* global TokenNameNumber */ on('ready',function(){ const getCleanImgsrc = function (imgsrc) { var parts = imgsrc.match(/(.*\/images\/.*)(thumb|med|original|max)([^?]*)(\?[^?]+)?$/); if(parts) { return parts[1]+'thumb'+parts[3]+(parts[4]?parts[4]:`?${Math.round(Math.random()*9999999)}`); } return; }, processCreated = (( 'undefined' !== typeof TokenNameNumber && TokenNameNumber.NotifyOfCreatedToken )&nbsp; ? TokenNameNumber.NotifyOfCreatedToken : _.noop ) , summonToken = function(character,pageid,baseX,baseY,baseW,baseH){ "use strict"; const page=getObj('page',pageid); baseW=baseW||70; baseH=baseH||70; character.get('defaulttoken',function(defaulttoken){ const dt = JSON.parse(defaulttoken); if(dt && getCleanImgsrc(dt.imgsrc)){ dt.imgsrc=getCleanImgsrc(dt.imgsrc); dt.left=((baseX+baseW+dt.width)&gt;page.get('width') ? baseX-dt.width : baseX+baseW); dt.top=((baseY+baseH+dt.width)&gt;page.get('height') ? baseY-dt.width : baseY+baseH); dt.pageid = pageid; processCreated(createObj('graphic',dt)); } else { sendChat('','/w gm Cannot create token for &lt;b&gt;'+character.get('name')+'&lt;/b&gt;'); } }); }; on("chat:message", function(msg) { if (msg.type == "api" && msg.content.indexOf("!summon ") === 0)&nbsp; { var GM = ""; var size1 = 0; var size2 = size1; var s = 0; var inputName = ""; var howMuch = 0; var amount = 0; // Amount of summoned monsters. var mod = 0; // Modifier to amount. var skip = false; var action = "Summons "; var section = msg.content.split(/\s+/); // Breaks API call into sections. if (section.length &gt; 1) { for (var j=1;j&lt;section.length;j++) { if (typeof parseInt(section[j]) === 'number' && Math.round(parseInt(section[j])) % 1 == 0 || section[j].length &lt;= 4 && section[j].toLowerCase().search("d") != -1 && /\dd/.test(section[j]) || section[j].toLowerCase() == 'cust') { if (section[j].toLowerCase() == 'cust') { howMuch = j; break; } else { if (j != section.length-1) { for (var m = j+1; m &lt; section.length; m++) { if (typeof parseInt(section[m]) === 'number' && Math.round(parseInt(section[m])) % 1 == 0 || section[m].length &lt;= 4 && section[m].toLowerCase().search("d") != -1 && /\dd/.test(section[m])) { skip = true; } else { skip = false; } } } else { skip = false; } if (skip == false) { howMuch = j; break; } } } } if (howMuch &gt; 0) { for (var k=1;k&lt;howMuch;k++) { if (k == howMuch-1) { inputName = inputName + section[k]; } else { inputName = inputName + section[k] + " "; } } if (section[howMuch].toLowerCase().search("d") != -1) // If user chose to roll. { if (section[howMuch].indexOf("+") != -1) { mod = section[howMuch].split("+"); // If user specified a modfier. section[howMuch] = mod[0]; mod = parseInt(mod[1],10); } var count = 0; var diceRoll = section[howMuch].split("d"); diceRoll[0] = diceRoll[0].replace(/\D/g,''); diceRoll[1] = diceRoll[1].replace(/\D/g,''); var lowEnd = parseInt(diceRoll[0]); var highEnd = parseInt(diceRoll[1]); while (count &lt; lowEnd)&nbsp; { amount = amount + randomInteger(highEnd); // Rolls dice. count++; log("Summoner: rolls a " + amount); } } else if (section[howMuch].toLowerCase() != 'cust') { amount = parseInt(section[howMuch],10); // Creates variable for number of summoned monsters. } else { amount == 1; } amount = amount + mod; } else if (howMuch == 0) { if (section[section.length-1].length == 1) { s = 1; howMuch = section.length - 2; } amount = 1; for (k=1;k&lt;section.length-s;k++) { if (k == section.length-1-s) { inputName = inputName + section[k]; } else { inputName = inputName + section[k] + " "; } } } if (section.length &gt; (howMuch+1) && section[howMuch].toLowerCase() != "cust") { if (section[howMuch+1].toLowerCase() == "f") { size1 = -63; size2 = size1; } else if (section[howMuch+1].toLowerCase() == "d") { size1 = -56; size2 = size1; } else if (section[howMuch+1].toLowerCase() == "t") { size1 = -35; size2 = size1; } else if (section[howMuch+1].toLowerCase() == "l") { size1 = 70; size2 = size1; } else if (section[howMuch+1].toLowerCase() == "h") { size1 = 140; size2 = size1; } else if (section[howMuch+1].toLowerCase() == "g") { size1 = 210; size2 = size1; } else if (section[howMuch+1].toLowerCase() == "c") { size1 = 280; size2 = size1; } else if (section[howMuch+1].toLowerCase() == "cust") { if (typeof section[howMuch+2] != 'undefined') { size1 = parseInt(section[howMuch+2]); } else { sendChat(msg.who, "/w gm Please ensure the \"cust\" tag is followed by two values (every 70 = 1 square)."); // If monster is not in character list. } if (typeof section[howMuch+3] != 'undefined') { size2 = parseInt(section[howMuch+3]); } else { sendChat(msg.who, "/w gm Please ensure the \"cust\" tag is followed by two values (every 70 = 1 square)."); // If monster is not in character list. } } } else if (section[howMuch].toLowerCase() == "cust") { if (typeof section[howMuch+1] != 'undefined') { size1 = parseInt(section[howMuch+1]); } else { sendChat(msg.who, "/w gm Please ensure the \"cust\" tag is followed by two values (every 70 = 1 square)."); // If monster is not in character list. } if (typeof section[howMuch+2] != 'undefined') { size2 = parseInt(section[howMuch+2]); } else { sendChat(msg.who, "/w gm Please ensure the \"cust\" tag is followed by two values (every 70 = 1 square)."); // If monster is not in character list. } } } else { sendChat(msg.who, "/w gm No monsters specified to summon"); // If user writes too many things. } var check = findObjs({ _type: "character", name: inputName },{caseInsensitive: true})[0]; if (typeof check == 'undefined') { sendChat(msg.who, "/w gm Monster of name \"" &nbsp;+ inputName + "\" does not exist."); // If monster is not in character list. } else { var list = findObjs({ _type: "character", name: inputName},{caseInsensitive: true}); var characterId = list[0].id; // Extract character ID from character sheet var characterName = list[0].get('name'); // Extract character name from character sheet var characterImage = getCleanImgsrc(list[0].get('avatar')); // Extract character image URL from character sheet var character; if (!characterImage) { sendChat(msg.who, "/w gm Monster of name \"" &nbsp;+ inputName + "\" has a marketplace image or is missing. &lt;code&gt;"+list[0].get('avatar')+"&lt;/code&gt;"); &nbsp; &nbsp; // Error message } else { var selected = msg.selected; _.each(selected, function(obj) { var tok = getObj("graphic", obj._id); // Create variable for selected token (for summoned monster positioning) var HP = findObjs({ _type: "attribute", name: "hitpoints", _characterid: characterId },{caseInsensitive: true})[0]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//finds the health from charactersheet if (typeof HP == 'undefined') { HP = "-1"; } else { HP = (HP) ? HP.get("current") : 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Changes HP to useable string } var SP = findObjs({ _type: "attribute", name: "speed", _characterid: characterId },{caseInsensitive: true})[0]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//finds the speed from charactersheet if (typeof SP == 'undefined') { SP = "-1"; } else { SP = (SP) ? SP.get("current") : 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Changes SP to useable string } var AC = findObjs({ _type: "attribute", name: "armorclass", _characterid: characterId },{caseInsensitive: true})[0]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// finds the ac from charactersheet if (typeof AC == 'undefined') { AC = "-1"; } else { AC = (AC) ? AC.get("current") : 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Changes AC to useable string } if (amount == 0) { amount = 1; } else if (amount &gt; 20) { var tooMany = amount; amount = 20; log("Summoner: User specified " + tooMany + " monsters. Scaling to 20."); // If user spams the field. } for (var i=0;i&lt;amount;i++) { if (HP == "-1" && AC == "-1" && msg.content.toLowerCase().search("torch") != -1) { action = "Lights"; createObj("graphic",&nbsp; { represents: characterId, &nbsp; // Links new token to charactersheet left: tok.get("left")+70, top: tok.get("top"), width: 70+size1, height: 70+size2, name: characterName, pageid: tok.get("pageid"), imgsrc: characterImage, layer: "objects", light_radius: 40, light_dimradius: 20, light_otherplayers: true }); } else if (HP == "-1" && AC == "-1") { character = getObj('character',characterId); if(character){ summonToken( character, tok.get('pageid'), tok.get('left'), tok.get('top'), tok.get('width'), tok.get('height') ); } else { sendChat('','/w gm No character for id: &lt;b&gt;'+characterId+'&lt;/b&gt;'); } } else { character = getObj('character',characterId); if(character){ summonToken( character, tok.get('pageid'), tok.get('left'), tok.get('top'), tok.get('width'), tok.get('height') ); } else { sendChat('','/w gm No character for id: &lt;b&gt;'+characterId+'&lt;/b&gt;'); } } } }); if (amount &gt; 1) { inputName = inputName + "s"; // If more than 1 summon, adds plural. } else if (amount == 1 && action == "Lights") { amount = " a"; inputName = "torch"; } if (typeof amount === 'number') { amount = amount.toString(); } sendChat(msg.who, GM + action + amount + " " + inputName + "!"); // Announces how many and what Summoner has summoned. } } } }); });
1501000373
The Aaron
Pro
API Scripter
I've not used this script before, are there other areas for improvement?
1501004496
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Works like a charm, now! Not sure what could be used to improve. Perhaps a duplicate command? Say you have 3 goblins and 2 more mooks show up in reply to an alarm. If you have goblin 1, 2 & 3 out, it might be nice to be able to select one, and clone 4 and 5 from him. Maybe the ability to store encounter groups to pull onto the board? Especially if you could designate a "party" so you could quickly populate the board with the PCs. Just brainstorming.
1501005550
The Aaron
Pro
API Scripter
Try: !summon @{selected|character_name} 2 That second one is something I've thought about a bit before, and I think it's a good idea, once I can get around to writing it. =D
1501006150
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That did it. The party thing is certainly something that could be set up via a macro, since party makeup doesn't change that often.
1501006555

Edited 1501006606
The Aaron
Pro
API Scripter
Scott has a PageNav Script that can move parties between maps very nicely.
1501008569
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I remember running into some problem with that, but I was really new to the API at the time. I'll look into it.
1501009953
The Aaron
Pro
API Scripter
He did a full rewrite on it a few months ago, should be pretty nice. &nbsp;Probably it was the imgsrc not in User Library issue, if anything.
1501054387

Edited 1501619064
Ziechael
Forum Champion
Sheet Author
API Scripter
There are still a few bugs with v2.0 which he is in hopefully in the process of squashing, pretty swamped with his PF companion script project at the moment though i think...
Sorry to raise this thread from the dead. However i'm using the script above, where it successfully adds my token, and the number i want next to the selected token correctly. What is broken ( and maybe it isn't supposed to do this), is the token that is summoned doesn't have the character sheets attributes assigned in the bars. Where the token i've selected has two of the bars filled in and assigned to attributes, the summoned token has them assigned to different bars and unassigned to any of the &nbsp;character sheets attributes (it says NONE).&nbsp; Is this what is supposed to be happening, or am do i have to setup something up on somewhere else? Thanks!
1501616361
The Aaron
Pro
API Scripter
If you drag the token out for the one you want to summon, does it come out with the bars correctly set up?
Yup. The token that is assigned to the Character sheet comes out fine. It is that one that i'm trying selecting to "summon" a token from. &nbsp;It comes out.. "broken".&nbsp; On another note, i think i found a work around with your tokenmod script. I selected all of the "broken" tokens, then set the bar1, and bar2 attributes. That works, however i thought the Summon script would have just taken a "copy" of the token of the character sheet i'm trying to "summon"
1501621821
The Aaron
Pro
API Scripter
The only thing the selected token is used by the script for is positioning the summoned tokens.
Below is the token when dropped from the Character sheet onto the table top Below is the token when summoned next to the dropped token.
1501638478
The Aaron
Pro
API Scripter
Hmmm. Are you using any other scripts? &nbsp;I take it you're using the selected token's name as the argument to summon?
Yeah i'm running lots of scripts, and yeah, i'm using the selected token's name as the argument to summon.
When you get this settled Terrelle you should ask about what other scripts you should try. Chat Set Attribute and Group Check by Jakob, Group Initiative by Aaron, and Aura/Tint Health Colors by DXWarlock are used every time I play. Aaron's Table Export, Recursive Tables, Torch, Bump and some small ones are used very often!&nbsp;
1501677107
The Aaron
Pro
API Scripter
Ok, I can't see how this would be happening from the code, want to PM me and invite and GM me and I'll come take a look?
WIll do
Thanks again Aaron! I'll try to keep these scripts updated!
1501690239
The Aaron
Pro
API Scripter
=D