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

September 15 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
;)
September 15 (10 years ago)
Ah doh... that was changed when I was using jshint.com to look for errors.
September 15 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
Yeah, it's a sneaky one.

I use JSLint from node.js locally to check my scripts. I edit all my scripts locally and can then kick off JSLint on the file just like I would compile, and get the results back into my editor as errors. JSLint is written by the author of my favorite JS book, which I'm sure you've seen me espouse before - Javascript: The Good Parts by Douglas Crockford.
September 20 (10 years ago)
Gen Kitty
Forum Champion
Bug Report

[[ [HR18]1d20r18 ]] highlights on a roll of 18+, but does not do the reroll.
September 20 (10 years ago)
That's weird... all rolls should be completed before they even hit the script.
September 20 (10 years ago)

GenKitty said:

Bug Report

[[ [HR18]1d20r18 ]] highlights on a roll of 18+, but does not do the reroll.

Ah... r18 only re-rolls actual 18's. You need to use r>18 instead.
September 20 (10 years ago)

Edited September 20 (10 years ago)
Gen Kitty
Forum Champion
That would do it. Let me test.... Yep! Thanks!
September 20 (10 years ago)
--attack|The attack roll is [[d(@{selected|agility})+d(@{selected|onehandedweapons}+(2*?{Power Level|0})-(2*?{down step?|0}))]] --Damage|The weapon deals a potential of [[d?{Weapon Damage|6}]] damage.

