Update: March 28th, 2015 ~ 2:50 am eastern Version: 2.4.11 Script Link: gist.github.com/Sky-Captain-13/452330a3d926b32da49c Update: Replaced target_info parsing logic with TheAaron's replacement. No change to macros needed. Update: Thanks to TheAaron, you can now format powercard macros on separate lines instead of as one long line, as shown below: !power --tokenid|@{selected|token_id} --emote|Pikkle unleashes a blast of eldritch energy. --format|atwill --name|Eldritch Blast --title|Components: V, S ^^ Duration: Instantaneous ^^ Eldritch Blast creates additional beams at 5th, 11th, and 17th level. You can direct all the beams on the same target or at different ones. Make a separate attack roll for each beam. --leftsub|Standard Action --rightsub|Range 120 ft. --Attack:|[[ 1d20cs>2 + 4 [Cha Mod] + 2 [Proficiency] ]] | [[ 1d20 + 4 [Cha Mod] + 2 [Proficiency] ]] vs AC --Hit:|[[ [NH] 1d10 ]] force damage and the target is pushed up to 10 ft away --?{Hit delete to show hex damage|$}Hex:|[[1d6]] necrotic damage --Critical Hit:| --!Crit1|^* **+** [[1d10]] force damage --?{Hit delete to show hex damage|$}!HexCrit|^* **+** [[1d6]] necrotic damage
... becomes ...
!power {{
--tokenid|@{selected|token_id}
--emote|Pikkle unleashes a blast of eldritch energy.
--format|atwill
--name|Eldritch Blast
--title|Components: V, S ^^ Duration: Instantaneous ^^ Eldritch Blast creates additional beams at 5th, 11th, and 17th level. You can direct all the beams on the same target or at different ones. Make a separate attack roll for each beam.
--leftsub|Standard Action
--rightsub|Range 120 ft.
--Attack:|[[ 1d20cs>2 + 4 [Cha Mod] + 2 [Proficiency] ]] | [[ 1d20 + 4 [Cha Mod] + 2 [Proficiency] ]] vs AC
--Hit:|[[ [NH] 1d10 ]] force damage and the target is pushed up to 10 ft away
--?{Hit delete to show hex damage|$}Hex:|[[1d6]] necrotic damage
--Critical Hit:| --!Crit1|^* **+** [[1d10]] force damage
--?{Hit delete to show hex damage|$}!HexCrit|^* **+** [[1d6]] necrotic damage
}}
Minor Update: March 18th, 2015 ~ 10:45 am eastern Version: 2.4.9 Script Link: gist.github.com/Sky-Captain-13/452330a3d926b32da49c Minor Update: Added %%who%% per yet another request from GenKitty, use this charm to add the player's display name to a powercard. Example: [Ready Check](!power --name|%%who%% is ready! --corners|0) If you just want to add this to your existing install, replace Line 48 with the following: var n = msg.content.replace("%%who%%", player_obj.get("displayname")).split(" --"); Bugfix & Update: March 16th, 2015 ~ 11:15 am eastern Version: 2.4.8 Script Link: gist.github.com/Sky-Captain-13/452330a3d926b32da49c Bugfix: The undefined emote bug crept back in again... it is fixed... again. Bugfix: Timestamps are turned off by default now. Set USE_TIMESTAMPS to true to turn them back on. Update: Added logic to show/hide the entire tag and contents of a tag by adding or removing a $ (dollar sign) in front of the tag. I am sure there are bugs that will arise from this... and will try to fix them quickly --?{Hit delete to show hex damage|$}Hex:|[[1d6]] necrotic damage The above tag would pop up a roll query to the player that asks them to hit delete to show the hex damage. Otherwise they can just hit enter and the powercard will completely ignore that tag and its content. Bugfix & Update: March 15th, 2015 ~ 4:00 pm eastern Version: 2.4.7 Script Link: gist.github.com/Sky-Captain-13/452330a3d926b32da49c Bugfix: XPND will no longer crash when you use multiple dice in a roll and will not crash if a character sheet uses floor() or ceil() in an auto-calculated formula. You still will need to add [XPND] in front of each die in an inline roll to prevent formatting issues. Bad Usage: [[ [XPND] 1d6 + 1d6 ]] Good Usage: [[ [XPND] 1d6 + [XPND] 1d6 ]] Update: Added timestamps. Set USE_TIMESTAMPS to true to turn them on. Bugfix & Update: March 13th, 2015 ~ 9:00 pm eastern Version: 2.4.6 Script Link: gist.github.com/Sky-Captain-13/452330a3d926b32da49c Bugfix: XPND works with multi-dice rolls now, however... formatting on die rolls after the first is buggy. Will fix that later. Minor Update: PowerCards now shows version and update info with a timestamp on the API Output Console when it loads. Minor Update: Added the following inline formatting tags... ]_[ inserts a horizontal rule ~L aligns text left ( Example: ~L Left aligned text. ~L) ~C aligns text centrally ( Example: ~C Centered text. ~C) ~R aligns text right ( Example: ~R Right aligned text. ~R) Power Cards 2 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. What this script is not! This is not a script meant to automate combat in any kind of game. It is simply a way to format the output of a macro in a more aesthetically pleasing manner and to facilitate multiple attack rolls within the same macro to reduce screen clutter. 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 The above macros show up as the following... 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 : 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]] 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 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: The first three options have been deprecated and removed. Do not use them. They do nothing. Use the actual crit success and crit failure options built into Roll20 now: [[1d4cs>3]] highlights green if equal to or greater than three. [[1d4cf<2]] highlights in red if less than or equal to two. These default roll options can be combined and are entirely compatible with powercards. High Roll [HR#]: Highlights in green, any roll greater than or equal to the number in the brackets. Low Roll [LR#]: Highlights in red, any roll less than or equal to the number in the brackets. Combined Rolls [CR#|#]: Combines the two options to do both variable low and high rolls in the same roll. The first number is the low roll and the second is the high roll. [NH] - Disables inline roll highlighting for crit success and crit failure. [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] 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. ^*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@@ <-- Must have double bars in between the url and the text. In order to prevent issues with the italics text formatting and urls, do not add http:// to the front of your urls. The script will do this when the macro is run in Roll20. $$#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%% 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.