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

Samuel Penn said: Actually, I've found the problem. If you specify --tokenid, but don't also specify --emote, then the PowerCard.emote.charAt(0) call on line 122 fails. Possibly the || in the outer if condition needs to be an &&? Weird. It shouldn't ever get to that point... the whole if statement should be ignored as soon as anything is not a true comparison.
Here's a quick fix until I upload another update... Change line 114'ish to this: if (CUSTOM_EMOTES && PowerCard.emote !== undefined && (PowerCard.charid !== undefined || PowerCard.tokenid !== undefined)) {
Thank you HoneyBadger for the details, and more generally I thank you for making and maintaining Powercards. They are truly a significant quality of life improvement for my games and I really can't thank you enough!
I did a very simple test with the [XPND] functionality on an autocalcluated sheet value (which as I understand may not work as expected), but it generated the following error: ReferenceError: floor is not defined at eval (eval at processRoll (evalmachine. :497:34), :1:1) at processRoll (evalmachine. :497:25) at evalmachine. :419:16 at Array.forEach (native) at buildInline (evalmachine. :418:27) at Object.PowerCard.Process (evalmachine. :215:16) at evalmachine. :20:13 at eval ( This is with 2.4.4 on the DEV server using the DnD 5e sheet. The powercard I created was simply: !power --name|Test Expand --Result|[[ [XPND] 1d20+@{Bob|strength_mod}]] "Bob" is a character sheet that exists and removing the [XPND] allows the Powercard to work. The formula for strength_mod is (floor((18-10)/2)) where the value for strength was 18.
I am not able to get the whisper tag to work i am trying to send it to a select character token. Here is my Marco: !power --whisper|??? --name|Health Points --txcolor|#FFF --bgcolor|#400 . --@{selected|token_name}|[[{@{selected|HP}}+?{Health Points Change?} &{HP}]] Thanks, Levis Wiggins
You can't send whispers to tokens. It has to be a character or GM.
Kevin said: I did a very simple test with the [XPND] functionality on an autocalcluated sheet value (which as I understand may not work as expected), but it generated the following error: ReferenceError: floor is not defined at eval (eval at processRoll (evalmachine.:497:34), :1:1) at processRoll (evalmachine.:497:25) at evalmachine.:419:16 at Array.forEach (native) at buildInline (evalmachine.:418:27) at Object.PowerCard.Process (evalmachine.:215:16) at evalmachine.:20:13 at eval ( This is with 2.4.4 on the DEV server using the DnD 5e sheet. The powercard I created was simply: !power --name|Test Expand --Result|[[ [XPND] 1d20+@{Bob|strength_mod}]] "Bob" is a character sheet that exists and removing the [XPND] allows the Powercard to work. The formula for strength_mod is (floor((18-10)/2)) where the value for strength was 18. Yeah, I hadn't had a chance to test auto-calculated with ceil and floor and such. I'll have to see if there's an easier way or another way to do this. >_<
1424124510
The Aaron
Pro
API Scripter
Levis said: I am not able to get the whisper tag to work i am trying to send it to a select character token. HoneyBadger said: You can't send whispers to tokens. It has to be a character or GM. You should be able to do this though: !power --whisper| @{selected|character_name} --name|Health Points --txcolor|#FFF --bgcolor|#400 . --@{selected|token_name}|[[{@{selected|HP}}+?{Health Points Change?} &{HP}]] Provided the token is connected to a character...
Thank you HoneyBadger, that fixed it!
1424142077

Edited 1424146476
The Aaron said: Provided the token is connected to a character... this is sooo hit or miss with most DM's in LFG
1424146088
Gen Kitty
Forum Champion
What is that macro supposed to do, anyway? Every time I peer at it, I can't parse it at all :>
The Macro just does the math for you and tell you what your hp should be. Thanks for the help.
Levis said: Here is my Marco: !power --whisper|??? --name|Health Points --txcolor|#FFF --bgcolor|#400 . --@{selected|token_name}|[[{@{selected|HP}}+?{Health Points Change?} &{HP}]] Are we able to assign values to attributes? What does the "...&{HP}]]" do?
No, powercards does not alter any attributes.
1424295510

Edited 1424295542
Gen Kitty
Forum Champion
Yeah, that &{HP} is why I asked the same question. Also, there's an extraneous period between the bgcolor tag and the token_name tag which can't be helping matters any.
1424326269
vÍnce
Pro
Sheet Author
I'm having an issue with adding URL's. on Dev with v2.4.4 (ALLOW_URLS = true; ALLOW_HIDDEN_URLS = true;) I've added; @@ <a href="http://www.d20pfsrd.com/classes/core-classes/paladin#TOC-Divine-Bond-Sp-||Divine" rel="nofollow">www.d20pfsrd.com/classes/core-classes/paladin#TOC-Divine-Bond-Sp-||Divine</a> Bond@@ But when I click the hyperlink "Divine Bond" in chat, first I don't get the redirection warning, so it immediately loads the link over the editor, and "https://" is added to the link which forces a "This webpage is not available" error.
Vince said: I'm having an issue with adding URL's. on Dev with v2.4.4 (ALLOW_URLS = true; ALLOW_HIDDEN_URLS = true;) I've added; @@ <a href="http://www.d20pfsrd.com/classes/core-classes/paladin#TOC-Divine-Bond-Sp-||Divine" rel="nofollow">www.d20pfsrd.com/classes/core-classes/paladin#TOC-Divine-Bond-Sp-||Divine</a> Bond@@ But when I click the hyperlink "Divine Bond" in chat, first I don't get the redirection warning, so it immediately loads the link over the editor, and "https://" is added to the link which forces a "This webpage is not available" error. Hrm, you'll have to ask Aaron about why it is adding https to the front. Ver 244 has his inline formatting script in there and no idea why the redirection warning isn't popping up.
1424352248
The Aaron
Pro
API Scripter
Hmm... The line that does the cleanup is this: url = parts.shift().replace(/^(http(s)?:\/\/|\/\/()|())/,'http$2://') it will match the beginning of the url (^) and strip https://,http://, or // from it and replace it with https://,http://, http:// depending on if it had httpd to begin with. IT shouldn't end up with https on there. If you used the previous version that subbed on just //, it would default to the access protocol of the page, which is https. I need to look at the source...
1424362759
The Aaron
Pro
API Scripter
Just grabbed the latest code and tried this: !power --name|Test --link|@@<a href="http://www.d20pfsrd.com/classes/core-classes/paladin#TOC-Divine-Bond-Sp-||Divine" rel="nofollow">www.d20pfsrd.com/classes/core-classes/paladin#TOC-Divine-Bond-Sp-||Divine</a> Bond@@ It gave me an http:// link and opened in a different page. What browser are you using vince?
1424362949

Edited 1424564821
The Aaron
Pro
API Scripter
HoneyBadger said: Update: Added TheAaron's doInlineFormatting replacement to correct url issues. If you have used the workaround ( an extra space in front ) to get urls to work, you will need to remove that space. Line 333: url = parts.shift().replace(/^ \s* (http(s)?:\/\/|\/\/()|())/, 'http$2://'), That will strip any spaces off the front of the URL and fix that issue where a url might be specified as @@ <a href="http://www.blah.com@@" rel="nofollow">www.blah.com@@</a> EDIT: Fixed regular expression
1424393339
vÍnce
Pro
Sheet Author
Thanks. On phone now. Will have another go at it tonight. Using chrome, latest version. Same url works fine on the main server...
1424394601
The Aaron
Pro
API Scripter
OOOOH. Missed that you were on dev. Will test there.
1424414205

Edited 1424414286
vÍnce
Pro
Sheet Author
Still can't get the URL to work right on the Dev... Even if I add http:// @@ <a href="http://www.d20pfsrd.com/classes/core-classes/paladin#TOC-Divine-Bond-Sp-||Divine" rel="nofollow">http://www.d20pfsrd.com/classes/core-classes/paladin#TOC-Divine-Bond-Sp-||Divine</a> Bond@@ It still gets changed to https:// My editor url uses a secure protocol <a href="https://app.roll20dev.net/editor/" rel="nofollow">https://app.roll20dev.net/editor/</a> , which I assume is normal.
1424415045

Edited 1424564743
The Aaron
Pro
API Scripter
Ok. HB still has my older code in the Dev version, which only outputs the //. Change line 336 to: url = parts.shift().replace(/^\s*(http(s)?:\/\/|\/\/()|())/, 'http$2://'), That will fix it. EDIT: Fixed regular expression
1424415937

Edited 1424415976
vÍnce
Pro
Sheet Author
Thanks Aaron. So, I made the change and as long as I include http:// or https:// in the url, the link works as expected, however if I only include www the new link that gets created is; <a href="https://app.roll20dev.net/editor/www.d20pfsrd.com/classes/core-classes/paladin#TOC-Divine-Bond-Sp-" rel="nofollow">https://app.roll20dev.net/editor/www.d20pfsrd.com/classes/core-classes/paladin#TOC-Divine-Bond-Sp-</a> So it appears that the editor's url is getting added into the url somehow...?
1424416460
The Aaron
Pro
API Scripter
Hmm... I'll have to take a look in the morning. Laying in bed now, wishing I'd gone to bed several hours ago! :)
1424416732
vÍnce
Pro
Sheet Author
NP. I need to watch an epi of Dexter... thanks Aaron
1424446500
The Aaron
Pro
API Scripter
ok, seems to work fine for me....
1424500216

Edited 1424550380
vÍnce
Pro
Sheet Author
Vince said: Thanks Aaron. So, I made the change and as long as I include http:// or https:// in the url, the link works as expected, however if I only include www the new link that gets created is; <a href="https://app.roll20dev.net/editor/www.d20pfsrd.com/classes/core-classes/paladin#TOC-Divine-Bond-Sp-" rel="nofollow">https://app.roll20dev.net/editor/www.d20pfsrd.com/classes/core-classes/paladin#TOC-Divine-Bond-Sp-</a> So it appears that the editor's url is getting added into the url somehow...? Not sure what's up with my setup. If I add a space before the url(which I thought was recently fixed) "@@ <a href="http://www" rel="nofollow">www</a>..." or use "@@ http:// <a href="http://www" rel="nofollow">www</a>... " or "@@ https:/ / <a href="http://www" rel="nofollow">www</a>... " the link works. However if I just use "@@ <a href="http://www" rel="nofollow">www</a>... " it still adds " https://ap p.roll20dev.net/ed itor/" to the beginning of my url. Any thoughts? UPDATE: I created a brand new "test" campaign on the Dev to try and isolate my problem. The only script installed is Powercard v2.4.4 with the necessary change on line 336 The Aaron said: Ok. HB still has my older code in the Dev version, which only outputs the //. Change line 336 to: url = parts.shift().replace(/^\s+(http(s)?:\/\/|\/\/()|())/, 'http$2://'), That will fix it. Same problem.
1424563244
The Aaron
Pro
API Scripter
Invite me?
1424563470
vÍnce
Pro
Sheet Author
Certainly. :-) PM sent. Thanks Aaron
1424564909
The Aaron
Pro
API Scripter
Ok. Figured it out with Vince's help. I had used \s+ instead of \s* for stripping whitespace from URLs. I've updated the regular expressions in the code above.
Can you whisper me the most current up to date code so that I can update it in the morning?
Hi Sorry, I cannot even get this working so I would like some help. I set up the script and the handout. I added an ability called Macro-Breath with the following: !power --emote|Langdedrosa opens his mouth and breathes a cone of lightning. --name|Breath Attack --leftsub|Action --rightsub|20ft. cone --Damge|[[4d10]] vs 13 Dex save --Note|Half damage on successful save This merely prints out the string in the macro if I press on the die roll (or the macro button if I indicate that it should be displayed as a token action etc.). If I paste the above into the chat window, it works fine. Could you please give me a brief explanation as to how I should be using it?
Just make sure there is no space before !power and it should work fine
OMW! Thank you very much
1424636923

Edited 1424637322
I am having troubles with macros stopping, then sometimes showing 2x or 3x when they do work. This is all macros. this has only happened since 2.3.6 (Production Servers) for me (but I think I skipped 2.3.5. When it happens, it affects all macros on all characters. Any idea what this might be? has anyone else seen it? It has also only happened since Friday 2/20
1424640680
The Aaron
Pro
API Scripter
There seems to be a bug with the API servers that double starts script instances. I don't think it's tied to any one script.
Yeah, I've had my Alter Bars script double as well.
1424657288
Gen Kitty
Forum Champion
Minor Request: Add to the script something that prints a message to the API console when the script is loaded, something like 'Powercards $VERSION ready for use!' I noticed when I was doing some work on my test campaign that sometimes the APIs are slow to load, I was seeing 10+ seconds between Spinning up & IsGM doing its console blurb. Having something in the powercards script announce when it is loaded would help me troubleshoot stuff going on in other campaigns.
What is the maximum number of targets the target_list can handle? It seems to cap out at 9 for me. Every target past 9 just shows the %%token_name%% charm instead of the tokens actual name every time I try to target more than 9.
Hello from me again. First of all I would like to thank @ HoneyBadger ,@ The Aaron & @ Vince for all the work they put in this script. Disclaimer: I use version 2.3.5 -- Production Server This is for a D&D 5e campaign, in which you can cast a spell as a higher level for a greater effect (more damage, more targets, etc.). I use a roll query like ?{SpellLevel|1} in the macro, and from that it's easy to create a macro for variable damage (ex. [[(?{SpellLevel|1}+3)d6]] for 4d6 + 1d6/lvl abofe 1st). Where this breaks down is when the spell cast at higher level affects more targets. If you can affect 1 target per level (starting at lvl 1) I can easily use the --targetlist tag along with --Target#?{SpellLevel|1}|%%token_name%% since the level of the spell equals the number of the targets affected. But some spells do not follow that simple formula. Let's take an example where a 2nd level spell affects 1 target and 1 more for each level above 2. I tried some things and here are the results (SPOILER ALERT: Nothing worked.) --Target#(?{SpellLevel|2}-1)|%%token_name%% passes to the script as Target#(2-1) --Target#[[?{SpellLevel|2}-1]]|%%token_name%% passes to the script as Target#$[[0]] The problem is that I cannot do maths with the roll query before I pass it to the script and if I use inline maths the result is a roll object. Can you guys think of a way to solve that? This is one of the last major problems I have with powercards. I know that one solution is to rewrite the whole parser that creates the powercard array. Anything that does not demand so much work? Thank you again, Chris
1424707748

Edited 1424708111
The Aaron
Pro
API Scripter
I actually wrote a powercard preprocessor for this purpose: You can use it like this: !pcpp --Target#[=[?{SpellLevel|2}-1]=]|%%token_name%% The basic idea is that you call !pcpp instead of !power , and it supports a few special inline roll syntaxes: [=[ ]=] -- Anything in these brackets is expanded like [[ ]], except the value is placed in the message before it is passed on to the powercard script. So assuming this 1d6 rolled a 4: !pcpp --test|[=[ 1d6 ]=] It would be to the powercard script as if you typed: !power --test|4 [#[ ]#] -- Anything in these brackets is expanded like [[ ]], except it happens on the API server at the point where the script is executed. This avoids the problem of calling things like !ammo in the same macro, but not having the value of the attribute updated when you pass it to !power. @#{ } -- This works just like a regular @{ } reference to attributes, except it gets expanded on the server at API processing time. Together, these two let you do this: !ammo @{Bob|character_id} arrows -1 !pcpp --name|Longbow Strike --Arrows|[#[ @#{Bob|arrows} ]#] left. And have it work correctly. Supports Powercards in the 1.0 branch and the 2.0 branch. GIST: <a href="https://gist.github.com/shdwjk/c8e141db579fd7e3f17" rel="nofollow">https://gist.github.com/shdwjk/c8e141db579fd7e3f17</a>...
You sir, deserve a pint of beer. I'll test it out when I get back home.
1424708219
The Aaron
Pro
API Scripter
=D Enjoy! PM me if you have any problems.
1424717780
vÍnce
Pro
Sheet Author
Will of GOD said: Hello from me again. First of all I would like to thank @ HoneyBadger ,@ The Aaron & @ Vince for all the work they put in this script. Thank you Will of God. For the record, I actually haven't done anything with HB's powercards other than try to break them. I try to help others where I can, often just passing on the help that someone gave me. I'm really just an API "Crash test dummy" if you will... Cheers
@ The Aaron Make that pint a double. It works like a charm. Is there anything you haven't a script ready for? =D @ Vince Testing (breaking) is part of the development cycle mate. You help with your own way. Time to go back and play more with the preprocessor. See you all around the table. Chris
1424724610
The Aaron
Pro
API Scripter
Oh yeah, there's a TON of things I have planned out but not written... (Sorry Michael, we'll get there!!!) I enjoy solving problems with the API. I write software professionally, so working in the API is a nice blend of what I enjoy doing. Plus I get to help people, which is almost as good as writing software. =D And seconded about Vince and breaking things. You don't write good software without good testers except by accident.
1424724829

Edited 1424727249
Going to lunch/dinner with my fiancee and then I'll spend some time updating the scripts with the following: Aaron's updated format parser GenKitty's request More than nine tarts targets... Oops. Meant to post this before I left... looking at stuff now.
1424726228
The Aaron
Pro
API Scripter
I don't think I could eat more than 9 tarts... =D