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 2

January 06 (10 years ago)
Gen Kitty
Forum Champion
It works! Woohoo. Thank you so much!
January 06 (10 years ago)
vÍnce
Pro
Sheet Author

HoneyBadger said:

Update: Jan 5th, 2014 ~ 8:10 am eastern

  • Version: 2.3.2
  • Minor Update: You can now use --tokenid|@{selected|token_id} or --tokenid|@{target|self|token_id} to use the token image in place of the character avatar in a custom emote.

Now I'm thankful I left the emotes in my macros... Thanks HB
January 06 (10 years ago)
Riley D.
Roll20 Team

GenKitty said:

Yay. Now to get the GM of the game I'm in to update his script... This site *really* needs a script-push system, so updating scripts is easier on GMs :>

We're laying the foundation on that. More tomorrow.
January 06 (10 years ago)
Wow! Just seen there's a new PowerCard script! Dammit, only just finished coding the powers for my player on the old script!

Oh well! Good work HB!
January 06 (10 years ago)
Chad
Sheet Author
I love this, and try to keep it as up to date as I possibly can on my own game. But I do have a suggestion....

My players write their own macros and some of them are quite good at it, but from time to time they still make a mistake. Some of those mistakes crash the API (Usually when they start doing lots of complex die rolls and make a typo or miss a bracket or something.)

Could you possibly put some error catching in here (a try...catch... segment) to let them know when they do something that would have crashed the API?
January 06 (10 years ago)

Riley D. said:

GenKitty said:

Yay. Now to get the GM of the game I'm in to update his script... This site *really* needs a script-push system, so updating scripts is easier on GMs :>

We're laying the foundation on that. More tomorrow.

Woah. I can't believe this is even that high of a priority. That's really exciting news!!
January 07 (10 years ago)
Gen Kitty
Forum Champion

Chad said:

My players write their own macros and some of them are quite good at it, but from time to time they still make a mistake. Some of those mistakes crash the API (Usually when they start doing lots of complex die rolls and make a typo or miss a bracket or something.)

Could you possibly put some error catching in here (a try...catch... segment) to let them know when they do something that would have crashed the API?

If this happens, it would make me ecstatic. Now that I'm playing with new GMs, I like to reduce how often I ask them to do something with the scripts. I try to limit it to "Script has been updated, pretty please get the new version?"

This sort of thing would probably be a powercards 3.0 thing I imagine.
January 07 (10 years ago)
Lithl
Pro
Sheet Author
API Scripter

Chad said:

Could you possibly put some error catching in here (a try...catch... segment) to let them know when they do something that would have crashed the API?

try..catch has limited usefulness in JavaScript. It's generally better to guard against whatever would cause the error in the first place.

