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

1420324932
vÍnce
Pro
Sheet Author
Suggestion: If the PowerCard Formats handout includes a default: tag, use that as the default formatting for powercards, otherwise use the formatting in the script. Questions: Any way to set font-sizes in the PowerCard Formats handout? Any way to set the font-size of inline rolls? Can a sheet's auto-calculated attributes be used with --target_list? Having issues with the PF sheet. I assume it's the nature that auto-calculated attributes don't show up on the attributes & abilities tab. I'm trying to get my macros right and as "future-proof" as possible, but I feel like I've fallen down the rabbit hole... :~O
1420325379

Edited 1420325539
Vince said: Suggestion: If the PowerCard Formats handout includes a default: tag, use that as the default formatting for powercards, otherwise use the formatting in the script. Questions: Any way to set font-sizes in the PowerCard Formats handout? Any way to set the font-size of inline rolls? Can a sheet's auto-calculated attributes be used with --target_list? Having issues with the PF sheet. I assume it's the nature that auto-calculated attributes don't show up on the attributes & abilities tab. I'm trying to get my macros right and as "future-proof" as possible, but I feel like I've fallen down the rabbit hole... :~O 1. Currently, no. 2. Again, not at the moment. 3. I don't know... I don't use character sheets. Your default suggestion idea is a good one. Should be doable.
Version 2.2.2 This macro: !power --name|Italics --!sometext|This is //Italics// Gives this error: ReferenceError: obj is not defined at doInlineFormatting (evalmachine. :299:28) at evalmachine. :154:13 at Array.forEach (native) at Object.PowerCard.Process (evalmachine. :152:7) at evalmachine. :16:59 at eval ( Removing the // formatting resolves the issue.
1420334768

Edited 1420334871
Oops, must have missed changing obj to content on that line. Quick Fix: Go to line 299 and change obj to content on that line. content = (f % 2 == 1) ? content.replace("//", "<i>") : content.replace("//", "</i>");
HoneyBadger said: Oops, must have missed changing obj to content on that line. Quick Fix: Go to line 299 and change obj to content on that line. content = (f % 2 == 1) ? content.replace("//", "<i>") : content.replace("//", "</i>"); Ding!
1420336054

Edited 1420336201
Bugfix: Jan 3rd, 2015 ~ 8:45 pm eastern Version: 2.2.3 Bugfix: Using italics inline formatting would crash the script. (Michael)
Formatting is now broken within both the emote tag as well as anything within the name row on the card (name, leftsub, rightsub) (only leftsub is shown not working above but all three do not work). Also, the emote text field tends to touch the avatar of those with pictures that have a 1:1 ratio, or wider. Try this: if (SHOW_AVATAR) PowerCard.emote = Avatar + '<div style="display: table-cell; width: calc(100%-50px); vertical-align: middle; font-size: 12px; font-style: italic; text-align: center;">' + PowerCard.emote + '</div>'; On line 103 to... if (SHOW_AVATAR) PowerCard.emote = Avatar + '<div style="display: table-cell; width: calc(100%-58px) ; vertical-align: middle; font-size: 12px; font-style: italic; text-align: center; padding-left: 8px; ">' + PowerCard.emote + '</div>'; Of course, the amount is up to your discretion and being that I'm not a mentor, I haven't been able to personally test this (it's just from my own web scripting knowledge).
That is very pink... o_0 ... but yeah, I'll add a little padding between the image and the text of the emote. Also, I had never considered the inline formatting of text for the emote or title/subtitle area. Didn't know it worked before. Will try to undo whatever I did that made it stop working.
1420367672

Edited 1420367689
vÍnce
Pro
Sheet Author
Sleep much HB?
Been off work this whole week due to the holidays. Sleep schedule is a little off since I usually work nights.
1420374625

Edited 1420375324
Minor Updates & Bugfix: Jan 4th, 2015 ~ 7:30 am eastern Version: 2.2.4a Bugfix: Inline formatting was inadvertently removed as a feature from custom emotes and the title/subtitle section of the powercard. (Aetheria) Bugfix: Added error check on the state.PowerCard_Formats object (The Aaron) Minor Update: Adjusted padding between text and avatar in custom emotes for readability. (Aetheria) Minor Update: Added the USE_DEFAULT_FORMAT config option. Set this variable to true to use the default: format in your PowerCard Formats handout... if the macro does not have a --format tag. It will overwrite any of the formatting tags in the macro itself! Such as --txcolor, --bgcolor, --erowtx, etc. that are set in the handout. (Vince) Minor Update: Title background and text colors in powercards now default to the player color and white/black. These colors are overwritten by any use of any means of setting the colors. The only thing this changes is that powercards will no longer default to green with white text. Minor Update: --format|player will use the player color as well without needing to be defined in the PowerCard Formats handout. Minor Update: Added the following formatting tags... --titlefontsize, --subtitlefontsize, --bodyfontsize, --border
Update: Jan 4th, 2015 ~ 11:30 am eastern Version: 2.3.0 COLORS! Yes, you can now add colors to your text using this inline formatting: $$#400|fire$$ It accepts any valid html hex code.
1420391330
The Aaron
Pro
API Scripter
HoneyBadger said: Update: Jan 4th, 2015 ~ 11:30 am eastern Version: 2.3.0 COLORS! Yes, you can now add colors to your text using this inline formatting: $$#400|fire$$ It accepts any valid html hex code. Wow! Über slick!!
I should probably take a lot of the inline formatting stuff and apply it to a simple chat replacement script. That way people can use it without powercards for non-macro stuff.
1420397043
The Aaron
Pro
API Scripter
Or better yet, extract it into a library object that is used by powercards, your chat replacement and any script author that wants to use it. :)
1420397146
vÍnce
Pro
Sheet Author
HoneyBadger said: I should probably take a lot of the inline formatting stuff and apply it to a simple chat replacement script. That way people can use it without powercards for non-macro stuff. You're pushing the envelope HB! Awesome work.
1420397602
Gen Kitty
Forum Champion
Colors! You gave me colors!!!! Colors and fonts, oh ghods, I feel like I'm back in the 90s and just learning to make webpages.... must show restraint... HB: Please promise me you will never *ever* make a blink tag available. NEVER
1420398018
vÍnce
Pro
Sheet Author
GenKitty said: Colors! You gave me colors!!!! Colors and fonts, oh ghods, I feel like I'm back in the 90s and just learning to make webpages.... must show restraint... HB: Please promise me you will never *ever* make a blink tag available. NEVER Animated GIF's pleaeeeeese...... lol
1420398574
Gen Kitty
Forum Champion
YES YES YES YES, Variable Multiattacks WORK!! *loud cackling* Look! It's moving. It's alive. It's alive... It's alive, it's moving, it's alive, it's alive, it's alive, it's alive, IT'S ALIVE! *ahem* Mr HoneyBadger, sir, thank you for realizing my most dearly held wish since I first laid eyes on your script. :>
1420398963
Gen Kitty
Forum Champion
Hm. I can't make inline color work; !power --name|Testing Colors --Line1|Some Text $$#400|This text will be in dark red.$$
It is on my screen. You have the latest version installed?
It's also not working on mine, and I have the latest version (2.3.0). I am working on the main server and not the Dev, if that makes a difference.
1420400711

