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
This post has been closed. You can still view previous posts, but you can't post any new replies.

[Script] PowerCards 3 ~ Now contains logic!™

1432681444

Edited 1433161511
June 1st, 2015 ~ 8:30 am eastern Version: 3.2.1 Update: Referring to a roll id without adding .base or .total will now default to .total instead of crashing the script. Example: ?? $Atk &gt;= @{target|AC} ?? will default to the total result of [[ [$Atk] 1d20 + 4 ]] instead of the base roll of just the d20. May 31st, 2015 ~ 9:45 am eastern Version: 3.2.0 MAJOR UPDATE: How conditionals work have been changed and will break any macro using the old style of conditionals. Old Example: ?? $ID base|total symbol target ?? New Example 1: ?? Left vs Right ?? New Example 2: ?? $Atk1.base == 20 ?? New Example 3: ?? $Atk.total &gt; $Def.total ?? New Example 4: ?? $Atk.total &gt;= @{target|AC} ?? May 29th, 2015 ~ 1:10 pm eastern Version: 3.1.2 Bugfix: Single value inline rolls like [[5]] will not crash the script anymore. May 29th, 2015 ~ 6:20 am eastern Version: 3.1.1 Bugfix: Fixed the script crashing if you had two tags next to each other without spaces. Example: --tag 1|content--tag 2|content Bugfix: Fixed a type (doInlineFomatting -&gt; doInlineFormatting) Bugfix/Update: Removed old code that didn't need to be in the script anymore regarding expanded rolls. Expanded rolls should work very much better now. If you want to combine a bunch of modifiers together, wrap them in a nested inline roll and be sure to add + 0d0 at the end if there are no dice rolls inside the nested roll or you are adding comments for readability. Good: [[ 1d20 + [[ floor(@{Strength}/2)-5 [Str Mod] + 3 [Weapon Proficiency Bonus] + 0d0 ]] ]] Good: [[ 1d20 + [[ floor(@{Strength}/2)-5 + 3 ]] ]] Bad: [[ 1d20 + [[ 4 [Str] + 3 [Wpn] ]] ]] &lt;-- This will fail. May 29th, 2015 ~ 1:45 am eastern Version: 3.1.0 Update: Added [trkr] to the list of roll options. This will add the following to the Turn Order Tracker in this order... Token Name / Picture (requires use of --tokenid|@{selected|token_id} ) Character Name (requires use of --charid|@{character_id} ) Display Name Example: [[ [trkr] 1d20 + 4 [Dex Mod] ]] Bugfix: Fixed problem with looking for inline rolls or rollable tables in non-existent emotes... shouldn't crash now if you use a powercard that does not use the --emote tag. May 28th, 2015 ~ 7:00 pm eastern Version: 3.0.6 Update: Inline rolls and rollable tables now show up in emotes. Update: Added [txt] as a roll option to show a roll as text instead of an inline roll. Bugfix: Cleaned up code involving labels and comments in inline rolls and removing roll options from the tooltip display to reduce garbage/clutter. May 28th, 2015 ~ 10:00 am eastern Version: 3.0.5 Bugfix: Corrected tooltip on inline rolls when using the less than symbol Bugfix: Corrected logic for custom fumble rolls not highlighting custom fumbles properly Update: Added --titlefontvariant and --subtitlefontvariant to the list of format tags you can use to format things! ( request per GenKitty ) May 27th, 2015 ~ 11:20 pm eastern Version: 3.0.4 Bugfix: Corrected incorrect case of PlayerTXColor on line 253 Bugfix: Added error checking for non-existent attributes when using an @{attribute} as a target number. Such as looking for AC with @{target|AC} on a token or character that does not have an AC attribute. This will no longer crash the script and will default to a value of zero. It will also send an error message to the person who triggered the script. May 27th, 2015 ~ 11:20 am eastern Version: 3.0.3 Update/Bugfix: Calculated attributes will now work as a target number as long as they are nested in an inline roll. This also means any inline rolls will work as a target number as well. Example: ?? $Atk total &gt;= [[@{target|AC}]] ?? May 27th, 2015 ~ 10:20 am eastern Version: 3.0.2 Update: Added multiple whisper targets as an option for the --whisper tag. Simply put in a list of names separated by commas. This probably won't work with characters that have multiple word names separated by spaces just yet. Possible update on Dev will fix this issue. It doesn't matter if you have spaces before or after the name. Example: --whisper|Anna, Bob, Carly, Dmitri Update: Added a modulo option for conditionals. You can use this to check if a roll/number is odd, even, or evenly divisible by the target number. Example: ?? $Atk base % 2 ?? would return true if the number was even (shown), false if odd (hidden). Example: ?? $Atk base ~% 2 ?? would return false if the number was even (hidden), true if odd (shown). The tilde in front of the percent sign negates the true option, making it false instead. Basically a reverse. May 27th, 2015 ~ 2:50 am eastern Version: 3.0.1 Bugfix: --whisper|self works again Update: Conditional logic works better and you can use any value you want as the ID if you want to test a roll query instead. This should prove handy if you are playing something like D&D 5e and only want to show one roll instead of two if you don't have advantage or disadvantage. The next step will be to allow you to compare Roll vs Roll, which would create some wildly complicated logic that will warp your mind. Example: ?? ?{Advantage|0} base == 1 ??Advantage:|I have advantage. To Do: Add multiple target whispers per Janick H.'s request. Power Cards 3 Link: gist.github.com/Sky-Captain-13/452330a3d926b32da49c What are they? They are simply macro's formatted using --tags that are interpreted by the script to apply html and css to contents of the macro. This string is then sent to the chat window via the API using /direct to allow the html and css formatting to work. This has the benefit of reducing the spam in the chat window (while admittedly creating a new kind of spam) and reduces the number of macros needed. This script can turn this... ... or this ... ... into this! Using the Script Note: You must be a mentor level subscriber to Roll20 to utilize API scripts. Step 1: Copy the script into the API section of your campaign and save it. Step 2: Create macros/abilities for your monsters, characters, magic items, or whatever else you want to use it for. D&D 4e Example: !power {{ --emote|HoneyBadger resorts to the simple attack he learned when he first picked up a weapon. --format|atwill --name|Melee Basic Attack --leftsub|At-Will --rightsub|Standard Action --Attack|[[1d20 + 4 [Strength Mod] + 3 [Longsword Prof.]]] vs AC --Hit|[[1d8 + 4 [Strength Mod]]] slashing damage }} D&D 5e Example: !power {{ --emote|HoneyBadger slashes at his foe with a longsword. --format|atwill --name|Melee Attack --leftsub|Action --rightsub|Reach 5 ft. --Attack|[[1d20 + 3 [Strength Mod] + 2 [Proficiency]]] | [[1d20 + 3 [Strength Mod] + 2 [Proficiency]]] vs AC --Hit|[[1d8 + 3 [Strength Mod]]] slashing damage }} These two macro's show up as... Using Tags Tags are used to tell the script how to identify the Content that follows and help tell the script what to do in some cases. For example, the --name| tag is used to set the name at the top of the power card. Tag Format Examples: GOOD: --Tag|Content GOOD: --Effect|This is an effect. GOOD: --A Custom Tag|This is a custom tag. BAD: effect | This is a bad tag. BAD: -BadTag| This is also a bad tag. Tag Options: These are used to further customize the appearance and features of the power cards. Hidden Tag : Adding an exclamation mark ! at the start of a tag will hide that tag and not display it in the power card, but it will show the contents of the tag in the power card. This is useful for adding blocks of text without a tag. Example: --!Tag|Content Indent: Adding a caret mark ^ followed by a number will indent that entire line and its contents slightly. The indentation option ranges from a minimum of zero (used to reset the indent to default) to a maximum of nine, though at nine, you will not have very much room for content at all. Example: --^1Tag|Content The indent tag option can be used in conjunctions with the hidden tag option, but the exclamation mark must be first. Example: --!^1Tag|Content Repeat: To repeat a tag and its contents, add a hash mark followed by the number of times you want the content to repeat. You can also use roll queries to add a pop-up in roll20 to determine the number of times to repeat the tag when you click the macro (see second example). Example: Tag#4|Content Example: Attack#?{Number of attacks|1}|[[1d20+4]] Using the repeat tag will generate unique rolls for each inline roll in each repeated tag. Same Name: This tag option is used to enable the use tags with the same name. Unlike repeating tags, the content is unique to each tag of the same name. To use this tag, add an asterisk * followed by a number (cannot use the same numbers). Example: Tag *1|Content Example: Tag *2|Content Hides Tag & Content: Add a $ in front of the tag to hide the tag and the content. Using ?{Hit delete to show|$} makes this configurable on the fly. Example: --$Tag|Content Example: --?{Hit delete to show Hex damage|$}Hex:|[[1d6]] necrotic damage Reserved Tags: These tags are reserved for specific use by the script and cannot be used for anything else. charid - Gets the character_id of the character triggering the macro. Combines with --emote to create a custom look to emotes. Usage: --charid|@{character_id} emote - Creates an emote on top of the power card. Set CUSTOM_EMOTES to false in script to return to standard Roll20 orange emotes. If you have charid and emote together in the macro to use the power card styled emotes, you can put an exclamation mark in front of the emote to not show the avatar for that macro. Example: --emote|This emote would have an avatar. Example: --emote|!This emote would not have an avatar. format - An option for GM's to make setting text and background colors easier. See the Format Tag section below for more detailed information. Example: --format|atwill Example: --format|encounter name - The name of the power, skill, ability, etc. being used or whatever else you can think of. Appears at the very top of the card. title - Sets a tooltip on the colored title box. Useful for hiding information that would otherwise clutter the chat window. leftsub - Creates a smaller subtitle beneath the name of the power card, left of the diamond if used in conjunction with rightsub. rightsub - Creates a smaller subtitle beneath the name of the power card, right of the diamond if used in conjunction with leftsub. txcolor - Sets the color of the text in the title box using hex code (#000000). bgcolor - Sets the background color of the title box using hex code (#000000). erowtx - Sets the text color of even numbered rows in the body of the power card using hex code (#000000). erowbg - Sets the background color of even numbered rows in the body of the power card using hex code (#000000). orowtx - Sets the text color of odd numbered rows in the body of the power card using hex code (#000000). orowbg - Sets the background color of odd numbered rows in the body of the power card using hex code (#000000). whisper - Sends the title box and body of the power card to the designated target. For example --whisper|GM would send the power card to the GM. target_list - Creates a list of targets in conjunction with multiple uses of the @{target|Nth Target|token_id} roll query for each possible target. Example: --target_list|@{target|1st Target|token_id} | @{target|2nd Target|token_id} | @{target|3rd Target|token_id} A method for replacing text in the powercard with information from the target_list objects will be added later. titlefont - Sets the font of the title of the power card. subtitlefont - Sets the font of the subtitles beneath the title of the power card. bodyfont - Sets the font of the body of the power card. Word of caution, this absolutely will alter the font of the inline rolls as well. corners - Defaults to 5... set to 0 to remove rounded corners or higher to round them even more. titlefontsize - Sets the size of the name of the powercard subtitlefontsize - Sets the size of the text of leftsub and rightsub bodyfontsize - Sets the size of the text in the body of the powercard border - Can be used to set the size style color of borders using this format: --border|1px solid #000 tokenid - This tag lets you use the token image instead of character avatar for custom emotes. Must be used with either: @{selected|token_id} @{target|self|token_id} Inline Roll Options: Add this before the die roll you want to modify and make sure there is a space between the [[ brackets and the roll option. Such as follows: [[ [NH] 1d4 + @{DEX Mod] [Dex Mod] ]] [NH] - Disables inline roll highlighting for crit success and crit failure. [TRKR] - Adds an entity to the Turn Order Tracker. If the powercard macro does not have --tokenid or --charid, it will use the Display Name of the player that triggered the macro. If you use --charid, it will look for a token that is representing the character and use that id, but fall back to the character name if there are no tokens representing the character. [TXT] - Causes an inline roll to show up as text only instead of as an inline roll. [XPND] - (EXPERIMENTAL) This buggy inline roll option expands the roll into the full formula instead of just the result. [[1d20 + @{Dex Mod}]] becomes [(18) + 3 = 21] instead of [21] GOOD: [[ [NH] 1d6]] BAD: [[[NH] 1d6]] Text Formatting: You can use the options below to format text in the content of a tag. These can be combined in any number of ways. **Bold** //Italics// __Underline__ ~L, ~C, ~R aligns text in between those tags to the (L)eft, (C)enter, and (R)ight. ~L This text would be left aligned. ~L ~C This text would be centered. ~C ~R This text would be right aligned. ~R ~~~ inserts a horizontal rule. ^^ adds a line break ^*Indents the first line of a paragraph in the content of a tag. ^*Indents the first line of a paragraph in the content of a tag. @@ <a href="http://www.roll20.net@@" rel="nofollow">www.roll20.net@@</a> - Naked url, requires that ALLOW_URLS to be set to true in the script. @@ <a href="http://www.roll20.net||Roll20@@" rel="nofollow">www.roll20.net||Roll20@@</a> - Hidden url, requires that ALLOW_HIDDEN_URLS to be set to true in the script. @@url||text@@ &lt;-- Must have double bars in between the url and the text. $$#400|This text will be in dark red.$$ The Format Tag The --format tag is one of the more heavily revamped tags in the 2.0 version of power cards. Instead of specifying a game system as it did in the past, it instead can be used to specify the text and background colors of the macro in one tag. The GM of the campaign must create a handout and name it exactly PowerCard Formats so that the script can find the information and parse the formatting info as needed. You absolutely must follow the format shown in the example below to get the --format tag to work properly. This image is an example of the D&D 4e power usage colors. I recommend setting this handout as viewable by all players so that they can see what options are available for them to use in their own power card macros. Target Info Charms This new feature lets you grab info from a character sheet or token by using --target_list|@{target|1st Target|token_id} | @{target|2nd Target|token_id} | etc to create the list of targets and then adding target info charms into the content of your powercard such as %%token_name%% to get the name of the token. The types of charms are broken down into two categories: token charms and attribute charms. Token charms area set list that grab information like bar values and the name of the token. Attribute charms can be any attribute on a character sheet and they are case sensitive. AC is not the same as aC, Ac, or ac. Finally... and this is very important ...all charms referring to a target must be in the same tag. You cannot have charms split between tags. If you want to create a kind of stat sheet, use line breaks ^^ to create new lines. Good Examples !power --name|Single Target Attack --target_list|@{target| |token_id} --Attack|[[1d20+5]] | [[1d20+5]] vs %%AC%% Armor Class (%%token_name%%) --Hit|[[1d8+3]] slashing damage !power --name|Scorching Burst | Nine Targets --target_list|@{target|1st|token_id} | @{target|2nd|token_id} | @{target|3rd|token_id} | @{target|4th|token_id} | @{target|5th|token_id} | @{target|6th|token_id} | @{target|7th|token_id} | @{target|8th|token_id} | @{target|9th|token_id} --Attack#?{Number of targets|1}|[[1d20+5]] vs %%Reflex%% Reflex (%%token_name%%) --Hit|[[1d8+3]] fire damage For a multi-attack power like Scorching Burst in D&D 4e, you create the macro as above and just click nine times and then when the pop up for number of targets appears, type in the actual number of targets in the area and hit enter. The script will ignore the rest of the targets in the list. For example, in the snip below... I clicked nine tokens pretty quickly. Only the first four mattered since those were my actual targets. Then I typed in the number of targets and hit enter when the pop up appeared. !power --name|Stats --target_list|@{target|1st Target|token_id} --Target|%%token_name%% ^^ **Hit Points:** %%bar3%%/%%bar3_max%% ^^ **Defenses:** AC %%AC%%, Fort %%Fortitude%%, Reflex %%Reflex%%, Will %%Will%% Bad Example !power --name|Bad Example --target_list|@{target| |token_id} --Target|%%token_name%% --Attack|[[1d20+5]] | [[1d20+5]] vs %%AC%% Armor Class --Hit|[[1d8+3]] slashing damage to %%token_name%% In the example above, the %%AC%% and second %%token_name%% charms would not be replaced with the proper info. Token Charms %%token_name%% %%bar1%% %%bar1_max%% %%bar2%% %%bar2_max%% %%bar3%% %%bar3_max%% Sample Attribute Charms %%Strength%% %%Strength Mod%% %%Fortitude% %%Reflex%% %%Will%% %%HP%% %%Hit Points%% Other Charms %%who%% - gets the DisplayName of whomever triggered the macro/powercard Contributors The following members of the Roll20 community have greatly aided with the creation and enhancement of this script either through their scripting expertise or their suggestions to improve features of the script and their relentless bug hunts! Alex L. Brian Chris N. Rob J. The Aaron GenKitty Sean G
1432681462