January 07 (10 years ago)
Gen Kitty
Forum Champion
Gack. This script crashed and apparently it just sits and spins. There's no error message, according to the GM, and the script just isn't working. :(
January 08 (10 years ago)
Gen Kitty
Forum Champion
And now it mysteriously works again. Maybe it was the server gremlins! ^_^
January 08 (10 years ago)
vÍnce
Pro
Sheet Author

HoneyBadger said:

Update: Jan 5th, 2014 ~ 8:10 am eastern

  • Version: 2.3.2
  • Minor Update: You can now use --tokenid|@{selected|token_id} or --tokenid|@{target|self|token_id} to use the token image in place of the character avatar in a custom emote.



I think the --whisper| tag may be messing with the new feature...?

Also, can you use both --tokenid and --charid in the same card without issue?
January 09 (10 years ago)
vÍnce
Pro
Sheet Author
Bugfix: Jan 8th, 2015 ~ 11:00 pm eastern
Version: 2.3.3
Bugfix: Custom style emotes were broken when trying to use them with the --tokenid and --whisper tags combined.
DING! Looks like we've got an update.
Thanks HB

January 09 (10 years ago)
vÍnce
Pro
Sheet Author

HoneyBadger said:

Bugfix: Jan 9th, 2015 ~ 5:00 am eastern

  • Version: 2.3.4
  • Bugfix: Fixed if/else logic issues in regards to --emote, --charid, and --tokenid tags.

Back-to-Back updates!

January 11 (10 years ago)
vÍnce
Pro
Sheet Author
Riley D. said:
We now have this on Dev in two ways:
Roll Templates, which are a way for sheet authors to create stylized listings of rolls that match the system and sheet they've created.
Basic text formatting for all text chat messages, including bolding, italicizing, adding links, and even embedding images in your chat messages, via Markdown.

Basic HTML/other formatting output to chat

How will this affect powercards...? Still necessary?

January 12 (10 years ago)
The Aaron
Pro
API Scripter
There are still things that HB's PowerCard script does that are not handled by the Roll Templates. Since Roll Templates (besides default) will need to be added to the character sheet, it might be easier for most people to use a powercard instead of crafting a CSS/HTML block and copying their favorite sheet over to custom to use it.
January 12 (10 years ago)

Edited January 12 (10 years ago)
vÍnce
Pro
Sheet Author
Ding. v2.4.0 is up.

https://gist.github.com/Sky-Captain-13/452330a3d92...

Update & Bugfixes: January 12th, 2015 ~ 1:00pm eastern

  • Major Update: Deprecated and removed the use of [HR] and [LR] for crit success/crit failure roll highlighting. Instead, use the new roll options on the dev server 1d4cs4 and 1d4cf1. The new roll highlighting should work for every combination or lack of roll options available now. The [NH] tag inside an inline roll continues to suppress roll highlighting.
  • Bugfix: Fixed missing label bracket in tooltip. [Dex Mod] was showing up as [Dex Mod instead.
  • Bugfix: Cleaned up formatting of tooltips. Made highlighted numbers a little easier to see.

This version will only work on the dev server for highlighting custom rolls using the new roll options.
January 12 (10 years ago)
Can the new API Command Button feature be supported in PowerCards 2.x?
January 12 (10 years ago)
The Aaron
Pro
API Scripter
The markdown syntax doesn't currently work with it, but there is no technical reason HB couldn't add that functionality.
January 12 (10 years ago)

Edited January 12 (10 years ago)
Gen Kitty
Forum Champion
*big blue eyes* There's been an item on my wishlist for ages and I didn't mention it because I didn't think it was actually possible without a lot of irritating work. But then I read this: https://app.roll20.net/forum/post/1496126/#post-14...

The item I'm referring to is "{{#rollWasCrit() attack}}" -- I know it's edging deeper into automated territory, and handling it for Pathfinder/3.5 and before is different than handling it for 4e/5e and forward, and that's just looking at D20 systems, but I'm hoping this is something that can be chewed on and eventually added.

I'm thinking something along the lines of a --CRITLINE| that only shows if some other tag rolled a critical roll. The --CRIT| tag could have its own dicerolling, to handle 3.5/Pathfinder/other_systems_with_confirmation_rolls, and to handle systems such as 3.x/Pathfinder/5e where you roll additional dice for damage, or it can simply have text/math put in by the user for systems like 4e where you do max damage on a crit.

I know it is a lot of work, but the base code is there now to make it happen. ^_^

Edited to add: Or maybe not, further reading in that thread indicates 'show if crit' is kinda broken. x.x Still, we have the concepts, and as long as the script isn't checking to see if someone hit, only checking if a crit on the die was rolled, things should be good, yeah?
January 12 (10 years ago)

Edited January 12 (10 years ago)
vÍnce
Pro
Sheet Author
Tooltips over inline rolls are working now and will include the little API message verification.

However, I don't think the cs and cf roll "helpers" are working as expected inside powercards.

    !power --name|test --Always Crit|[[1d20cs>1]] --Always Fail|[[1d20cf<20]]

We should be seeing a Green Box on top and a Red box below on every roll. This is with PC v2.4.0 up and running.
January 13 (10 years ago)
The Aaron
Pro
API Scripter
Yeah, the parse inlinerolls function will need to be adjusted.
January 13 (10 years ago)
vÍnce
Pro
Sheet Author
gist.github.com/Sky-Captain-13/452330a3d926b32da49c

Bugfix: January 12th, 2015 ~ 9:20pm eastern

  • Version: 2.4.1 -- DEV SERVER ONLY
  • Bugfix: The cs/cf roll options actually work now.
January 15 (10 years ago)

Edited January 15 (10 years ago)
So I'm not sure what is happening here but when I use anything in this macro my output is looking like this:



I'm using the code from the top post and the basic macros shown in this thread to work. From what I can tell the headers are not lining up with my body text and I'm consistently having the first line of my body overlapping with the header.

Behind the header is text that states: : -J_7UeoR3Hmgn1W6VYSN
You can see the "N" poking out on a few of them.

January 15 (10 years ago)

Edited January 15 (10 years ago)
Update: The ": -J_7UeoR3Hmgn1W6VYSN" was an issue with that specific macro, but for any macro run through !power we have two problems:

-The header will shrink from the size of the rest of the style sheet and floats down over the first row of the the rest of the power card.
-Rolls in each row are overlapping the text that borders them.

The problem only happens with the available 2.4.1 code. The 1.0 code from the last thread works in formatting without issue.
January 15 (10 years ago)
vÍnce
Pro
Sheet Author

Encartrus said:

Update: The ": -J_7UeoR3Hmgn1W6VYSN" was an issue with that specific macro, but for any macro run through !power we have two problems:

-The header will shrink from the size of the rest of the style sheet and floats down over the first row of the the rest of the power card.
-Rolls in each row are overlapping the text that borders them.

The problem only happens with the available 2.4.1 code. The 1.0 code from the last thread works in formatting without issue.
Are you using the latest version on the Dev server?

January 15 (10 years ago)
No, which is likely part of the problem. Is there a stable code for normal games?
January 15 (10 years ago)
vÍnce
Pro
Sheet Author
If you are NOT on the Dev Server, use v2.3.4
https://gist.github.com/Sky-Captain-13/452330a3d926b32da49c/47d2a57c726dd443819e91ef1f49e5a6f134cda6

Revert to v2.3.4 to fix the formatting and the character_id for non-dev server games.

January 16 (10 years ago)
Works like a charm, thanks!
January 16 (10 years ago)
A new thing this afternoon is my player' powercards are sending two of each powercard when they click their macros. I've deleted all of my API scripts and readded just the code listed above, but it is still sending two of each item (including the exact same rolls for both).

Normal macros, chat, and dicerolls aren't doubling, only powercards. Any ideas?
January 17 (10 years ago)
vÍnce
Pro
Sheet Author

Encartrus said:

A new thing this afternoon is my player' powercards are sending two of each powercard when they click their macros. I've deleted all of my API scripts and readded just the code listed above, but it is still sending two of each item (including the exact same rolls for both).

Normal macros, chat, and dicerolls aren't doubling, only powercards. Any ideas?

Did you paste the powercard script in twice....? :-)
January 17 (10 years ago)
Gen Kitty
Forum Champion
Silly question: Is there a way to have variable-multitargets have 'Target 1' 'Target 2' and so on, instead of just plain 'Target' and I'm just missing it?
January 17 (10 years ago)

GenKitty said:

Silly question: Is there a way to have variable-multitargets have 'Target 1' 'Target 2' and so on, instead of just plain 'Target' and I'm just missing it?

like this? Pasted from above in HB's instructions...

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.

January 17 (10 years ago)

Vince said:

Encartrus said:

A new thing this afternoon is my player' powercards are sending two of each powercard when they click their macros. I've deleted all of my API scripts and readded just the code listed above, but it is still sending two of each item (including the exact same rolls for both).

Normal macros, chat, and dicerolls aren't doubling, only powercards. Any ideas?

Did you paste the powercard script in twice....? :-)

