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] AdvantageTracker v0.3.x for 5th Edition Shaped Sheet 2.1.13+

1457362732

Edited 1458670423
Version 0.3.5: Support all of the roll options in 2.2.15+ of the Shaped Sheet, including normal, advantage, disadvantage, and roll2. (Thank you Kryx! ) Added roll2 option to the "--createquery" option. Added roll2 option to the "--create" option and added a configuration to control whether or not the roll2 macro is automatically created. I added the "createRoll2TokenAction" option because I believe that most people using this script will be focused on the 3 standard tabletop cases (normal, advantage, disadvantage), so the roll2 macro felt somewhat unnecessary. By default createRoll2TokenAction is set to false. NOTE: This version of the script will not work with earlier versions of the Shaped Sheet due to the changes with the Roll Options in version 2.2.15+. Version 0.3.4: Fixed a script crash introduce in 0.3.3 that occurs when adding a token to the tabletop that doesn't represent a character. Version 0.3.3: Added a new configuration token named ignoreNpc, it has the following options: true - this option means that AdvantageTracker will ignore all NPC, meaning it will not update tokens or change the roll setting if the character journal entry is an NPC. Useful for GM's that roll "behind the screen" and always have a set configuration for their NPCs false - this is the default option. Both PC and NPC can fully utilize the features of AdvantageTracker. Tokens pulled onto the tabletop from the character journal will now automatically get status markers based on their settings. Version 0.3.2: Added a new configuration token named chatNotificaitons, it has the following options: "chat" - this is the default option and will send messages to the chat for everyone to see. "disabled" - this eliminates any messages for changing Advantage/Disadvantage states. "whisperPlayer" - this sends a whisper to the player who changed Advantage/Disadvantage states. "whisperGM" - this sends only messages to the GM when anyone changes their Advantage/Disadvantage states. All updates are now sent via the shaped sheet roll template for chat consistency. Version 0.3.1: This script is designed to use Ability macros to easily set the value of the Roll Options on the 5th Edition Shaped Sheet v2.1.13+ during play. &nbsp;If the character is represented by a valid token, it will set a status marker on the token as a visual reminder that advantage/disadvantage is enabled. &nbsp; The major improvement in the 0.3.0 release is the ability to run any of the options while selecting multiple tokens, as well as removing the need to ever supply a token_id. &nbsp;Simply select all of the tokens that you want to change and execute the relevant command. &nbsp; Syntax: !at --&lt;option&gt; --&lt;character_id1&gt; --&lt;character_id2&gt; ... The &lt;option&gt; parameter is required. &nbsp;The &lt;character_id&gt; parameter is optional. &nbsp; Examples: !at --advantage --@{TheAaron|character_id} --@{Kryx|character_id} --@{Silvyre|character_id} !at --disadvantage !at --normal Options: !at --advantage This command will switch the character sheet(s) to the "Roll with Advantage" option on the character sheet. A message is sent to chat that the character now has advantage. It also sets a visual indicator on the token that advantage is currently enabled. !at --normal This command will switch the character sheet(s) to the "Roll 1 dice" option on the character sheet. A message is sent to chat that the character rolling normally. It removes any visual indicators on the token. !at --disadvantage This command will switch the character sheet(s) to the "Roll with Disadvantage" option on the character sheet. A message is sent to chat that the character now has disadvantage. It also sets a red dot on the token giving a visual indicator that disadvantage is currently enabled. !at --create This simply creates "Adv", "Norm", and "Dis" Ability macros for the selected character(s). These Ability macros simply run the commands above. Token Actions are enabled by default (see configuration options below), but they could also be placed in the macro bar. &nbsp;In order for the macros to be placed in the macro bar it creates the macros with the optional --@{character|character_id} syntax. !at --createquery This simply creates "Adv/Dis" Ability macro query for the selected character. These Ability macro query simply runs the commands above based on the option chosen in the query. Token Actions are enabled by default (see configuration options below), but they could also be placed in the macro bar. &nbsp;In order for the macros to be placed in the macro bar it creates the macros with the optional&nbsp;--@{character|character_id} syntax. There are 3 configuration options at the top of the script (config = default value): showAsTokenAction = true Setting true will automatically enable any newly created token actions. Setting false leaves newly created token actions disabled. advantageMarker = "green" disadvantageMarker = "red"; The full list of status markers that are available (in the same order they appear in the marker tray): "red", "blue", "green", "brown", "purple", "pink", "yellow", "dead", "skull", "sleepy", "half-heart", "half-haze", "interdiction", "snail", "lightning-helix", "spanner", "chained-heart", "chemical-bolt", "death-zone", "drink-me", "edge-crack", "ninja-mask", "stopwatch", "fishing-net", "overdrive", "strong", "fist", "padlock", "three-leaves", "fluffy-wing", "pummeled", "tread", "arrowed", "aura", "back-pain", "black-flag", "bleeding-eye", "bolt-shield", "broken-heart", "cobweb", "broken-shield", "flying-flag", "radioactive", "trophy", "broken-skull", "frozen-orb", "rolling-bomb", "white-tower", "grab", "screaming", "grenade", "sentry-gun", "all-for-one", "angel-outfit", "archery-target" Thank you to The Aaron for his assistance and guidance with this script. &nbsp;Thank you to Kryx for helping with the changes required to support 2.2.15. Script can be found here: <a href="https://raw.githubusercontent.com/beeke01/Advantag" rel="nofollow">https://raw.githubusercontent.com/beeke01/Advantag</a>...
1457365571
The Aaron
Pro
API Scripter
Kevin said: !at --advantage&nbsp;--@{TheAaron|character_id} I have been told I'm "quite the character" before... =D &nbsp;Happy to help. =D
Awesome improvements!!
Version 0.3.1 Refactor script to address an issue where the token status markers may not be properly updated when the same character token exists on multiple pages. &nbsp;Now all tokens on all pages are updated. &nbsp;(This was a large rewrite of key code by The Aaron , Thank you again!) The script is no longer limited to a single character_id parameter. &nbsp;If you wish to use multiple character_id parameters, use the following syntax: !at --&lt;option&gt; --&lt;character_id1&gt; --&lt;character_id2&gt; ... Example: !at --advantage --@{TheAaron|character_id} --@{Kryx|character_id} --@{Silvyre|character_id}
1457415967
The Aaron
Pro
API Scripter
Cool. &nbsp;=D &nbsp;I see I'm in good company. &nbsp;=D
+1 for this. I disabled the send to chat line and using this instead to keep things consistent in chat. &nbsp;:P I have one for myself that whispers it to me for NPCs. &{template:5e-shaped} {{title=Roll setting change!}} {{text_top=@{selected|character_name} is now rolling with advantage!}}
Would it be possible to use this with the 1.x Shaped sheet? &nbsp;
Savare said: Would it be possible to use this with the 1.x Shaped sheet? &nbsp; I doubt it, as things have changed since that release. &nbsp;I'd wait for v2.2.13+ goes public.
Version 1.x of the shaped sheet did not have the same roll options as 2.x.x, so no, this would not work on version 1.x.
Kaelev said: +1 for this. I disabled the send to chat line and using this instead to keep things consistent in chat. &nbsp;:P I have one for myself that whispers it to me for NPCs. &{template:5e-shaped} {{title=Roll setting change!}} {{text_top=@{selected|character_name} is now rolling with advantage!}} It is possible to have different options for how to send to chat, and sending via the Roll Template makes sense, let me think about how to approach that.
Kevin said: Kaelev said: +1 for this. I disabled the send to chat line and using this instead to keep things consistent in chat. &nbsp;:P I have one for myself that whispers it to me for NPCs. &{template:5e-shaped} {{title=Roll setting change!}} {{text_top=@{selected|character_name} is now rolling with advantage!}} It is possible to have different options for how to send to chat, and sending via the Roll Template makes sense, let me think about how to approach that. That would be awesome if it went through the roll template. &nbsp;I must have missed the option for how it's sent to chat. &nbsp;Is there a way to disable it without using // on that particular line?
@Kaelev - It currently isn't an option, however I plan to make it one, just need to test out a few ideas.
Version 0.3.2: Added a new configuration token named chatNotificaitons, it has the following options: "chat" - this is the default option and will send messages to the chat for everyone to see. "disabled" - this eliminates any messages for changing Advantage/Disadvantage states. "whisperPlayer" - this sends a whisper to the player who changed Advantage/Disadvantage states. "whisperGM" - this sends only messages to the GM when anyone changes their Advantage/Disadvantage states. All updates are now sent via the shaped sheet roll template for chat consistency. For anyone using this, please let me know your thoughts (good or bad) and let me know if anyone would like additional enhancements.
Excellent. I have a game tonight, so when I get home, I'll add the newest API version and see how looks.&nbsp;
Version 0.3.3: Added a new configuration token named ignoreNpc, it has the following options: true - this option means that AdvantageTracker will ignore all NPC, meaning it will not update tokens or change the roll setting if the character journal entry is an NPC. &nbsp;Useful for GM's that roll "behind the screen" and always have a set configuration for their NPCs false - this is the default option. &nbsp;Both PC and NPC can fully utilize the features of AdvantageTracker. Tokens pulled onto the tabletop from the character journal will now automatically get status markers based on their settings.
Version 0.3.4 Fixed a script crash introduce in 0.3.3 that occurs when adding a token to the tabletop that doesn't represent a character.
Making the current link to the specific 0.3.4 version while I make the required changes to support the new roll options in 2.2.15+ of the Shaped Sheet.
1458670155