Edited 1433245504
Conditionals Conditionals are simple logic using either the base value of a die roll or the total value of the entire inline roll. They can only be used at the start of a tag right now, but will eventually be able to be used in the content of a tag to selectively show or hide information. Conditionals are used by wrapping them in double question marks at the start of a tag, telling the script which roll to use, whether to use the base value or total, how to compare it, and to what to compare it to. For example... a basic crit macro for a D&D 4e basic melee attack with a long sword: !power {{ --name|Basic Attack --leftsub|Longsword --rightsub|Range Melee --Attack:|[[ [$Atk] 1d20 + 4 [Str Mod] + 3 [Weapon Proficiency] ]] vs AC --Hit:|[[ 1d8 + 4 [Str Mod] ]] slashing damage --?? $Atk.base == 20 ?? Critical Hit:| Add [[1d8]] slashing damage }} Structure of a Conditional ?? LeftValue vs RightValue ?? LeftValue and RightValue can be a number, a roll id ($Roll), or a roll query ( ?{target|AC} ), or even an attribute call ( @{attribute} ). vs can be one of the following operands: &lt;, &lt;=, ==, &gt;=, &gt;, &lt;&gt; (not equal), % (evenly divisible), ~% (not evenly divisible) Very important!! You must have a space between each part of the conditional. No spaces will cause an undefined variable crash. Roll $ID's must be defined in an inline roll as a label in front of the roll you want to use later. It must be in single square brackets and must start with a dollar sign ($). Next, you will want to determine if you are going to check the base value of the roll of the total value of the entire inline roll. For example if you use [[ [$Atk] 1d20 + 4 ]] and roll a 10 on the d20, the base value will be 10 and the total value will be 14. Add .base to the $ID for the base value and .total for the total value ($ID.base or $ID.total). The symbol can be one of the following: &lt;, &lt;=, ==, &gt;=, &gt;, &lt;&gt;, %, and ~%. They are in order: less than, less than or equal to, equal to, greater than or equal to, greater than, not equal to, modulo, and negated modulo (see below). Modulo Symbol The modulo symbol, added in version 3.0.2, is a percentage sign % and can be used to divide the left side by the right side. By itself, modulo will return true if the left side is evenly divisible by the target number. This can be used to show something if it is an even number (?? $ID.base % 2 ??). Adding the tilde ~ in front of the module will negate or reverse the outcome. So if you do ~% 2 instead, it will be true if the number is odd. Extending Conditionals Conditionals can also be extended to test for multiple values, but keep the following in mind... any conditional with AND will stop immediately when it finds a false statement and any conditional with OR will stop immediately when it finds a true statement. Here is an example of an extended conditional with complex logic for a D&D 5e melee attack: !power {{ --name|Basic Attack --leftsub|Longsword --rightsub|Range Melee --Attack:|[[ [$Atk] 1d20 + 3 [Str Mod] + 2 [Proficiency] ]] vs AC --?? $Atk.base == 1 OR $Atk.total &lt; @{target|AC}?? !Miss:|You missed. --?? $Atk.total &gt;= @{target|AC} AND $Atk.base &lt;&gt; 1 AND $Atk.base &lt;&gt; 20 ?? Hit:|[[1d8 + 3]] slashing damage --?? $Atk.base == 20 ?? Critical Hit:|[[2d8 + 3]] slashing damage }} Stacking Conditionals You can also stack conditionals one after the other and they will be executed in that order, left to right. It basically works like AND, but may be a little cleaner to read. May be more useful after conditionals can be used in the content of a tag and not just the tag itself.
1432682560
Gen Kitty
Forum Champion
*happydance*
1432685143