Hey HoneyBadger! Quick question, I have a powercard (thank you by the way, these things are fantastic) and the outputs are not inline rolls on ONE of my campaigns. I have the same script for another campaign and the outputs are clear inlines, yet for one it just outputs a number but i cannot hover over it (it looks like it was typed in, but i know it wasn't). Above is the part of the card that it happens on.

Is there something I am doing wrong with the macro set up or is there a function i need to make true/false? If you need more info, I would be glad to supply it.
September 20 (10 years ago)

Edited September 20 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
Jake, are you using my Ammo script by chance? I ran across a bug for it that causes it to sub numbers for other scripts (didn't realize all scripts get the same msg object, not just a copy if it!).
September 20 (10 years ago)
...maybe (yes)
September 20 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
Change the first 3 lines of the HandleInput function:
    HandleInput = function(msg_orig) {
        var msg = _.clone(msg_orig),
            args,attr,amount,chr,token,text='';
That will fix it. I'm working on an update that will fix that and add some of those requested features...
September 22 (10 years ago)
Falcon
Pro
Sheet Author
Aaron - on the ammo script or the power script?
September 22 (10 years ago)
Falcon
Pro
Sheet Author
HB - Is there any way to have the inline [[ ]] calc fields show different colors? Specifically within the macro and not the JS? Just wondering?

Also - I am a huge fan of your Powercard API. Absolutely love it. Thanks for the hard work.
September 22 (10 years ago)
Aaron's fix has to do with the ammo script and no... I cannot change colors within Roll20 except in the chat window itself.

Thanks for the thanks! ^_^
September 23 (10 years ago)
Falcon
Pro
Sheet Author
HB - double checking - were you able to add calling tables from Power Cards inline? I use it to show where a target is hit.
September 24 (10 years ago)
Wes
Sheet Author
@Black Falcon Yeah, they work for a "Text" output from the table.
September 24 (10 years ago)
Falcon
Pro
Sheet Author
Wesley - do you mean it works within Power Card API? - I want to do it within the --emote for Power Cards. I just tried it and can't get it to work. It gives me some weird output. Am I doing something wrong? [[1t[tablename]]] right?
--text1, --text2, etc not --emote|
September 24 (10 years ago)
I dunno about emotes... never tried there.
September 24 (10 years ago)
Wes
Sheet Author
Yeah it doesn't work behind the emote tag, Just in the body of the power card.
Here is an example from my Wild Magic Surge Table.

September 28 (10 years ago)
I need help for some reason everything was working fine and dandy ... but now none of my macros are showing up powercards

September 28 (10 years ago)
Did you try saving the script to restart the api?
September 30 (10 years ago)

Aaron said:

Change the first 3 lines of the HandleInput function:
    HandleInput = function(msg_orig) {
        var msg = _.clone(msg_orig),
            args,attr,amount,chr,token,text='';
That will fix it. I'm working on an update that will fix that and add some of those requested features...

Does a similar fix need to be done for every function that takes in a msg for an API command?

I'm running into a lot of stuff not working since adding the power cards.
September 30 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter

Bryan K. said:

Aaron said:

Change the first 3 lines of the HandleInput function:
    HandleInput = function(msg_orig) {
        var msg = _.clone(msg_orig),
            args,attr,amount,chr,token,text='';
That will fix it. I'm working on an update that will fix that and add some of those requested features...

Does a similar fix need to be done for every function that takes in a msg for an API command?

I'm running into a lot of stuff not working since adding the power cards.

That was just in regard to my ammo script, which modifies the msg.contents by subbing in the values of rolls, which prevented the power cards script from getting them later on. I'm not aware that there are any other scripts that need similar treatment, though I know I've recommended similar code a few times to deal with subbing in rolls for scripts that didn't accept inline rolls.
September 30 (10 years ago)

Edited September 30 (10 years ago)
My token default script is not working on token drop, until I drop an additional token on the page, then the first one is updating.

It seems the Power Card script is eating up the on ready calls which is causing this.
September 30 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
eh? That's weird...

I assume you've added logging to verify that? Is there a link to the token default script somewhere?
Bug Report: --attack#| and --damage#| will repeat the rolls, but not other text.
Thought I'd point this out, don't know if anyone else is having this problem with the script, but it's done it for the last few versions for me. Google Chrome on MacBook.

!power --name|Sweet Cuppin' Cakes --leftsub|Live Free --rightsub|Die Hard --attack2|[[1d20]] vs Armor Class --damage3|[[1d6]] radical damage

!power --name|Sweet Cuppin' Cakes --leftsub|Live Free --rightsub|Die Hard --attack2|1d20 vs Armor Class --damage3|1d6 radical damage
October 01 (10 years ago)

Edited October 01 (10 years ago)
I don't know what to tell you, but it works for me using the current version...

Bah, never mind... I am barely awake and see what you meant. That's not a bug. That's a design choice. I will look at making it an option.
Oh okay. I only noticed the difference after the big overhaul, seemed odd that no one had mentioned it. But yeah, it'd be great to get that working whenever you got the time to look at it. Between all the rolls that Pathfinder can use in an attack, and my ADHD, its a huge boon to not have numbers floating around on lines without context when I'm GMing. :)
October 01 (10 years ago)
Anyone know if there is a way in roll20 to tap into the color someone has selected at the bottom within roll20. I want to set the card title's background to that color. That way, everyone will know who clicked the roll.
October 01 (10 years ago)
In the configuration, set the bolded value to true (defaults to false).

// USER CONFIGUATION
var POWERCARD_DEFAULT_FORMAT = "";
var POWERCARD_CUSTOM_EMOTE = true;
var POWERCARD_USE_PLAYER_COLOR = true;
var POWERCARD_SHOW_ATTACK_DAMAGE_TAGS = true;
var POWERCARD_INLINE_ROLL_NO_HIGHLIGHT = false;
var POWERCARD_INLINE_ROLL_COLOR_OVERRIDE = true;
var POWERCARD_ROUNDED_INLINE_ROLLS = true;
October 03 (10 years ago)
Thank you Kevin.

It seems Attack can handle a variable input, but damage can't, is this correct? I'm trying to setup multiple attack and damage macros and it seems I am going to have to keep my old system since it can't handle a variable damage number (popup)?

October 03 (10 years ago)

Edited October 03 (10 years ago)
--damage?{Damage|1}|[[1d6]] should work.
October 03 (10 years ago)
!power --format|dnd5e
--name|@{selected|token_name} @{IsPC}
--leftsub|@{multiweaponname1}
--rightsub|damages for
--damage?{Number of Hits|1}|[[@{multidmg1} [Base damage] + @{multidmgbonus1} [Damage Bonus] + @{global_ranged_damage_bonus} [Active Range Damage Bonus]]] @{multidmgtype1}
--Critical|[[@{multidmg1}]]

Not sure why this isn't firing when my attack works :

!power --format|dnd5e
--name|@{selected|token_name} @{IsPC}
--leftsub|@{multiweaponname1} Attack
--rightsub|@{target|Target 1|token_name}
--attack?{Number of Attacks|1}|[[ [LR(1 + @{multitohit1} + @{global_ranged_attack_bonus} + @{fumble})] [HR(20 + @{multitohit1} + @{global_ranged_attack_bonus} - @{critical})] 1d20 + @{multitohit1} [To Hit] + @{global_ranged_attack_bonus} [Active Ranged Attack Bonus] ]] | [[ [LR(1 + @{multitohit1} + @{global_ranged_attack_bonus} + @{fumble})] [HR(20 + @{multitohit1} + @{global_ranged_attack_bonus} - @{critical})] 1d20 + @{multitohit1} [To Hit] + @{global_ranged_attack_bonus} [Active Ranged Attack Bonus] ]] vs AC
\n@{multitrackammo1}
\n!mark @{target|Target 1|token_id}
\n/w gm Target @{target|Target 1|token_name} 's AC @{target|Target 1|bar3} @{weaponenchant}
October 03 (10 years ago)
Try using it without the format tag and see if it works.
October 05 (10 years ago)

Bennett S. said:

Oh okay. I only noticed the difference after the big overhaul, seemed odd that no one had mentioned it. But yeah, it'd be great to get that working whenever you got the time to look at it. Between all the rolls that Pathfinder can use in an attack, and my ADHD, its a huge boon to not have numbers floating around on lines without context when I'm GMing. :)

It's known, It's a matter of how the multi roller works. I've looked into fixing it but it's not trivial, mostly due to how the roll20 does sendMsg(...).
October 05 (10 years ago)
I just went back to my old system to calculate the number of hits and damage to show on the power card.

My 5e Character sheet is now using powercards on all rolls. Thank you HoneyBadger!
October 06 (10 years ago)
How do you get the card to fill the whole space?
October 06 (10 years ago)
Turn off chat avatars.
October 06 (10 years ago)

Edited October 06 (10 years ago)
Can't figure out why the box isn't turning green on 19s when I have @{critical}

--attack|[[ [HR(20 + @{meleetohit1} + @{global_melee_attack_bonus} - @{critical})] 1d20 + @{meleetohit1} [To Hit] + @{global_melee_attack_bonus} [Active Melee Attack Bonus] ]]

Do calculates in the HR not work?

Wait a second, I think I should just be doing 20 - @critical right? I'm guessing it doesn't take the total value, but just the 1d20 roll (before all of the additions)
October 06 (10 years ago)
It compares just the base roll. So you should just put the number... HR18 for crits on 18 or higher .
October 08 (10 years ago)
Guidance on this? Using a relatively simple macro, and the information is displayed, but incorrectly. Instead of displaying as a power card, it spits out a string that looks like this.

+1 RapierAction ♦ AttackAttack: 9 | 25 vs. ACBless Bonus: 1Hit: 7 | Critical 8Damage Type: Piercing

October 08 (10 years ago)
You have to paste what text you are passing in
October 08 (10 years ago)

Edited October 08 (10 years ago)
Doh, sorry about that.

!power --emote|Tholman stabs something. --format|dnd5e --bgcolor|#003399 --txcolor|#FFFFFF --name|+1 Rapier --leftsub|Action --rightsub|Attack --Attack|[[1d20+6]] | [[1d20+6]] vs. AC --Bless Bonus|[[1d4]] --damage|[[1d8+4]] | ** Critical [[1d8]] --Damage Type|Piercing
October 08 (10 years ago)
You're missing the closing ** to make something bold
October 08 (10 years ago)

Edited October 08 (10 years ago)
I feel silly, but I'm trying to understand the HR system.
!power --emote|@{selected|token_name} POWERFULLY ATTACKS with his falchion. --name|Melee Power Attack --usage|At-Will --action|Standard Action --attack|[[ [HR18] 1d20+@{STR}+@{BAB}-1]] l --damage|[[2d4+@{STR}+(@{STR}/2)+2]] --dmgtype|slashing

What simple thing have I ignored that is not causing this to highlight on 18 or above?
October 08 (10 years ago)
Dunno. If you have the latest version of the script, that should be working.
October 08 (10 years ago)
And the latest version is always what's on top in "The Script"?
October 08 (10 years ago)
Yup.