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] Power Cards

November 06 (10 years ago)
Wilco

I have tested with IsGM, Power Cards, and Josh's Condition and Status remind.

Jim
November 06 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
Solved.

PowerCards as written modifies the message object, removing the '(GM)' portion of the sender name. StatusTracker ignores messages from players, which it defines as "messages without '(GM)' in them." Since PowerCards subscribes to on('chat:message',...) events first, it changes the message, which prevents StatusTracker from activating.

Changing PowerCards on('chat:message',...) handler prevents it from having side effects and breaking the assumptions of the other scripts:
on("chat:message", function (msg_orig) {
	var msg;
	// Exit if not an api command
	if (msg_orig.type != "api") return;

	msg = _.clone(msg_orig);

November 06 (10 years ago)
Meh. Break all the scripts!
November 08 (10 years ago)

Edited November 08 (10 years ago)
Great stuff HoneyBadger! Looking forward to implementing this ASAP!

Quick question, and apologies if it's been asked somewhere above... I did have a quick look, but couldn't see anything! Is there anyway that you can add a "temporary bonus" option? To explain... I love it when you attack multiple people (i.e. Fire Shroud) you can select the number of attacks in a pop up option.

Is there anyway that you can have a pop up option to add attack bonuses? i.e. Combat Advantage? So, I select my token, click on my attack, and up pops a "Bonus" question. Here I can add (for CA) or minus (for Cover) and have the final roll output it?

I only ask, as one of my players refuses to use the scripts, as their attack bonus is constantly changing (they're a Star Pact Warlock, so CA, Fate of the Void, Prime Shot, Bloodied etc).

Thanks again!
November 08 (10 years ago)
You can always put ?{Other Modifiers|0} in the macro, but it's only going to pop up once... even if it's a multiple attack power. That's just a limitation of the api.
November 08 (10 years ago)
That's fine for me! Where abouts would I put it?
November 08 (10 years ago)
In whatever die roll you're wanting to modify...

[[1d20 + ?{Misc Modifier|0}]]
November 17 (10 years ago)
Do i have to put some code in order for the power cards to work? ive tried to just put a test macro but it never works, is something wrong with my chrome or what?
November 17 (10 years ago)

Cesar D. said:

Do i have to put some code in order for the power cards to work? ive tried to just put a test macro but it never works, is something wrong with my chrome or what?
You need to have Mentor status to load APIs.

November 26 (10 years ago)
Firstly, I'm not near the programmer that most of you guys are. However, I am noticing the [HR#] feature will not accept anything except an absolute value. Is this correct or is there a special way to get it recognize variables with calls to the character sheet? Reasoning for this, our DM has made a house rule for 5e Champion Fighter's critical scaling to be equal to it's prof. bonus. So basically:

[[ [HR(20-@{PB))] 1D20 ]]

November 26 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
I'm not saying HB couldn't get this to work, but here's what he'd be dealing with:
{
.  "content": "!msg $[[0]]",
.  "inlinerolls": [
.  .  {
.  .  .  "expression": "[HR(20—(ceil((10)/1e10) + ceil((10)/4)))] 1D20",
.  .  .  "results": {
.  .  .  .  "resultType": "sum",
.  .  .  .  "rolls": [
.  .  .  .  .  {
.  .  .  .  .  .  "text": "HR(20—(ceil((10)/1e10) + ceil((10)/4)))",
.  .  .  .  .  .  "type": "L"
.  .  .  .  .  },
.  .  .  .  .  {
.  .  .  .  .  .  "dice": 1,
.  .  .  .  .  .  "results": [
.  .  .  .  .  .  .  {
.  .  .  .  .  .  .  .  "v": 19
.  .  .  .  .  .  .  }
.  .  .  .  .  .  ],
.  .  .  .  .  .  "sides": 20,
.  .  .  .  .  .  "type": "R"
.  .  .  .  .  }
.  .  .  .  ],
.  .  .  .  "total": 19,
.  .  .  .  "type": "V"
.  .  .  },
.  .  .  "rollid": "—JbghwS——29c5v977dAJ",
.  .  .  "signature": "00a0ca795f48b2a499e0ac4d8ea0a2b4b1a9c8f8129ab12829ece6ac311d11f130a3631a182e8c8cc0d2d98a7b2f5d028c5df9091afb626864fd73146afcc100"
.  .  }
.  ],
.  "playerid": "—JS3qKxIUPHLzSbK24ve",
.  "selected": [
.  .  {
.  .  .  "_id": "—Jb8F8l1nGmAx9fWf8vU",
.  .  .  "_type": "graphic"
.  .  }
.  ],
.  "type": "api",
.  "who": "The Aaron"
}

Mathematical equations inside of labels are not expanded, so he'd have to pull that block and send it to the chat system to evaluate, then use the resultant number.
November 26 (10 years ago)
o_0
November 29 (10 years ago)
How do I add this onto my roll20?
November 29 (10 years ago)
Gen Kitty
Forum Champion
Step 1: Subscribe at the Mentor level

Step 2: Click on the "API Scripts" link on the Campaign Details page for your campaign

Step 3: Click on New Script tab

Step 4: Paste in a script you want to use and Save Script
I will be honest: powercard script is why I decided to pay a year at a time. It makes Roll20 all the more worth while.
November 29 (10 years ago)

OldSchoolChris said:

I will be honest: powercard script is why I decided to pay a year at a time. It makes Roll20 all the more worth while.

easily me too. I got the Supporter level for Dynamic lighting, and the Mentor level for this script. Been using Powercards, Ammo [[big thanks to sir The Aaron for his work]], and AlterToken because its almost all i need!
November 29 (10 years ago)
@TheAaron, does this change need to go into a specific line location?
November 29 (10 years ago)
Does the current version of HoneyBadger's power card generator (https://r20cpcmg.codeplex.com/) still work fully with the most recent updates to this script?
November 29 (10 years ago)

Wade said:

Does the current version of HoneyBadger's power card generator (https://r20cpcmg.codeplex.com/) still work fully with the most recent updates to this script?

It think it does right now... however, I've been quietly working on a new version of power cards. Trying to make it smaller and less prone to errors. The holidays, getting engaged, and a new WoW expansion have made it difficult to spend time working on it however. So don't expect it any time soon.
November 29 (10 years ago)

HoneyBadger said:

Wade said:

Does the current version of HoneyBadger's power card generator (https://r20cpcmg.codeplex.com/) still work fully with the most recent updates to this script?

It think it does right now... however, I've been quietly working on a new version of power cards. Trying to make it smaller and less prone to errors. The holidays, getting engaged, and a new WoW expansion have made it difficult to spend time working on it however. So don't expect it any time soon.

Thanks brother. And Congrats on the engagement!
November 30 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter

JonMichael (Vante) said:

@TheAaron, does this change need to go into a specific line location?
Which change?
November 30 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter

HoneyBadger said:

getting engaged

Congrats!
November 30 (10 years ago)
Gen Kitty
Forum Champion

HoneyBadger said:

getting engaged

Congratulations!
November 30 (10 years ago)
Thanks! :)
November 30 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
(HoneyBadger does care! :D )
November 30 (10 years ago)

HoneyBadger said: "getting engaged"


Congratulations!
November 30 (10 years ago)

The Aaron said:

(HoneyBadger does care! :D )

lol
December 02 (10 years ago)
Hey JB (HoneyBadger),

How are things? Sure miss Kadaga... Yeah, he is still stuck in The Prison Realm of Uxichyrath.

We have a new campaign going soon and I have become a De-Mentor and am working on using your D&D 4E Power Cards.

We had been using regular text macros with one being the Target macro, one as the Attack and one as the Hit. Below is the macro code we used for showing attacks on specific targets and bringing up their individual defense for the attack.
ATTACK: [[1d20+5]] vs AC:@{target|AC} (@{target|token_name})

Is there anyway to do this same thing with your Power Cards using only one macro and the multi targets? I am working with the code below...
!power --name|TIDAL SPIRIT SHOT --usage|At-Will --action|Standard Action --Keywords|Primal, Weapon --Targets|Each enemy in the burst --Range|Area burst 1 within 4/8 range --format|dnd4e --attack?{Number of Targets|1}|[[1d20+11]] --defense|AC --damage|[[1d4+1]] damage, and you can slide the target 1 square.

Let me know what you think?
December 02 (10 years ago)
Gen Kitty
Forum Champion
You can and you can't do multiple targets and names with a powercards script. You can do a fixed number of targets, with names, or you can do a variable number of targets, without names.

What I ended up doing for my games is I have a NUL pog on every encounter page, and we use it to pad out lists. Got something that can target 8 targets? NUL might be used to pad out 5 of those spots. I tend to break the macros up into small and full versions, especially for close burst 2+.

Here's a long example from one of the characters in my group:

!power --name|**@{selected|token_name} | Shout of Triumph** --bgcolor|#C40233 --leftsub|Encounter --rightsub|Standard Action --Keywords|Arcane, Implement, Thunder --AoE|__Close Blast__ 3 --Effect|Each ally in the blast may be __slid__ up to @{Con} squares. --AoE|Close Blast 3 --attack|vs Fortitude --Target 1| [[1d20 + @{HalfLevel} + @{Cha} + @{Blade-A-CFEM} + ?{MiscToHit?|0} ]] vs [[@{target|Foe 1|Fort}]] @{target|Foe 1|token_name} --Target 2| [[1d20 + @{HalfLevel} + @{Cha} + @{Blade-A-CFEM} + ?{MiscToHit?} ]] vs [[@{target|Foe 2|Fort}]] @{target|Foe 2|token_name} --Target 3| [[1d20 + @{HalfLevel} + @{Cha} + @{Blade-A-CFEM} + ?{MiscToHit?} ]] vs [[@{target|Foe 3|Fort}]] @{target|Foe 3|token_name} --Target 4| [[1d20 + @{HalfLevel} + @{Cha} + @{Blade-A-CFEM} + ?{MiscToHit?} ]] vs [[@{target|Foe 4|Fort}]] @{target|Foe 4|token_name} --Target 5| [[1d20 + @{HalfLevel} + @{Cha} + @{Blade-A-CFEM} + ?{MiscToHit?} ]] vs [[@{target|Foe 5|Fort}]] @{target|Foe 5|token_name} --Target 6| [[1d20 + @{HalfLevel} + @{Cha} + @{Blade-A-CFEM} + ?{MiscToHit?} ]] vs [[@{target|Foe 6|Fort}]] @{target|Foe 6|token_name} --Target 7| [[1d20 + @{HalfLevel} + @{Cha} + @{Blade-A-CFEM} + ?{MiscToHit?} ]] vs [[@{target|Foe 7|Fort}]] @{target|Foe 7|token_name} --Target 8| [[1d20 + @{HalfLevel} + @{Cha} + @{Blade-A-CFEM} + ?{MiscToHit?} ]] vs [[@{target|Foe 8|Fort}]] @{target|Foe 8|token_name} --Target 9| [[1d20 + @{HalfLevel} + @{Cha} + @{Blade-A-CFEM} + ?{MiscToHit?} ]] vs [[@{target|Foe 9|Fort}]] @{target|Foe 9|token_name} --Hit|[[ ([NH]1d6) +@{Cha} + @{Blade-D-FEMM} + ?{MiscToDamage|0} ]] **Thunder** damage | Crit [[ (1*6) +@{Cha} + @{Blade-D-FEMM} + [NH]2d6 + ?{MiscToDamage} ]] --^1On Hit|Each foe is __slid__ up to [[@{Con}+1]] squares.


December 02 (10 years ago)
Multiple named targets aren't possible right now. I have slowly been re-writing the script and am getting close to tackling the multi-attack roll stuff once I have everything else done. I wouldn't hold your breath on it being done any time soon however. Too much stuff going on.
Hello HoneyBadger,

On line 411 there is function buildinline(inlineroll) which only takes a single parm. However in each instance that you make a call to this function (lines 331,357,362,367) you are passing in 2 parms. I assume the 2nd parm is being ignored, but if you're using it anywhere then you may get wonky results. Just wanted to bring to your attention.

Thanks
Jake
December 12 (10 years ago)
That's actually leftover from the previous implementation of crit rolls. It only worked on d20's. It can be removed without affecting anything.
December 14 (10 years ago)
So how do I fix this code so that if I crit i would not have to worry about adding the additional damage

" !power --ddn| --emote|@{selected|token_name} attacks with his Spike-Shield. --name|Spike-Shield --leftsub|Melee --rightsub|Off-Hand --attack|[[{1d20}+6}]]|[[{1d20}+6}]] vs AC --damage|[[{1d6}+4}]]| +[[{1d6}}]] if Critical Hit --Damage Type| Piercing
/w GM @{target|token_name}'s AC: @{target|bar2} "

Also I want to let the dm know which mook(mob) I am attacking so I target the token and have it whisper the dm

I will using !power a lot when I dm to make my game look sweet! I just need to link the code above to the weapons in my charters list.

Thanks,

Levis W.


December 14 (10 years ago)
How do i get --charid|@{character_id} to work with this

" !power --ddn| --emote|@{selected|token_name} Attempts to Disarms.. --charid|@{character_id} --name|Disarming Strike --bgcolor|{BGColor} --txcolor|{FGColor} --leftsub|Battle Master Maneuver --rightsub| DC:14 --Description|When you hit a creature with a weapon attack, you can attempt to disarm the target. forcing it to drop one item of your choice that it's holding. --Effect|You add the superiority die to the attack's damage roll, and the target must make a strengths saving throw. on a failed save, it drops the object you chose. the object lands at its feet."
December 14 (10 years ago)
Gen Kitty
Forum Champion
I'd do something like --Target|@{target|Foe|token_name} instead of character_id, myself.
December 14 (10 years ago)
--charid is for the custom emote that puts your token/avatar in chat when you use the macro. GenKitty showed the right way to mark a target. As for autocrit damage... that option does not exist. I do no automate combat at all wtih this script.
December 14 (10 years ago)
I am thankful for your response yet the first question was answer the 2nd was not .

What I was asking is that --charid|@{character_id} does not get me the custom emote that puts your token/avatar in chat.

So the code is this:

" !power --ddn| --emote|@{selected|token_name} Attempts to Disarms.. --charid|@{character_id} --name|Disarming Strike --bgcolor|{BGColor} --txcolor|{FGColor} --leftsub|Battle Master Maneuver --rightsub| DC:14 --Description|When you hit a creature with a weapon attack, you can attempt to disarm the target. forcing it to drop one item of your choice that it's holding. --Effect|You add the superiority die to the attack's damage roll, and the target must make a strengths saving throw. on a failed save, it drops the object you chose. the object lands at its feet."

To make sure that i am clear --charid|@{character_id} is to put a custom emote in the chat along with the power card.


Thanks,

Levis Wiggins
isnt that what " --emote|@{selected|token_name}" at the beginning does?
December 14 (10 years ago)
Yes That was i thought it is not working for me.
December 14 (10 years ago)
OSC - You have to use both. --charid allows the script to get your character id which is used in the script to find the avatar of that character. If you have both --charid and --emote in a macro, it uses css and /direct to create a custom styled emote instead of the orange bold text.

Levis - That's right. It should be working as shown. Try taking out the --ddn| tag. That was deprecated a long time ago.
December 14 (10 years ago)
The DM that installed the script must also allow custom emotes by changing var POWERCARD_CUSTOM_EMOTE = false; to true near the beginning of the script.
December 14 (10 years ago)
POWERCARD_CUSTOM_EMOTE = false; to true that all it was lol

Thanks,

Levis W.
Possible Fix for the occasional colon that appears after the picture emotes:

Forewarned - I have no idea why this works but, if you head down to lines 381 - 383:
sendChat("", "/desc ");
sendChat("", "/direct " + PowerCard.emote);
} else if (PowerCard.emote !== undefined) {

and add an additional sendchat to /desc after the power card emote like this:

sendChat("", "/desc ");
sendChat("", "/direct " + PowerCard.emote);
sendChat("", "/desc ");
} else if (PowerCard.emote !== undefined) {

then this seems to make the colon stop appearing. I cannot repro it after about 30+ times testing. However the strange thing is that if you add this same line in the more logical place, directly before the sendchat DisplayCard on 386, then it does *not* resolve the issue. Best I can figure is a timing thing with the script. Anyway, hope this will help someone.

Jake


December 18 (10 years ago)

Edited December 18 (10 years ago)
I will take a look at this later. Thanks for looking into that.
December 18 (10 years ago)
The new version of the script I'm working on has solved this issued without need for the extra /desc. The trick was to send it all in one sendChat call with /direct + PowerCard.emote + DisplayCard or whatever the variable is in the old script. I will see if I can fix it in the script above since the new script is not nearly ready for release.
Thank you sir - appreciate your work. My players and I love the power cards!
December 23 (10 years ago)
I do hope the colin issue gets fixed soon as it is bugging me hardcore (it looks so ugly!).
Can you submit the new edit to the script that fixes it? Or is it not possible until the new release?

Minor bugs:
  • Apostrophes in the --title tag will break the tooltip, showing only the text up to right before the first apostrophe. For example, "Mímika Zy'pher fires her gun." shows up as "Mímika Zy".
  • Unique characters like vowels with accents over them produce a strange result in the --emote tag, placing a single space before every character that isn't "normal". For example, "Mímika Zy'pher fires her gun." shows up as "M ímika Zy'pher fires her gun.".
Requests:
  • Functionality in the highlight tags (ie. "[LR#]") where "#" can actually be a modifiable integer? For example, "[LR(2+?{Foo})]". So if Foo was 2, it'd function as "[LR4]".
  • The ability to have multiple tags that have the same name. For example, "--Attack|[[1d20]] --Damage|[[1d6]] --Crit Confirm|[[1d20]] --Damage|[[1d6]]". Currently, it replaces the field in the first instance of "Damage" with the field in the last iteration of "Damage", where I'd like it to show both fields as separate entities.
Sorry to sound so needy, I am merely offering my voice. Love the API so far! It really cleans up my macros.

December 23 (10 years ago)

Edited December 23 (10 years ago)
Gen Kitty
Forum Champion
Tags with the same name is *never ever* happening. It's a programming thing, you just can't have multiple variables with the same name. For the specific case you mention, I offer this instead:

--attack|[[1d20ro20]] vs AC for [[ [NH]1d6]] damage | Crits add [[ [NH]1d6]]

Reroll-once (ro) is a recent feature added to the Roll20 dice rolling engine and is very useful for stuff like this. If the attack die rolls a 20 it will reroll the d20 just once, showing the new result in a green-hued box. (If you crit on some other number, swap it in for the 20)
December 23 (10 years ago)
Actually I figured out a way to do same "name" tags... it's part of PowerCards 2.0 that is getting closer to release worthy status. ¬_¬
December 23 (10 years ago)

Aetheria said:

I do hope the colin issue gets fixed soon as it is bugging me hardcore (it looks so ugly!).
Can you submit the new edit to the script that fixes it? Or is it not possible until the new release?

Minor bugs:
  • Apostrophes in the --title tag will break the tooltip, showing only the text up to right before the first apostrophe. For example, "Mímika Zy'pher fires her gun." shows up as "Mímika Zy".
  • Unique characters like vowels with accents over them produce a strange result in the --emote tag, placing a single space before every character that isn't "normal". For example, "Mímika Zy'pher fires her gun." shows up as "M ímika Zy'pher fires her gun."
Hrm, I don't typically use apostrophes in character names, so this hasn't come up. I may be able to fix it, dunno. Does Roll20 do the space in front of alt characters normally or only through the API?

Requests:
  • Functionality in the highlight tags (ie. "[LR#]") where "#" can actually be a modifiable integer? For example, "[LR(2+?{Foo})]". So if Foo was 2, it'd function as "[LR4]".
This I don't know about either. There's so much math and other dice rolls and such that could be used in there, that I would basically be re-writing the dice parser inside the script.