For the record, I've had this happen a couple of times. I typed out everything by hand in the chat box a few times and used a macro button a few times and it showed 2 chat entries when the text was only sent once. It has only happened those few random times and has not happened since. But I definitely didn't have the script entered more than once and their were no API type errors. I just chalked it up to gremlins and moved on. Just thought I would say this has happened to me as well and Encartrus isn't crazy! ;)
January 17 (10 years ago)
vÍnce
Pro
Sheet Author
Double pasting the script was just the first thing I tried, and it doubled the output... just thought it may be that simple. I do believe in ghost scripts also. :~)
January 17 (10 years ago)
Gen Kitty
Forum Champion

Wade said:

GenKitty said:

Silly question: Is there a way to have variable-multitargets have 'Target 1' 'Target 2' and so on, instead of just plain 'Target' and I'm just missing it?

like this? Pasted from above in HB's instructions...

No. What I meant instead of the output being

Target: Blah blah blah
Target: Blah blah blah

you get

Target 1:Blah blahblah
Target 2:Blah blah balh

January 17 (10 years ago)

Vince said:

Double pasting the script was just the first thing I tried, and it doubled the output... just thought it may be that simple. I do believe in ghost scripts also. :~)

Checked again and no, sadly. I also totally wiped every API I've got and started from scratch as part of my hunt for the source yesterday.

