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

1407766224
The Aaron
Roll20 Production Team
API Scripter
For the colors, I'm not suggesting coloring every line, just pulling bgcolor and txcolor from an attribute on a specified character, if it exists. Possibly not useful for anyone else. =D As for templates, yeah, slightly complicated. I might send you a patch at some point if I ever get caught up on scripts... ( *cough* Calendar *cough* /em winks at Jarret. )
1407766574

Edited 1407766635
The Aaron
Roll20 Production Team
API Scripter
Wesley, it certainly works with numeric tables: !power --test|[[1t[d6min4] ]]
1407768982
Wes
Sheet Author
Good to know. Will it work with a text table? I'm at work or I would try it out. I'm basically trying to call a text hit location. Ie. , [[1t[hit location]]]. Looking for the output "Left Arm", " Torso", etc.
1407770107
The Aaron
Roll20 Production Team
API Scripter
Sadly no, it appears not to work with text. just outputs a 0. Strangely, it appears to be outputting twice in this case:
1407770229
The Aaron
Roll20 Production Team
API Scripter
Actually, it seems to be always outputting twice with rollable tables... And apparently evaluating individually for each.
1407770314

Edited 1407770402
Text tables still don't work... hrm. Will look at it later. I'm not getting duplicate cards with tables though.
Ok... I believe it should be entirely possible to parse the table results as is... and display them properly. Not gonna guarantee when I'll get to it... I am in the middle of my seven day free trial of Wildstar and want to enjoy that on my days off. Here's what msg.inlinerolls looks like with a text table entry: [{"expression":"1t[HitLocation]","results":{"resultType":"sum","rolls":[{"dice":1,"results":[{"tableItem":{"avatar":"","id":"-JU4dER1Blr_OsXE7SJM","name":"Right Leg","weight":2},"tableidx":12,"v":0}],"sides":13,"table":"HitLocation","type":"R"}],"total":0,"type":"V"},"signature":false}] Will just have to look for tableItem and then grab "name" and send that as the result instead of total.
1407771243

Edited 1407771286
Wes
Sheet Author
Awesome. Yeah man enjoy Wildstar!
Loving the Power Cards. Seems there may be a few things I'm doing wrong but overall it's working just find for the noob use I'm doing with them. Thanks HoneyBadger!
I don't really know anything about how these scripts work, I was able to figure out some things from the couple of macro examples, but could someone please put up a few more examples of your macros for doing different things with these Power Cards, From what I have already figured out they are really great, thanks to the creators....
1407837849