Edited 1432685590
Hey JB, Like the new update. One thing. I keep getting some sort of time stamp inbetween the emote and power card. Looks like this: (20:03) Master MJ (GM) Any ideas how to remove this stamp?
1432686438
Gen Kitty
Forum Champion
You can remove the timestamp by going into the script and finding the section of true/false statements and look for the one belonging to timestamps. Change true to false and save the script.
1432686596
The Aaron
Pro
API Scripter
Nice!
That worked. Thank you very much GenKitty!!
Yeah, I always leave the timestamp on... bad habit, lol. Right now I'm working on the conditionals/logic post... and had an idea for something else to add to conditionals, but it'll take some time to make it work properly. The goal will be to enable use of roll queries in conditionals for something like advantage / disadvantage.
Hi, HoneyBadger--just copied this in to my code, but on clicking save script I get an error message: Unexpected token ) Not sure what that means, but it disables the scripts. I'm also using isGM, TokenMod, Escalation, and the automated bloodied and dead status markers scripts, if that helps?
Robert M. said: Hi, HoneyBadger--just copied this in to my code, but on clicking save script I get an error message: Unexpected token ) Not sure what that means, but it disables the scripts. I'm also using isGM, TokenMod, Escalation, and the automated bloodied and dead status markers scripts, if that helps? I just copied it straight from the gist into my api script tabs and did not get that error. Make sure you copied the whole thing and save it again.
Tried again, got the error again. Disabled the bloodied status markers script and it worked. Seems like there's a conflict between those two. If someone wants to take a look sometime, here's the link to the script that's conflicting with Powercards 3. (For now, though, I'll just keep that disabled.) <a href="https://github.com/Roll20/roll20-api-scripts/tree/" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/tree/</a>...
Janick H. said: I was wondering, if it could be possible to implement an option to use the --whisper tag to whisper to multiple people? I have an idea of how it could be done, but I am unsure if it is the best way to do it: From the other thread... I will be adding this in the next update.
With the Old Power Cards we use to be able to do whisper|self. What is the code for that now?
I'll add that to the list of things to fix.
1432703647
Gen Kitty
Forum Champion
Well, hm. Updated to v3.0.0 and I'm getting this error when i run the --version test: /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ ReferenceError: hexDec is not defined at getBrightness (evalmachine.&lt;anonymous&gt;:87:25) at handleInput (evalmachine.&lt;anonymous&gt;:92:29) at eval ( Also, the on-ready statement isn't printing to the console. x.x Testing has come to an end for now.
Yeah, I forgot to remove the double slashes in front of the on-ready statement and there shouldn't be any hexDec function anymore. I re-named them. Did you just copy part of the script over?
1432704365
Gen Kitty
Forum Champion
I removed the doubleslash, so now I'm getting the on-ready, but I doublechecked that I have every line and I'm still getting that error. Your gist says 757 lines, my script window says 757 lines.
1432704474