Edited 1458670173
Version 0.3.5: Support all of the roll options in 2.2.15+ of the Shaped Sheet, including normal, advantage, disadvantage, and roll2. Added roll2 option to the "--createquery" option. Added roll2 option to the "--create" option and added a configuration to control whether or not the roll2 macro is automatically created. I added the "createRoll2TokenAction"&nbsp;option because I believe that most people using this script will be focused on the 3 standard tabletop cases (normal, advantage, disadvantage), so the roll2 macro felt somewhat unnecessary. &nbsp;By default createRoll2TokenAction is set to false. NOTE: &nbsp;This version of the script will not work with earlier versions of the Shaped Sheet due to the changes with the Roll Options in version 2.2.15+.
Can this be updated to maybe include the other options? Such as Showing AC? Show targets name? I know its not the reason for the script, but I was just wondering :0
1459083749
Kryx
Pro
Sheet Author
API Scripter
Those items are seemingly something that should be set once and then forgotten.
True, its more to do from a DM set up point of view, I want my monsters to have it, but not PCs etc so its not good enough to set them to the default via the Character Sheet. If the intention is to do this, thats alright. :)
I believe that Lucian wants to cover configuration options as part of the Shaped Support script because it was a feature of the previous script, but will reach out and confirm with him, no sense in duplicating effort.
No Problem, in the end, I found that Kyrxs point was more valid an option, another request I had was the management of spell slots from the spellbook somehow? Or maybe a script you can suggest to handle spellslots through the chat?
Saevar L. "Liquid-Sonic" said: No Problem, in the end, I found that Kyrxs point was more valid an option, another request I had was the management of spell slots from the spellbook somehow? Or maybe a script you can suggest to handle spellslots through the chat? This would probably make for a good resource tracking script, probably good to be part of shaped-support script. &nbsp;I will have to see how Lucian handles arrows, because I suspect that the logic will be similar for spells/spell slots. &nbsp;Same thing can be said for Hit Dice and other resources, it would also be good to have commands for short and long rest though this then starts to get more and more complex.
1459619668
Kryx
Pro
Sheet Author
API Scripter
Those things are already in progress for the shaped companion script.
1459887190
Lucian
Pro
API Scripter
Yes, I'm working on this now. Please come over to&nbsp;<a href="https://app.roll20.net/forum/post/3052131/script-5e-shaped-support-script/" rel="nofollow">https://app.roll20.net/forum/post/3052131/script-5e-shaped-support-script/</a> if you want to contribute to the discussion about how it will work.
I think I found a bug in the script. In the updateToken function there is a check to see if the token represents, then tries to get the character object. The bug occurs when a token has been placed that has a character it represents, then the character is deleted but not the token. In this case the token's 'represents' is not empty, but the getObj to grab the character returns an undefined object. I would suggest changing the check to: character = getObj('character', token.get('represents')); if (!character) { return; } instead of : if (token.get('represents') === "") { return; &nbsp; } character = getObj('character', token.get('represents'));
BP said: I think I found a bug in the script. In the updateToken function there is a check to see if the token represents, then tries to get the character object. The bug occurs when a token has been placed that has a character it represents, then the character is deleted but not the token. In this case the token's 'represents' is not empty, but the getObj to grab the character returns an undefined object. I would suggest changing the check to: character = getObj('character', token.get('represents')); if (!character) { return; } instead of : if (token.get('represents') === "") { return; &nbsp; } character = getObj('character', token.get('represents')); FYI... This is being incorporated into the shaped-support script. As far as the problem goes, I had something similar previously, but I think if you set it up like that when you place a new token (such as pulling it from the library) it fails... but I don't remember the specific use case. &nbsp;I can try to look into it once I am back in town (April 15th) if this functionality hasn't already been incorporated into shaped-support script.