Edited 1407844928
Is there a particular spell/ability/attack etc you want an example of? As a random example I am using this: !power --whisper| --name|Appraise --leftsub|@{character_name} --Result|[[1d20 + @{Appraise}]] --0-15|Wildly innacurate --15-20|Value within 20% --20+|Accurate Value --25+|Determine if the item has magic properties(But not what those properties are) --Rare items|Increase DC by 5 or more at GM discretion To make this: My attack macros are ridiculously long because I am using Sam's pathfinder sheet and creating the macro out of repeating weapon fields. Which means doing all the math as part of the roll. My full attack powercard takes around half a page of macro text :( Looks pretty when it is done though :)
1407867430
Wes
Sheet Author
Here are some examples from a D&D 4e campaign. !power --emote|@{selected|token_name} whispers a brief prayer as divine light washes over @{target|token_name}, helping to mend their wounds --name|Healing Word --usage|Encounter (Special) --action|Minor Action --Special|Twice per Encounter but only Once per Round --Keywords|Healing --Range|Close Burst 10 --Target|Myself or one ally --Effect|@{target|token_name} can spend a healing surge and regain an additional [[5d6+@{wisdom-mod}+@{charisma-mod}]] hit points. Outputs: I actually have a set of macros set up for myself as a gm that can roll any selected characters Skill Roll provided they have filled out the D&D 4e character sheet. Here is the "Arcana-Macro" the attributes in the macro are pulled from the skills table on the character sheet. !power --desc| --name|@{selected|token_name}'s Arcana --txcolor|#FFF --bgcolor|Blue --Roll|[[1d20+(floor((@{selected|intelligence}-10)/2)+floor(@{selected|level}/2)+@{selected|arcana-trained}*5)+@{selected|arcana-pen}+@{selected|arcana-misc}]] Outputs: also you can find a lot of good information here: Roll 20 Wiki - Custom Power Cards .
I did come across a problem, it's generally a user error to be honest, but it does cause the script to crash: TypeError: Cannot call method 'forEach' of undefined at processRoll (evalmachine. :2553:16) at evalmachine. :2494:16 at Array.forEach (native) at buildinline (evalmachine. :2493:27) at Object.PowerCardScript.Process (evalmachine. :2414:26) at evalmachine. :2225:19 at eval ( Basically I executed a command that reference an undefined field... at least that is what I think broke it.
1407890354
The Aaron
Roll20 Production Team
API Scripter
Can you post the command that crashed it?
If you're referencing a stat from a character sheet... I think the api has issues reading those unless an actual attribute has been created.
Here is the power, it is a fairly simple use case: !power --name|@{character_name}'s Lay on Hands --leftsub|@{class-1-name} --rightsub|Level @{class-1-level} --Healing/Damage|[[((@{class-1-level} -1)/2)d6]] In this instance class-1-name and class-1-level exist on the sheet, but have never had any information in the fields.
That would be why. If you put info into them... it should work.
Sure does, like I said user error really, but just figured I should mention it since it does cause the script to fail
I should probably go through and try to catch those kinds of errors... prolly one of those best practices thing you learn in school.
when i was testing my macros with the pathfinder repeating fields it was just giving me an attribute not found message but completing the rest of the card. Seems odd that for Kevin is is crashing the entire script.
I think that it has to do with how repeating sections are handled... there is application side handling of bogus repeating sections, where as with static fields that are empty there is likely no validation done on them.
I noticed that --emote and --whisper are mutually exclusive, is this by design? The reason I ask is that there may be cases where you need to notify users that an action was performed, but want the results directed to the GM. This way if you set an --emote it notifies the user that their action has occurred, but the --whisper sends the results to the GM.
Has anyone come up with a generic macro to get these awesome powercards as outputs for the Macros you can write in 4th edition character sheet powers area?
Kevin said: I noticed that --emote and --whisper are mutually exclusive, is this by design? The reason I ask is that there may be cases where you need to notify users that an action was performed, but want the results directed to the GM. This way if you set an --emote it notifies the user that their action has occurred, but the --whisper sends the results to the GM. I dunno... I will look into it later.I don't have access to the API at the moment. My mentor sub has lapsed and I will pick it back up after payday on Friday.
1407958948
Wes
Sheet Author
@Rob. O, I just write the power card macro in the powers section. I will post an example when I get back to my computer.
Actually I think I've got one that works but for some reason the damage type isn't coming up. Did that part of the script get changed or decommissioned? Looking through the code I can't see where it adds the damage type to the output. Here's what I'm using now for one of my characters: !power --emote|@{character_name} uses @{power-1-name} --name|@{power-1-name} --usage|@{power-1-useage} --action|@{power-1-action} --attack|[[1d20+@{power-1-attack}]] vs @{power-1-def} --damage|[[(1*@{power-1-weapon-num-dice})d@{power-1-weapon-dice}+@{power-1-damage}]] Damage I figured out to add the --format|dnd3e but for some reason when I add a damage type it's dropped from the output.
1407961156
Wes
Sheet Author
I'm pretty sure that the damage tag has been depreciated, I have always just written the damage type after the (--Hit|" ") tag. here is an example of an ability in the 4e power section. Note: I'm lazy and put my critical rolls in, to do this I created 2 new attributes {weapon-1-critical-dice} and for this weapon a {weapon-1-critical-dice-bloodied} I then just call them in the macro using the enhancement of the weapon as the number of dice.
I think I've got it figured out and I'm putting all of those things in the power area on a character sheet rather than having my players make a bunch of macros to fill their screen. It's old habit to have your character sheet handy and I'd rather have them flipping tabs there (and remembering things that we need) rather than doing a ton of macro coding. I mean I'd pay to have that all done but.... :) Still want to see if I can figure out the dmgtype if it's not been removed because a few of my powers call for multiple damage rolls and I'd like to stay consistant. But, hey, I also just learned that Ability mods are in the character sheet too (so no more hand coding those in macros).
Rob O. said: I think I've got it figured out and I'm putting all of those things in the power area on a character sheet rather than having my players make a bunch of macros to fill their screen. It's old habit to have your character sheet handy and I'd rather have them flipping tabs there (and remembering things that we need) rather than doing a ton of macro coding. I mean I'd pay to have that all done but.... :) Still want to see if I can figure out the dmgtype if it's not been removed because a few of my powers call for multiple damage rolls and I'd like to stay consistant. But, hey, I also just learned that Ability mods are in the character sheet too (so no more hand coding those in macros). If you have multiple damage rolls, I would suggest appending the dmg type to the --damage tag. Something like the following !power --name|My Power --attack|[[d20+3]] vs AC --damage|[[d20+2]] fire dmg
1407978275