However! the problem seemed to resolve itself overnight so maybe it was on the server end? We haven't changed anything but somewhere between midnight and 6:00am EST the problem resolved itself.

January 17 (10 years ago)
vÍnce
Pro
Sheet Author

Encartrus said:

Vince said:

Double pasting the script was just the first thing I tried, and it doubled the output... just thought it may be that simple. I do believe in ghost scripts also. :~)

Checked again and no, sadly. I also totally wiped every API I've got and started from scratch as part of my hunt for the source yesterday.

However! the problem seemed to resolve itself overnight so maybe it was on the server end? We haven't changed anything but somewhere between midnight and 6:00am EST the problem resolved itself.

That means you fixed it. :-) HB, Wade, and others have mentioned that they have also had "dupes". HB said that he believes it's an "API Server issue". Until we figure out how to reproduce it... Glad it's working for you again.
January 17 (10 years ago)
Chad
Sheet Author

Vince said:

If you are NOT on the Dev Server, use v2.3.4
https://gist.github.com/Sky-Captain-13/452330a3d926b32da49c/47d2a57c726dd443819e91ef1f49e5a6f134cda6

Revert to v2.3.4 to fix the formatting and the character_id for non-dev server games.


I had this same problem (updated to 2.4.2 instead of 2.3.4). Reverting worked.

May I suggest updating the first post here so others don't have the same trouble?
January 17 (10 years ago)
vÍnce
Pro
Sheet Author
HB is "on-vacation" for a little while. I can't edit the original post, but we might be able to get one of the Moderators to help us out.
January 18 (10 years ago)

Edited January 18 (10 years ago)
It seems that attribute charms do not work if the value is a calculated value as many are in the 5e DnD Character sheet

If I would normally have to do [[@{target|AC}]] I try [[%%AC%%]] or %%[[AC]]%% or %%AC%% it blows up with this error

SyntaxError: Expected "(", ".", "[", "abs(", "ceil(", "d", "floor(", "round(", "t", "{", [ |\t], [+|\-] or [0-9] but "A" found.

Any chance that it could be made to work with character sheet calculated values?
January 18 (10 years ago)

Edited January 18 (10 years ago)
vÍnce
Pro
Sheet Author

Shawn P. said:

It seems that attribute charms do not work if the value is a calculated value as many are in the 5e DnD Character sheet

If I would normally have to do [[@{target|AC}]] I try [[%%AC%%]] or %%[[AC]]%% or %%AC%% it blows up with this error

SyntaxError: Expected "(", ".", "[", "abs(", "ceil(", "d", "floor(", "round(", "t", "{", [ |\t], [+|\-] or [0-9] but "A" found.

Any chance that it could be made to work with character sheet calculated values?

I noticed that as well with the PF sheet's auto-calc fields. I've also noticed other scripts that can't pull from the auto-calc attributes... I believe you will only get the formula for that attribute which breaks the script.
January 19 (10 years ago)
Having some issues with this... everything bunches up and goes to the left on one line and when I use multiple powercards they seem to paste over each other.
January 19 (10 years ago)
vÍnce
Pro
Sheet Author

Papercutt said:

Having some issues with this... everything bunches up and goes to the left on one line and when I use multiple powercards they seem to paste over each other.
Can you post a macro you are having an issue with and possibly a screen shot. Thanks Papercutt. Time for sleep...

January 19 (10 years ago)

Edited January 19 (10 years ago)

Vince said:

Papercutt said:

Having some issues with this... everything bunches up and goes to the left on one line and when I use multiple powercards they seem to paste over each other.
Can you post a macro you are having an issue with and possibly a screen shot. Thanks Papercutt. Time for sleep...


I wont be able to get a screen shot from this computer, however the macro I am trying to use is an initiative roll that adds to the tracker
!power --format|atwill --name|Initiative[[1d20 +?{modifier?} &{tracker}]]
This shows the green power card title which says "initiative" bunched up close to the left with the roll result next to it and when other macros are posted it goes over the top of the previous

and a critical fail roll table which I had working until a few minutes ago
!power --emote|You have rolled... poorly. --format|atwill --name|Critical Fail [[1t[Critical-Failure]]]
this shows the roll table over the emote and when multipul are posted posts over the previous one.

EDIT:
I also have an end of encounter loot macro
!power --name|Loot --format|default --emote|Loot found amongst the fallen boddies --Encounter XP|?{XP?} --Coin|?{coin?} --Armor|?{Armor?} --Ammo|?{Ammo?} --Weapons|?{Weapons?} --Apparel|?{apparel?} --Magic Item|?{Magic Items?} --Anything Else|?{Anything else?}
which has the green "loot" name over half of the next line.


EDIT2:
Have the API script working, however I had to copy an old copy of a code from a game I had a few days ago... the one above breaks my macros and the one I copied 2 or 3 days ago works perfect.
January 19 (10 years ago)
Gen Kitty
Forum Champion
Doublecheck that you're using 2.3.4 on a production server and not trying to use his only-for-dev-server version?
January 19 (10 years ago)

GenKitty said:

Doublecheck that you're using 2.3.4 on a production server and not trying to use his only-for-dev-server version?

I just did a fresh copy and paste of 2.3.4 (from above) into API on my game and still having the same issues... then I copied from the game I had with you a few days ago, and that works perfectly... both say 2.3.4 Not sure what is going on there but the copy from above does not work and the one I copied a few days ago does.
January 19 (10 years ago)
Gen Kitty
Forum Champion
That's... really weird. And troubling.
January 21 (10 years ago)
For those looking to use this with the 5e character sheet I settled on this as an adequate way to use the calculated fields without using %{selected|someroll} values.

!power --emote|Elodin slams his fists into @{target|token_name}. --name|Unarmed --leftsub|Bonus Action --rightsub|Reach 5 ft. --attack|[[1d20 + @{selected|meleetohit2}]] | [[1d20 + @{selected|meleetohit2}]] vs. AC [[@{target|NPC_AC}]] of **@{target|character_name}** --damage|[[@{selected|meleedmg2} + @{selected|meleedmgbonus2}]] --crit|Additional [[@{selected|meleedmg2}]] damage.

It may not take the global attack and damage into account, so I may need to add that in also. I need to look into that.

January 21 (10 years ago)
Gen Kitty
Forum Champion
I would advise two things: Use token_name instead of character_name, not all mooks will have a character sheet, and it will take into account GMs using Mook 1, Mook 2, Mook 3 and so on.

Secondly, use labels. @{target|LABEL|Attribute} -- Example:

!power --emote|Elodin slams his fists into @{target|Foe|token_name}. --name|Unarmed --leftsub|Bonus Action --rightsub|Reach 5 ft. --attack|[[1d20 + @{selected|meleetohit2}]] | [[1d20 + @{selected|meleetohit2}]] vs. AC [[@{target|Foe|NPC_AC}]] of **@{target|Foe|token_name}** --damage|[[@{selected|meleedmg2} + @{selected|meleedmgbonus2}]] --crit|Additional [[@{selected|meleedmg2}]] damage.

That way you only have to click once. If you have two targets, you can do something like Foe 1 and Foe 2, or Target 1, Target 2. So on and so forth for more and more targets.