Edited 1420401085
Ok, weird. I look in my API and it says I have version 2.3.0 installed. But when I do !Power_version, it says 2.2.1. Perhaps there is a lag on the API server? Edit: Fixed! I had to disable to script, run any random API command, and then reenable. Weird, but not a problem.
1420400751
Gen Kitty
Forum Champion
Latest version, not on Dev, does not work
1420400860

Edited 1420400883
Gen Kitty
Forum Champion
Nevermind. If I change the colorcode to pure red, it shows. I think your test red is just too dark to be distinguished from black :>
Vince said: GenKitty said: Colors! You gave me colors!!!! Colors and fonts, oh ghods, I feel like I'm back in the 90s and just learning to make webpages.... must show restraint... HB: Please promise me you will never *ever* make a blink tag available. NEVER Animated GIF's pleaeeeeese...... lol Actually... animated gifs work in chat... ಠ_ಠ <a href="https://plus.google.com/+JonathanBlack/posts/A2mLKirA32t" rel="nofollow">https://plus.google.com/+JonathanBlack/posts/A2mLKirA32t</a>
1420401769
Gen Kitty
Forum Champion
Holy shit. O.O
1420404056

Edited 1420404421
vÍnce
Pro
Sheet Author
game changer. <a href="http://darkdemon.org/user-files/37704/1367147811.gif" rel="nofollow">http://darkdemon.org/user-files/37704/1367147811.gif</a>
Because I'm still a javascript hack, I need a little help. Version 2.3.0 use case scenario: From a script I am developing, which is using PowerCards script for output. Passing the message to the PowerCards API as: ... showChaosFactor = function(chaosFactorMsg) { sendChat('API',' --name|Mythic --title|Chaos Factor --leftsub|Version --rightsub|' + version +' --Chaos Factor|[[' + state.Mythic.chaosFactor + ']]' + chaosFactorMsg, function(ops){ PowerCard.Process(ops[0]) }); }, ... I'm getting the following error: evalmachine. :278 var PlayerBGColor = getObj("player", msg.playerid).get("color"); ^ TypeError: Cannot call method 'get' of undefined at Object.PowerCard.Process (evalmachine. :278:53) at evalmachine. :14:23 at checkFinishedOps ( This worked in the previous PowerCards version. I assume it has something to do with this PowerCards statement: var PlayerBGColor = getObj("player", msg.playerid).get("color"); Unable to get the playerid from the msg I am sending? Just point me in the right direction please.
Yeah. That would be why... hrm. There are ways you can make it work, but you'll always have to remember to edit that part of the script each time it updates. The reason it worked before, is because those lines were hidden behind an if statement and wouldn't get executed unless you changed a config option for USE_PLAYER_COLORS.
1420406862
The Aaron
Pro
API Scripter
Shouldn't Michael be able to just set a playerid on the object he's passing into PowerCard.Process()? Assuming showChaosFactor is being passed to on('chat:message'): showChaosFactor = function(chaosFactorMsg) { sendChat('API',' --name|Mythic --title|Chaos Factor --leftsub|Version --rightsub|' + version +' --Chaos Factor|[[' + state.Mythic.chaosFactor + ']]' + chaosFactorMsg, function(ops){ var fakemsg = ops[0]; fakemsg.playerid = chaosFactorMsg.playerid; PowerCard.Process(ops[0]) }); },
The Aaron said: Shouldn't Michael be able to just set a playerid on the object he's passing into PowerCard.Process()? Assuming showChaosFactor is being passed to on('chat:message'): showChaosFactor = function(chaosFactorMsg) { sendChat('API',' --name|Mythic --title|Chaos Factor --leftsub|Version --rightsub|' + version +' --Chaos Factor|[[' + state.Mythic.chaosFactor + ']]' + chaosFactorMsg, function(ops){ var fakemsg = ops[0]; fakemsg.playerid = chaosFactorMsg.playerid; PowerCard.Process(ops[0]) }); }, Thanks for the suggestion, however, the API doesn't seem to have a playerid when it sends chat? At least my minimal skills at poking at it seem to indicate it returns a Nan, thus the TypeError. Considering forcing the fakemsg to have a playerid of the player that initiated my script but not certain exactly how to approach that just yet, so I've got some work ahead of me. In the meantime, I'll workaround it.
1420423366
The Aaron
Pro
API Scripter
Michael said: The Aaron said: [...] Assuming showChaosFactor is being passed to on('chat:message'): [...] Considering forcing the fakemsg to have a playerid of the player that initiated my script but not certain exactly how to approach that just yet, so I've got some work ahead of me. In the meantime, I'll workaround it. Yeah, that's what I was suggesting. If you wanna PM me your script, I can probably help you get it worked out. =D
1420427749

Edited 1420427913
Michael, I just altered the powercard process part to send the player object separately. You can pass this player object to PowerCard.process as well which will solve your problem without having to add msg.playerid in a convoluted fashion. Just grab the player object in your script and pass it this way: PowerCard.Process(msg, player_obj);
Update: Jan 4th, 2014 ~ 10:20 pm eastern Version: 2.3.1 Minor Update: Added option to pass a player object to the PowerCard.Process function to help maintain backwards compatibility with other scripts that use PowerCard.Process for output. (Michael)
showChaosFactor = function(chaosFactorMsg, msg.playerid) { var player = getObj("player", msg.playerid); var chaos = ' --name|Mythic --title|Chaos Factor --leftsub|Version --rightsub|' + version +' --Chaos Factor|[[' + state.Mythic.chaosFactor + ']]' + chaosFactorMsg; sendChat('API', chaos, function(ops) { PowerCard.Process(ops[0], player); }); } Something like that should work...
I am unable to change the color of the title using "txcolor" neither in the macro itself nor using the "format" tag. --bgcolor|#ed85c9 --txcolor|#fff --erowtx|#000 --erowbg|#f7c8e7 --orowtx|##000 --orowbg|#fadef1 --corners|4 --border|2px solid #e342ab Title text color still appears as #000 (Black) rather than #FFF (White). Thanks for the fixes I brought up yesterday! You're quick.
Your GM probably has a default: entry in the handout. That's the only thing I can think of without logging into the campaign myself and checking it out.
Nah, the only entry is mine. Is it working in your campaign? So it is on my end? If it isn't, then perhaps it has to do with the calculation of the hue to determine whether the text should be white or black overriding the txcolor? Because that's still working on my end.
I just tested it in a handout in my campaign and it worked.
1420433263

Edited 1420438263
Boo! I'll figure it out then. Thank you! That is very pink... o_0 That's... extremely pink. x.x Yeah, isn't it great? Doesn't it just... melt your eyes ? Delicious .
1420435192
Gen Kitty
Forum Champion
That's... extremely pink. x.x
Just logged in after some hiatus and found updated powercards. Thanks a lot.
HoneyBadger said: Michael, I just altered the powercard process part to send the player object separately. You can pass this player object to PowerCard.process as well which will solve your problem without having to add msg.playerid in a convoluted fashion. Just grab the player object in your script and pass it this way: PowerCard.Process(msg, player_obj); Man that was awesome of you! Thanks much! I am able to pass the playerid now based on who initiated my script.
1420532748
Gen Kitty
Forum Champion
Vague Wish: I wish I could have the powercard show my token image instead of my avatar image.
That can be arranged. When I'm not at work.
1420535041
vÍnce
Pro
Sheet Author
Slacker
GenKitty said: Vague Wish: I wish I could have the powercard show my token image instead of my avatar image. To do this, you'll have to use --tokenid|@{selected|token_id} or @{target||token_id}. There simply is no easy way to get the token associated with a character sheet without going through all the tokens on the page and looking for whichever one is represented by the character with character_id.
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.
1420575821
Gen Kitty
Forum Champion
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 :&gt;