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

[Scripts] GM-King's APIs (Summon monster, stat adjuster, ammo tracker)

1423968101

Edited 1424348320
Hey Guys, I have been on temporary roll20 hiatus (very saddening) and it looks like my API's have not made the cut for the API repository. Nevertheless, I am back and would like to give them somewhat of a bump in-case they are useful for fellow dungeoneers. API 1. Summon Monster (Improved) This API is built onto Brandon's summoning script . I've edited and improved on this with the help of Brian. You will find it to be perfect for Druids and Summoners or anyone who can summon monsters really! I have also just added a functionality that will allow players to light torches for illumination. 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 a journal entry under "Characters" and the character image must be the token image you wish to use (marketplace images do not work). If that character has an HP and AC attribute it will automatically allocate them to the red and blue token bar respectively. This API works well in conjunction with the Monster Importer (see below) which I have only tweaked and cannot claim credit for. Examples: 1. !summon torch 2. !summon eagle 3. !summon eagle 2 4. !summon eagle 1d3 5. !summon eagle 1d3+1 6. !summon cave troll 1d3+1 H 7. !summon flaming sphere cust 140 140 NB. When making a custom size, every 70 = 1 square. Please find the Summon Monters API here: <a href="https://gist.github.com/9544706.git" rel="nofollow">https://gist.github.com/9544706.git</a> API 2. Temporary Stat Adjuster This API will allow you to quickly determine any Ability Score damage or gain and will calculate the modifier decrease or increase and reflect this in temporary adjustment to HP (if CON damage). This code does not work for Character Sheets. Just make sure your attribute tags are the same as the following Hit points = HP Hit dice = HD Constitution score = constitution Constitution modifier = con You can change these in the script under tagHP, tagHD etc. but just make sure they are the same in the script and in your character sheet on roll20. You may also hide all the chat output from your players by editing "hiddenOutput = false;" to "hiddenOutput = true;" without quotation marks. How it works: There are four functions to this API 1. Straight stat modifier - !stat HP 10 This will either add or subtract a specific value, or dice roll, to or from the attribute. eg. Add 15 or 3d5 temporary hitpoints or 1 temporary AC. 2. Ability Score + ability score modifier calculator and editor - !ability constitution 4 This will change an ability score eg. Dexterity and calculate the change in modifier using (Ability Score - 10)/2 rounding down. This function can also store the modifier to the character if you choose (see example macros). 3. Temporary hit point calculator and editor - !ability constitution 4 con If you specify the character Hit Dice (total level) and Hit Points (health) as attributes AND edit the code in the "Edit Here" section to match these attributes. The code will calculate the total temporary current and max hitpoints gained or lost due to constitution damage. (This is only called if "con" is present in your attribute). 4. Stat Resetter - !resetStats This function will reset the characters stat to their original thus removing the temporary modifiers. This is done by taking the Max attribute value and equating it to the current. Usage: 1. Select token that to have their stats or ability scores modified. 2. Either type in chat or add the following to a macro: "!stat [name of stat] [number or roll]" or "!ability [name of ability] [number or roll] [name of modifier(OPTIONAL)]" (without quotation marks and square brackets). 3. The name of the stat/ability must be in the tokens attribute. 4. To reset stats type !resetStats to reset all OR !resetStats [name of stat 1] [name of stat 2] .... etc (current value attributes will be reset to max value). Examples 1. !stat hp 1d5 2. !ability constitution -4 3. !ability constitution 1d4 CON 4. !resetStats You can really get creative with the macros for this API, here's one that I use: /emas @{selected|character_name} takes ?{how much?} damage to ?{What ability?}! !ability ?{What ability?} ?{how much?} ?{modifier?} ***This allows you to specify any type of stat damage as a GM and as long as you're selecting the player's token it will take it from their character. You can type 1d4 in the ?{how much?} prompt or specify a flat damage.*** nb. This code does not take inline roles (omit the [[ ]] around your roll eg. [[1d4]] becomes 1d4). Also, this code does not work for the in-game Character Sheets. Please find the Stat Adjuster API here: <a href="https://gist.github.com/GM-King/10621769" rel="nofollow">https://gist.github.com/GM-King/10621769</a> API 3. Ammo Tracker This is a small API that will subtract 1 (arrow, wand charge, bolt, bullet, flaming javelin +1) and whisper the GM with how many are left. Usage: 1. Select token that is firing their ranged weapon or wand. 2. Either type in chat or add the following to a macro: "!ammo [name of ammo]" or "!charges [name of spell]" (without quotation marks and square brackets). 3. The name of the ammo/wand spell must be a tokens character sheet attribute. Examples 3. !ammo arrows 2. !charges magic missiles Please find the ammo tracker here: <a href="https://gist.github.com/GM-King/9776048" rel="nofollow">https://gist.github.com/GM-King/9776048</a> Finally, I hope these APIs are useful. Please don't hesitate to contact me regarding bugs or functionality. Good Luck, GM-King
Hello Gm-King, The script Summoner API seems like a great idea but I am not following it when you write "The name of the monster must be in your character sheet list and the image must be the token image you wish to use...". Where in the character sheet do you create this "list"? Also, when I enable your script, I get the error "Unexpected identifier". Have you had this issue? Barry
1424018935
The Aaron
Pro
API Scripter
He just means that you need to have a character with the name specified in your journal, and that the character portrait needs to have the token image you want in it.
Oh, that makes perfect sense
1424040761