Edited 1432704691
Weird. I'm not getting an error, but I'm not getting any whispers either. Nevermind, I re-loaded the campaign window (not the scripts window) and now I am getting whispers and the version info correctly. Do you perhaps have an old version of the script still running somewhere? Bleh... something is up with whispers. I can get them when my displayname is set to HoneyBadger (GM) but not when I use the drop down to select a character name. &gt;_&lt;
1432704829
Gen Kitty
Forum Champion
I suppose there is the barest chance there's a ghost somewhere. I selected-all in the 2.x script, deleted it, and then pasted the 3.0 script in. But having restarted the sandbox a few times since then, I'd be REALLY surprised if a 2.x version was ghosted in. The script crashes post-whisper when I do the version check.
GenKitty said: I suppose there is the barest chance there's a ghost somewhere. I selected-all in the 2.x script, deleted it, and then pasted the 3.0 script in. But having restarted the sandbox a few times since then, I'd be REALLY surprised if a 2.x version was ghosted in. The script crashes post-whisper when I do the version check. I don't know... I did a search for hexDec in the gist and didn't find a single reference. &gt;_&lt;
1432706460
Gen Kitty
Forum Champion
I did a search in what I have and didn't find it either. This is REALLY confusing.
GenKitty said: I did a search in what I have and didn't find it either. This is REALLY confusing. Has to be a ghost version of the script still running in the background then.
1432707927
Gen Kitty
Forum Champion
HoneyBadger said: GenKitty said: I did a search in what I have and didn't find it either. This is REALLY confusing. Has to be a ghost version of the script still running in the background then. Well, how do I exorcise this ghost? :P
I have no idea...
... on the bright side, I did figure out the whisper problem. I had to add myself as a player that can control/edit the character in question to receive whispers. Adding 'All Players' doesn't forward the whisper to all players. Off to bed now. Got a face to face session of D&D to prepare for tomorrow. Hope you get things sorted GK. :(
May 27th, 2015 ~ 2:50 am eastern Version: 3.0.1 Bugfix: --whisper|self works again Update: Conditional logic works better and you can use any value you want as the ID if you want to test a roll query instead. This should prove handy if you are playing something like D&D 5e and only want to show one roll instead of two if you don't have advantage or disadvantage. The next step will be to allow you to compare Roll vs Roll, which would create some wildly complicated logic that will warp your mind. Example: ?? ?{Advantage|0} base == 1 ??Advantage:|I have advantage. To Do: Add multiple target whispers per Janick H.'s request.
The logic stuff sounds like it should be pretty cool, especially for a system like 13th Age. :-) Just to check--if I wanted to set up something to evaluate an Even or Odd natural roll (using a roll labeled $Atk), I would basically just list all the possible evens/odds on the die type, using OR conditions, right? So it'd be, say: --?? $Atk base == 2 OR $Atk base == 4 OR $Atk base == 6 OR $Atk base == 8 OR $Atk base == 10 OR $Atk base == 12 OR $Atk base == 14 OR $Atk base == 16 OR $Atk base == 18 OR $Atk base == 20 ?? Even Roll: | Whatever the effect of an even roll is Is that right?
Yeah. I should look into adding some option for that so you don't have to list out all of them.
And done! I will post an update once I add the multiple target whispers option. !power {{ --name|Even/Odd Rolls --Roll:|[[ [$Roll] 1d20 ]] --?? $Roll base % 2 ??| Roll is even. --?? $Roll base ~% 2 ??| Roll is odd. }}
Not a priority--that's not that hard once you've done it once. :-) But if you end up doing it, that'd be cool! Now, if I use multiple lines of conditionals like so: --?? $Atk base == 20 ?? Critical Hit: | Critical hit effect --?? $Atk base == 2 OR $Atk base == 4 OR $Atk base == 6 OR $Atk base == 8 OR $Atk base == 10 OR $Atk base == 12 OR $Atk base == 14 OR $Atk base == 16 OR $Atk base == 18 OR $Atk base == 20 ?? Even Roll: | Whatever the effect of an even roll is If a 20 is rolled, would this display both lines, or just the first one that evaluates true? It sounded above like that would mean it would just show the first to evaluate true, but I wasn't sure if I was reading that right.
Sorry, missed your second reply about the even/odd thing in the process. :-P
Each tag / conditional is evaluated separately. They don't really interact at all. So if you rolled a 20, both of those would show.
May 27th, 2015 ~ 10:20 am eastern Version: 3.0.2 Update: Added multiple whisper targets as an option for the --whisper tag. Simply put in a list of names separated by commas. This probably won't work with characters that have multiple word names separated by spaces just yet. Possible update on Dev will fix this issue. It doesn't matter if you have spaces before or after the name. Example: --whisper|Anna, Bob, Carly, Dmitri Update: Added a modulo option for conditionals. You can use this to check if a roll/number is odd, even, or evenly divisible by the target number. Example: ?? $Atk base % 2 ?? would return true if the number was even (shown), false if odd (hidden). Example: ?? $Atk base ~% 2 ?? would return false if the number was even (hidden), true if odd (shown). The tilde in front of the percent sign negates the true option, making it false instead. Basically a reverse.
Excellent. Thank you. :-)
Hm--this appears to work vs general numbers, but doesn't appear to work when comparing to a calculated value. For instance, AC/PD/MD in my 13th Age sheet are calculated from the character's base PD, level, magic bonuses, stat bonuses, and temporary bonuses. This code evaluates: --?? $Atk total &gt;= @{target|Target1|BasePD} ?? Test:|Greater than Def. This code does not: --?? $Atk total &gt;= @{target|Target1|PD} ?? Test:|Greater than Def. The only difference is that BasePD is just a number, while PD is a calculated value from the character sheet. No error messages are passed to chat or to the API interface.
Taking a look at this now.
Ok, looks like you're gonna have to use nested rolls... and I will need to adjust how the script reads the target number if it's an inline roll. Shouldn't be too difficult.
May 27th, 2015 ~ 11:20 am eastern Version: 3.0.3 Update/Bugfix: Calculated attributes will now work as a target number as long as they are nested in an inline roll. This also means any inline rolls will work as a target number as well. Example: ?? $Atk total &gt;= [[@{target|AC}]] ??
1432742281