Edited 1407978595
Honeybadger, on behalf of myself and my players, thank you good sir. This is some amazing work. Thank you so much for sharing.
Larry K. said: Honeybadger, on behalf of myself and my players, thank you good sir. This is some amazing work. Thank you so much for sharing. No problem. Just remember that his has been a group project almost from the beginning. Alex L's 4e script started the idea and I just came up with a visual implementation I liked. Others have made refinements here and there that have helped make it what it is. As for the --damage| tag... it is not deprecated. I simply stopped using --dmgtype| since there were too many ways it wouldn't work. It's easier and more flexible to just type --damage|[[1d6+@{Int Mod} [Int Mod]]] fire damage or --Hit|[[1d6 + @{Int Mod} [Int Mod]]] fire damage
Kevin said: I noticed that --emote and --whisper are mutually exclusive, is this by design? The reason I ask is that there may be cases where you need to notify users that an action was performed, but want the results directed to the GM. This way if you set an --emote it notifies the user that their action has occurred, but the --whisper sends the results to the GM. Durr.... I'm stupid. You could just put the emote into the macro instead of power cards. /emote stuff... !power stuff... That's a short term fix.
I also want to echo my appreciation for the coding behind this. I love what you've come up with here and it makes the outputs from combat rolls SOOOOO much easier. Even just as a DM it's worth $10/month to have access to the API and then not have to worry about making sure I'm always changing my "speak as" when I fire off a macro or hard coding all my names into the macros on the character sheets for all my guys. It's good stuff. I'm still debating if I want to take advantage of the "users colors" or not so that I can more easily see WHO did something vs what kind of power it was. :)
Hah, yeah... that was one of the primary motivations behind power cards. Being able to not worry about Speaking As being the right character.
That is exactly the current workaround that I am using at this stage, it works perfectly that way, thanks!
Question: Is there a way to whisper a power card to a specific player, such that only they see it? Specifically, I'd like to set up an ability where the player can call up information about a target, and nobody else has to see the result. For example, what armor or weapon is the enemy holding? If everyone is using this macro, and everyone can see everyone else's results, there could end up being a LOT of spam going on... I want to hide it, so only the one 'looking' can 'see'. Make sense? -Phnord
1408066554

Edited 1408066673
I'm trying to learn how to use these. I was following the examples on the wiki , but it looks like those are out of date (they break in the current API you posted here). I have deduced that I need to surround rolls with two sets of brackets ([[1d20+3]]) in order to get them to show up properly, and that the dmgtype function no longer exists (so you just put it in line with the damage). Anything else that has changed from that version that I need to be aware of?
Have you reviewed the original post? I believe it is constantly updated with documentation on changes.
Phnord Prephect said: Question: Is there a way to whisper a power card to a specific player, such that only they see it? Specifically, I'd like to set up an ability where the player can call up information about a target, and nobody else has to see the result. For example, what armor or weapon is the enemy holding? If everyone is using this macro, and everyone can see everyone else's results, there could end up being a LOT of spam going on... I want to hide it, so only the one 'looking' can 'see'. Make sense? -Phnord Sounds like a good idea. I will look into that today. Adam R. said: I'm trying to learn how to use these. I was following the examples on the wiki , but it looks like those are out of date (they break in the current API you posted here). I have deduced that I need to surround rolls with two sets of brackets ([[1d20+3]]) in order to get them to show up properly, and that the dmgtype function no longer exists (so you just put it in line with the damage). Anything else that has changed from that version that I need to be aware of? I will try to update the wiki later today. This thread however is the preferred place to keep up to date on any changes. Also, I'd like to thank Larry K for gifting me a month subscription.
I have an update for targeted whispers and it appears to work. I have also made it so emotes appear even when the card itself is whispered. Not sure when I will get these updates in the thread though.
You're welcome sir. I wonder if you might be able to tell me if is possible/how to modify this script? Is it possible to have more than one line break as long as the tag name is not the same? Possibly, lb1|, lb2|, lb3|, etc. The only reason I ask is for one spell(Dispel Magic) that requires a lot of text and multiple line breaks would be an awesome way to break up the wall o' text. I tried duplicating the line break code and fiddling with renaming it but that did not seem to work out.
Ah... I should be able to add multiple line breaks.
Soon!
August 17th, 2014 ~ 9:00 am eastern: Added a variety of new features. Most important however, is that --lb for line breaks is being deprecated and will be removed in the near future. The updates are as follows... --text| tag that can be used to display text only, without the tag. The text tag can also be used with multiple characters after the tag like: --text1|Stuff --text2|Stuff so that you can have multiple text tags in the same power card. Power Cards can now be sent via whispers to the person who triggers the card or the gm. --whisper|self will send the card to the person that triggers the macro. Anything else will send it to the gm instead. Line breaks are now handled inline instead of as a tag. Simply use ^^ to insert a line break. Double * (asterisk) around a word or set of words will bold those words. Double _ (underscore) will italicize words. ^* will insert a 1em space into the text. It could be used at the beginning of a paragraph to indent the first line.
nice!
Most excellent work, indeed!
This is awesome. It will really help with spells that just can't be trimmed down as well helping to draw attention to important parts in the dreaded wall o' text. Thanks for the update.
1408339370
Falcon
Pro
Sheet Author
Where is the most current script located?
Top of the thread...
1408342421
Falcon
Pro
Sheet Author
Thanks - I saw several scripts and wanted to make sure that was the latest. One last Noob question. How does the --crit| work? I put --crit|19 but it doesn't seem to do anything? Is there a trick to it?