Edited 1424121685
Hi Barry, No I have not received the "Unexpected Identifier" error message. Contact me in private message if you want me to troubleshoot with you. Also, I apologise for my ambiguous wording on the journal entries, I shall rectify this. I also should mention for people playing Pathfinder, the Summoner API works very well with the Monster Importer by Peter W. which I have tweaked a little from its original form. Here is my tweaked version: <a href="https://gist.github.com/83804a5ecfca690add6b.git" rel="nofollow">https://gist.github.com/83804a5ecfca690add6b.git</a>
I dont know if anyone else has mentioned it yet, but the API Repository is something that you can submit your scripts to yourself. It isn't something where the Dev's went in and said, oh these are approved scripts, we will promote them but not others. More details can be found in the forum posting and on the actual API repository page.
1424105897

Edited 1424107083
King said: Hi Barry, No I have not received the "Unexpected Identifier" error message. Contact me in private message if you want me to troubleshoot with you. Also, I apologise for my ambiguous wording on the journal entries, I shall rectify this. I also should mention for people playing Pathfinder, the Summoner API works very well with the Monster Importer which I have tweaked a little from its original form. I cannot find the original thread on this Monster Importer API, if someone can, please link below. That's by Peter W. you'll want to credit him. I don't know if you can submit scripts that are mods of others unless you have their permission (usually you can just commit to their script if they already added it to the repo). Even if you can, it's still bad ethics. <a href="https://app.roll20.net/forum/post/686369/script-pathfinder-mob-slash-character-importer#post-898969" rel="nofollow">https://app.roll20.net/forum/post/686369/script-pathfinder-mob-slash-character-importer#post-898969</a>
Ah okay, I will look into that Roger. Before I took my break from writing APIs it certainly wasn't the case. I am also in agreement Ken. However, if you compare Brandon's summoning script to my current script I'm sure you'll agree the only similarities are the concepts.
Cool, I was only referring to Peter's script. I've never seen your summoning script before. It looks cool!
Thanks for posting this, King. I'm using your monster summoning script for a bunch of spells in my campaign now. Some summon monsters. Others just need token to represent area effects like fireball and grease. This script works great. The only thing that gave me trouble was sizing. Most of my spells had normal sizes that fit existing letters. But a couple of my spells did not. I made some mods to refactor size into separate width and height values and added the sizes I needed as new letters. Ideally, I think the script would be most versatile if it accepted custom values for width and height as part of the command.
1424348196

Edited 1424348384
Thanks Darren, glad it could be of some use. I have updated the Summoner API to allow for a "cust" tag that will let you manual re-size your summoned characters/spells. Example !summon Flaming Sphere cust 140 140 (This will summon a flaming sphere (assuming it is in your journal with a picture) of size 2x2 squares). I have only done a little bit of crash testing so please let me know if you encounter any errors. The script previews do not update so please navigate to the actual gist website for updated version.
Hello King! I wanted to let you know that I really love your script! I had trouble making it work a few weeks ago for some reason, but the error I was getting no longer appears for some reason... I have a question about it though. Is it necessary, because of script limitations, for this program to "summon" the picture of the creature that a character wishes to summon, or can it be made to bring the default token within the journal entry?
Hi Barry, I'm glad you're finding it useful! Yes, I believe so. It is the first issue I encountered when trying to make this script which is where Brandon's concept came into play. Since the default token's values are not accessible you must essentially create a new token from scratch every time you "summon" a creature. It takes attributes from the token that was selected when the API was called as well as the journal entry to get around this.
1424392724
The Aaron
Pro
API Scripter
Side note: Default token is a read only property on Chatacter with Update of Holding
This script is throwing a "TypeError: Cannot call method 'replace' of undefined" for me when I try to use it to summon a token for my druid's animal forms specifically her dire wolf. Is it possible that the name starting with a d is bugging the script out when it evaluates for rolls?
I found the error and fixed it. I replaced the string search that was looking for the letter d in a string that was 4 or less characters long with the RegExp /\dd/.test(section[j]) and it works like a charm!
Wow, thanks Jason. I can't believe I overlooked this. Your method works well, I didn't even realise you could do this! I've added some more code now so that you can even summon a creature named 1d3! (not sure why anyone would do this but I enjoy coding for the sake of coding). @The Aaron, this is probably a game changer. I'm going to have to look into this.
All of my default tokens in the journal entry have attributes attached to them, and I haven't found a way to do this for the attached picture yet. Have you found a solution for this yet King? Of course what I mean is that the journal entry has many attributes such as initiative, weapon bonus, etc so that when I drag the token to the screen, I can use macros to utilize the attributes. Can this be done with journal entry "pictures"?? Your work is greatly appreciated!
@King, Thanks again for this summon script. It worked like a charm in my game last night to summon spell effect tokens and my players with such spells loved it. I was happy too because it was one less thing I needed to control in the thick of combat. I do have one suggestion. I would love an "unsummon" capability. Currently, my wizards can bring out their fireballs and position them appropriately but when the spell duration ends I need to delete the tokens. Even though the players have control of the tokens, they can't delete them. I understand why token deletion is and should be limited, in general, to the GM but, in this case, it would be nice if my wizards could clean up after themselves. If an unsummon script could be added to allow deletion by token-id, then I could add token actions to the spells' character sheets to trigger unsummoning macros. If you are so inclined to make such a change, I'd be very grateful. If not, I'd appreciate any comments you might have on the feasibility of such a script. I've never written a script before and I don't understand much of the API, so I would be grateful just to know whether such a thing is possible. Thanks, Darren