Edited 1432742377
I'm trying your example above: !power {{ --name|Basic Attack --leftsub|Longsword --rightsub|Range Melee --Attack:|[[ [$Atk] 1d20 + 3 [Str Mod] + 2 [Proficiency] ]] vs AC --?? $Atk base == 1 OR $Atk total &lt; @{target|AC}?? !Miss:|You missed. --?? $Atk total &gt;= @{target|AC} AND $Atk base &lt;&gt; 1 AND $Atk base &lt;&gt; 20 ?? Hit:|[[1d8 + 3]] slashing damage --?? $Atk base == 20 ?? Critical Hit:|[[2d8 + 3]] slashing damage }} and I only show damage if I crit. Shouldn't it show damage if I hit in general? AC is 15
Probably need to update to version 3.0.3 and put @{target|AC} in an inline roll. Whatever AC attribute you're calling is probably a calculated attribute instead of a number.
Awesome--working now for me. Thank you!
Now getting this error: evalmachine.&lt;anonymous&gt;:7425 if (Target.indexOf("$[[") !== -1) Target = parseInt(x[0].i ^ TypeError: Cannot call method 'indexOf' of undefined at evalmachine.&lt;anonymous&gt;:7425:32 at Array.forEach (native) at evalmachine.&lt;anonymous&gt;:7407:14 at checkFinishedOps (
Also I am stupid and have no idea what you mean by putting it in inline roll.
Put @{target|AC} in an inline roll. ?? $Atk base == 1 OR $Atk total &lt; [[@{target|AC}]] ??
Here's an odd one: I have a powercard for rolling initiative, and it worked in earlier Powercards versions, but now sends a different result to the tracker than what the powercard displays (usually quite drastically different, like showing a roll of 23 but posting initiative 11). !power {{ --charid|@{character_id} --emote|@{selected|token_name} rolls initiative! --format|battle --name|Initiative^^(Quick to Fight) --Initiative|[[2d20kh1+@{Initiative} &{tracker}]] }} I've tested the initiative roll there both as an inline roll and with the /roll code separately, and in both cases it is fine. The error only happens when using the PowerCard. My best guess would be that maybe PowerCards is rolling initiative to display, but then somehow rerolling it to post to tracker?
Still getting this error: evalmachine.&lt;anonymous&gt;:7425 if (Target.indexOf("$[[") !== -1) Target = parseInt(x[0].i ^ TypeError: Cannot call method 'indexOf' of undefined at evalmachine.&lt;anonymous&gt;:7425:32 at Array.forEach (native) at evalmachine.&lt;anonymous&gt;:7407:14 at checkFinishedOps (
1432744775

Edited 1432744862
Robert M. said: Here's an odd one: I have a powercard for rolling initiative, and it worked in earlier Powercards versions, but now sends a different result to the tracker than what the powercard displays (usually quite drastically different, like showing a roll of 23 but posting initiative 11). !power {{ --charid|@{character_id} --emote|@{selected|token_name} rolls initiative! --format|battle --name|Initiative^^(Quick to Fight) --Initiative|[[2d20kh1+@{Initiative} &{tracker}]] }} I've tested the initiative roll there both as an inline roll and with the /roll code separately, and in both cases it is fine. The error only happens when using the PowerCard. My best guess would be that maybe PowerCards is rolling initiative to display, but then somehow rerolling it to post to tracker? Oh yeah... I changed how powercards handles inlinerolls to avoid nested sendChat calls to get dice rolls and that means powercards doesn't play well with initiative. I will add a roll option like nh and xpnd that will add the selected token/character to the tracker.
Kunguru said: Still getting this error: evalmachine.&lt;anonymous&gt;:7425 if (Target.indexOf("$[[") !== -1) Target = parseInt(x[0].i ^ TypeError: Cannot call method 'indexOf' of undefined at evalmachine.&lt;anonymous&gt;:7425:32 at Array.forEach (native) at evalmachine.&lt;anonymous&gt;:7407:14 at checkFinishedOps ( Are you using version 3.0.3 and what is the macro that is causing that error?
yep, using 3.0.3. using the following: !power {{ --name|Basic Attack --leftsub|Longsword --rightsub|Range Melee --Attack:|[[ [$Atk] 1d20 + 3 [Str Mod] + 2 [Proficiency] ]] vs AC --?? $Atk base == 1 OR $Atk total &lt;[[@{target|ac}]]?? !Miss:|You missed. --?? $Atk total &gt;= [[@{target|ac} ]] AND $Atk base &lt;&gt; 1 AND $Atk base &lt;&gt; 20 ?? Hit:|[[1d8 + 3]] slashing damage --?? $Atk base == 20 ?? Critical Hit:|[[2d8 + 3]] slashing damage }}
You need a space between the &lt; and [[@{target|ac}]].