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 3 (Thread 3)

There's a Dev PowerCards version? I must've missed that.
Sadly, turning off 3D Dice doesn't provide a temporary "fix" for the issue either.
1437506011

Edited 1437506776
Anything like this: !power {{ --emote|RITH --name|Melee Basic Attack --leftsub|At-Will --rightsub|Standard --Range:|Melee --Target:|One Creature (@{target|token_name}) --Attack:|[[ [$Atk] 1d20 + 6]] vs AC --?? $Atk.base <> 20 ?? Damage:|[[1d4+2]] damage. --?? $Atk.base == 20 ?? Critical Hit:|[[2d6+4+2]] damage. --Hunter's Quarry:|[[2d8]] }} Causes the error to ensue. Updated to fix that I was mistakened, any roll seems to cause it. And this is with 3D dice disabled.
1437506540
The Aaron
Pro
API Scripter
I'm not sure, but I believe HB does not currently have a Dev version.
1437506648

Edited 1437506741
DK Heinrich
Marketplace Creator
Sheet Author
yeah, all mine have more than one roll due to the system... explains why none of my !power ones work  @The Aaron - if that is the case then does this need to be popped back up to the big thread of problems? 
Problems with PowerCards working/not working are limited to those which use Conditionals.
I just removed the conditionals in one of my macros, and it rolled appropriately. So, the issue (except 3D dice rolling) is limited to conditionals.
1437507129

Edited 1437507204
I got it working, it's the conditionsal that are bugging out it appears. Without conditionals the power cards work. Edit: A few miniutes late on the discovery but confirmation atleast.
1437507512
The Aaron
Pro
API Scripter
This is a compatibility issues with the script and the API server.  It isn't a bug with the deploy, just a feature of the new update that breaks the script. This doesn't need to be propagated to the megathread.  Good to know it's the conditionals, that will make tracking down the bug easier.  I know HB is super busy during the week, I'll try to track down the issue tonight and get a patch out for him.
To make it a little easier for you Aaron (and I know it will only be a little easier), the problem almost seems to be centered around the additional tags for a roll. For example: !power {{ @{format} --charid|@{character_id} --emote|@{character_name} kicks a rock in the general direction of the bad people coming at him...  --name|Initiative --Initiative Roll:|~R[[ [trkr] 2d20d1 + [[@{initiative_overall}]] ]]~R --Note| --!^1text1|//Due to his // **$$#da0000|Sentinel Shield$$**//, @{selected|token_name} has advantage on initiative rolls. The lowest is automatically dropped.// }} This also causes an error, and there are no conditionals in here -- just the [trkr] which was altered from the original &{tracker} because of the issues of rolls from PowerCards not showing up on the tracker. So it may not be the so much the conditionals, as much as the location for where those tags need to be located. If I place the [trkr] at the end of the script, it still adds the PowerCard roll to the tracker (with the appropriate number rolled), but doesn't set off an error.
In fact.... if you completely move the [$Atk1] type labels to AFTER the initial roll, the problem goes away and the PowerCards work. I haven't had a chance to verify the extent of it, but I do know the following does work: !power {{  @{format}  --charid|@{character_id}  --emote|~L @{character_name} puts aside his healing and spell casting for a moment to bathe in the blood of his enemies.  --name|@{selected|meleeweaponname1} Attack  --leftsub|Attack Action  --rightsub|Melee  --Main Hand Attack:|@{selected|token_name} slices through the air with his //@{selected|meleeweaponname1}//.  --Target:|$$#ff0000|**@{target|Target|token_name}**$$  --^1Attack:|~R[[ 1d20+ [[ @{selected|meleetohit1}]] [$Atk1] +([NH] @{Buffs|gadellisbless}d4)]] | [[ 1d20+ [[@{selected|meleetohit1}]]  [$Atk2] +([NH] @{Buffs|gadellisbless}d4)]]~R   --?? $Atk1.base == 1 ?? !Miss:|Like a dumbass, you missed horribly: ^^^^ $$#ff0000|**[[ 1t[Critical-Miss] [txt] ]]**$$ --?? $Atk1.total >= @{target|Target|bar3} OR $Atk2.total >= @{target|Target|bar3} ?? ^1Hit:|~R [[ @{meleedmg1}+[[@{meleedmgbonus1}]] ]] ~R --?? $Atk1.total >= @{target|Target|bar3} OR $Atk2.total >= @{target|Target|bar3} ?? ^1Damage Type:|@{meleedmgtype1} --?? $Atk1.base == 20 OR $Atk2.base == 20 ?? ^2Crit:|~R [[ @{meleedmg1} ]] ~R  }} By extent, I mean my critical fumble or hit aspect. I do know if there isn't a hit, no damage is rolled, but if there is a hit, one is rolled.
Yeah, if you add .base after the conditional check, e.g.: Atk1.base, it doesn't seem to function properly in that regard. For example, if I set crit fumble to Atk1.base <= 10, any roll triggers it, whereas doing the opposite, e.g.: Atk1.base >= 11, nothing triggers it. Using .total seems to work as expected.
1437510052

Edited 1437510332
Just a thought on the conditionals, that's probably not what's breaking powercards, at least on my end. Even the macros without conditionals don't work. Tested this with every type of macro in my game and restarted several times just to be sure. The simplest tags I use have use only have the name and attack tags, as well as bold (**) and centering (~C), no rolls of any kind or conditionals. Even the ones that don't have you pick out a target aren't working. Edit: Quick thing I should probably clear up. When I said the macros aren't working, I mean that they aren't triggering at all. I just went to check the scripts in the game and they've been disabled (automatically I think?). I'm going to turn them back on and then see what happens.
I will try to work on this as soon as possible, but I work tonight and am picking up two new pets to add to the zoo here at home in the morning.
1437510485

Edited 1437510575
No worries HB -- the problem seems to be corrected when moving the conditional roll tag to after the initial roll, except as far as .base is concerned. Using .total still (appears to) works as intended.
SeanOG said: No worries HB -- the problem seems to be corrected when moving the conditional roll tag to after the initial roll, except as far as .base is concerned. Using .total still works as intended. That actually helps a lot to narrow it down. It's most likely a change in how the inline roll is structured and the function that takes all the rolls in msg.inlinerolls and searches for labels to create the roll id's from.
1437511037
DK Heinrich
Marketplace Creator
Sheet Author
So I have the following lines with [$DEF], [$Crit] and [$BB] being created - [$DEF] is to make it easier to use later in the script, the other two both have math. How would you suggest moving the [$xxx] around to be after the first roll? would you drop it between the 1st part and the +0d0? --hroll|Target Defense: [[ [$DEF] [[@{target|DEF}]] + 0d0 ]] ^^ Target Critical: [[ [$Crit] [[ 5 + @{target|DEF}]] +0d0 ]] ^^ Boons/Banes: [[ [$BB] ?{Boons|0} - ?{Banes|0} + 0d0]]
Okay so it was just turning the scripts off when those errors popped up and made me think there was a bigger issue. Classic. Anyway, rebuilding all the macros I use even once is going to be tedious, so I think I'll just wait this one out, that way if I do have to change anything, I only have to do it once. Thanks for pointing out the conditionals, Sean. If you hadn't, I probably wouldn't have noticed the scripts getting disabled.
I am not sure if I should change my macros for this or not. I mean, if I fix them all to work now, would I have to change them all again when the script is adapted to the new stuff? Luckily for me, the next game isn't until Saturday night... so I have wiggle room time-wise.
Nyghtmare said: I am not sure if I should change my macros for this or not. I mean, if I fix them all to work now, would I have to change them all again when the script is adapted to the new stuff? Luckily for me, the next game isn't until Saturday night... so I have wiggle room time-wise. I'm leaving for work right now, but I will have an hour or two in the morning when I can try to fix it. Can't promise anything, but I guarantee that I will have a fix out by Thursday evening/Friday morning.
HoneyBadger said: I'm leaving for work right now, but I will have an hour or two in the morning when I can try to fix it. Can't promise anything, but I guarantee that I will have a fix out by Thursday evening/Friday morning. Which would work out just fine for me. Sounds like I wouldn't have to make any changes on my end on any of my existing macros, which would save a lot of time and effort on my part. Thanks for the update on this, HoneyBadger... as always, you rock (don't tell TheAaron I said that — he tends to get jealous lol),
1437513084

Edited 1437538262
The Aaron
Pro
API Scripter
There are two breaking API changes that I'm aware of (C/P'd from PMs, pardon the formatting): 1) sendChat('','[[1d2]]',function(ops){ /* ... */ }); ops.inlinerolls was an object in prod, with numeric properties starting at 1: "inlinerolls": { "1": { It is now an array: "inlinerolls": [ { with numeric indices starting at 0. 2) The order of sendChat's inlinerolls is not guaranteed: "$[[0]]$[[1]]$[[4]]$[[2]]$[[6]]$[[3]]$[[5]]",
1437513460

Edited 1437513639
DK Heinrich said: So I have the following lines with [$DEF], [$Crit] and [$BB] being created - [$DEF] is to make it easier to use later in the script, the other two both have math. How would you suggest moving the [$xxx] around to be after the first roll? would you drop it between the 1st part and the +0d0? --hroll|Target Defense: [[ [$DEF] [[@{target|DEF}]] + 0d0 ]] ^^ Target Critical: [[ [$Crit] [[ 5 + @{target|DEF}]] +0d0 ]] ^^ Boons/Banes: [[ [$BB] ?{Boons|0} - ?{Banes|0} + 0d0]] Here is what I would try (it worked for my macros): --hroll|Target Defense: [[ [[@{target|DEF}]] [$DEF] + 0d0 ]] ^^ Target Critical: [[ [[ 5 + @{target|DEF}]] [$Crit] +0d0 ]] ^^ Boons/Banes: [[ ?{Boons|0} - ?{Banes|0} [$BB] + 0d0]] For some reason, it is having an issue with each tag (regardless of whether it is conditional related or not) being at the beginning of the roll. Simply moving them until after the "roll" seems to cure the problem, and allows them to be used later on for actual conditionals. The same holds true for an initiative roll. Change this: --Initiative Roll:|~R[[ [trkr] 2d20d1 + [[@{initiative_overall}]] ]]~R to this: --Initiative Roll:|~R[[ 2d20d1 + [[@{initiative_overall}]] [trkr] ]]~R Granted, mine has an advantage on the roll, which is why there is the 2d20d1 at the beginning instead of a single 1d20, but the change does work and allows the roll in the PowerCard to be added into the tracker.
Just loaded this script up and am having an issue getting the defenses to show for a multiple target attack power. Specifically, the Scorching Burst example listed in HB's post. The defense attribute is called "ref" instead of "Reflex" and I tried using that, but it just spits out a list of what attributes are supposed to be added together, not the numbers and not adding anything together. These are the two different outputs I get, the first using "ref" and the second using "Reflex" (ignore the quicksilver motion block). The errors that appear in the API output console for the second one are beneath the image. "Error: No attribute or sheet field found for character_id -Jk9u2J9_ONGc30joq2- named Reflex" "Error: No attribute or sheet field found for character_id -JkTvdxthkejBUeOVSK3 named Reflex" "Error: No attribute or sheet field found for character_id -JkTvhFh4uzA4ciD-Sth named Reflex"
1437535030

Edited 1437538296
The Aaron
Pro
API Scripter
Ok, I've got the fix for Powercards.  Replace your line 63 with this one:: /* 59 */    // REPLACE INLINE ROLLS WITH EXPRESSIONS /* 60 */    if (msg.inlinerolls !== undefined) { /* 61 */        var Count = 0; /* 62 */        while (Count < msg.inlinerolls.length) { /* 63 */            msg.content = msg.content.replace("$[[" + Count + "]]", "[[  " + msg.inlinerolls[Count].expression + " ]]"); /* 64 */            Count++; /* 65 */        } /* 66 */    } The change is the space after the second [[, so "[[" becomes "[[ " See further down...
1437536023
Silvyre
Forum Champion
Aaron, you're a hero.
1437536183

Edited 1437536255
That's it? Weird... how did you find that?
1437537055
The Aaron
Pro
API Scripter
Elementary, my dear HoneyBadger!  =D I boiled down the examples to the smallest command that caused the issue for me: !power --a|[[ [A] 1d1 ]] then I dumped out what was being sent to sendChat(): {    "titlefont": "Georgia",    "titlefontvariant": "normal",    "subtitlefont": "Tahoma",    "subtitlefontvariant": "normal",    "bodyfont": "Helvetica",    "titlefontsize": "18px",    "subtitlefontsize": "11px",    "bodyfontsize": "14px",    "txcolor": "#FFFFFF",    "bgcolor": "#9900ff",    "erowtx": "#000000",    "erowbg": "#B6AB91",    "orowtx": "#000000",    "orowbg": "#CEC7B6",    "corners": 3,    "border": "1px solid #000000",    "boxshadow": "",    "a": "[[[A] 1d1 ]]" } I noticed how the expression had changed, so I tried the expression in the regular chat: SyntaxError: Expected "(", ".", "[", "abs(", "ceil(", "d", "floor(", "round(", "t", "{", [ |\t], [+|\-] or [0-9] but "A" found. and got the same error, then looked through the code for where you were building expressions with [[, and observed the lack of a space. I also recalled problems with this initially when nested inline rolls were rolled out, which made the correlation easier. =D
1437537290
The Aaron
Pro
API Scripter
Though actually, it appears there are some other issues about....  I'll keep looking for more.
1437538029

Edited 1437571284
The Aaron
Pro
API Scripter
Ok, as it turns out, it's slightly more complicated.  The fix above introduces a different failure: !power --a|[[1d1]] There appears to be a bug in the API's sendChat() such that having a space before a number after the opening [[ causes a crash.  Here's a new line 63 that fixes this as well: /* 59 */    // REPLACE INLINE ROLLS WITH EXPRESSIONS /* 60 */    if (msg.inlinerolls !== undefined) { /* 61 */        var Count = 0; /* 62 */        while (Count < msg.inlinerolls.length) { /* 63 */            msg.content = msg.content.replace("$[[" + Count + "]]", ("[[ " + msg.inlinerolls[Count].expression + " ]]").replace(/\[\[ (\d)/g,"[[$1")); /* 64 */            Count++; /* 65 */        } /* 66 */    } See still further down...
Riley D. said: You need to use the Dev Powercards version starting today on Main. See here:&nbsp; <a href="https://app.roll20.net/forum/permalink/2212062/" rel="nofollow">https://app.roll20.net/forum/permalink/2212062/</a> So where do we find the Dev Powercards version? &nbsp;The link above does not tell me anything about how to set up Powercards...
1437539416
The Aaron
Pro
API Scripter
There isn't a dev powercards version currently. &nbsp;You can take the current version of powercards and replace line 63 with the line labeled 63 in the post above yours and it should work for you.
I replaced line 63 per the latest update from Aaron. When I run the macro below it produces this error message after prompting me to click and drag to roll the dice: /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ SyntaxError: Expected "[" or [ |\t] but "(" found. The macro is: !power {{ --format|encounter --tokenid|@{selected|token_id} --emote|[[1t[AttackSmack]]] --name|Attack --leftsub|@{selected|token_name} --title|[[ [$Weapon] ?{Weapon: Longsword(1) Claw(2)|1} +0d0 ]] --?? $Weapon == 1 ?? !Attack:| @{selected|token_name} attacks @{target|token_name} with a longsword!^^If its attack roll of [[1d20+4]] is successful against AC [[@{target|armorclass}]], It deals [[ [NH] 1d6+4]] damage. --?? $Weapon == 2 ?? !Attack:| @{selected|token_name} attacks @{target|token_name} with a claw!^^If its attack roll of [[1d20+3]] is successful against AC [[@{target|armorclass}]], it deals [[ [NH] 1d4+3]] damage. }}
1437565543
The Aaron
Pro
API Scripter
What's the value of @{target|armorclass}? &nbsp;Can you reduce this to a minimal failing case? &nbsp;Try: !power --a|[[@{target|armorclass}]] and see if you get the same error.&nbsp;
1437567952
DK Heinrich
Marketplace Creator
Sheet Author
Tested with about 10 marcos of varying complexities - all working fine. I will be working on them more today and if any bomb out on me I will let you know. One very odd point to make - I was having a problem with the numbers in the yellow call out box being shifted towards the top of the box - a problem that no one else could reproduce... with either the update to the API server, or the change to line 63, or some other .js magic the numbers are back to their correct position and I can now go back and undo the tweaks to box size I had made.
1437571243
The Aaron
Pro
API Scripter
Ok, here's a new line 63: /* 59 */ &nbsp; &nbsp;// REPLACE INLINE ROLLS WITH EXPRESSIONS /* 60 */ &nbsp; &nbsp;if (msg.inlinerolls !== undefined) { /* 61 */ &nbsp; &nbsp; &nbsp; &nbsp;var Count = 0; /* 62 */ &nbsp; &nbsp; &nbsp; &nbsp;while (Count &lt; msg.inlinerolls.length) { /* 63 */ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;msg.content = msg.content.replace("$[[" + Count + "]]", ("[[ " + msg.inlinerolls[Count].expression + " ]]").replace(/\[\[ (\d |\( )/g,"[[$1")); /* 64 */ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Count++; /* 65 */ &nbsp; &nbsp; &nbsp; &nbsp;} /* 66 */ &nbsp; &nbsp;} It turns out not to like a space in front of ( as well.
1437572695
DK Heinrich
Marketplace Creator
Sheet Author
got this error when I saved line #63 both times (1st time i figured it was me) - i jump out, back in, and save again and its all good. events.js:72 throw er; // Unhandled 'error' event ^ Error: listen EADDRINUSE at errnoException (net.js:904:11) at Server._listen2 (net.js:1023:19) at listen (net.js:1064:10) at Server.listen (net.js:1132:5) at Sandbox.start (/home/symbly/www/d20-api-server/sandcastle/lib/sandbox.js:35:15) at Object.&lt;anonymous&gt; (/home/symbly/www/d20-api-server/sandcastle/bin/sandcastle.js:11:9) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12)
1437574276
The Aaron
Pro
API Scripter
hmmm. &nbsp;If you just typed it in, be sure the editor didn't add an extra ) to it. &nbsp; Other than that, I guess copy paste that section of your script and we can see if there is something else?
1437574967
DK Heinrich
Marketplace Creator
Sheet Author
crappy picture - but I cut yours and pasted over top of the original msg.content = msg.content.replace("$[[" + Count + "]]", ("[[ " + msg.inlinerolls[Count].expression + " ]]").replace(/\[\[ (\d|\()/g,"[[$1"));
I tried Aaron's latest line 63 (two post's up) and all is working well with that macro. On another note I was noodling around with the new drop down prompts for roll queries and retrofitting them into a PowerCard macro. The drop down list pops up and allows a selection, then the macro stops responding. I suspect that the PowerCard $variables aren't designed to work with non-numeric values, perhaps. Anyone else tried this out? (The macro is below for reference.) !power {{ --format|encounter --name|Attack --leftsub|@{selected|token_name} --title|[[ [$Weapon] ?{Weapon|Longsword,longsword|Claw, claw} ]] --?? $Weapon == ‘longsword’ ?? !Attack:| @{selected|token_name} attacks @{target|token_name} with its $Weapon!^^If its attack roll of [[1d20+4]] is successful against AC [[@{target|armorclass}]], it deals [[ [NH] 1d8+4]] damage. --?? $Weapon == ‘claw’ ?? !Attack:| @{selected|token_name} attacks @{target|token_name} with its $Weapon!^^If its attack roll of [[1d20+3]] is successful against AC [[@{target|armorclass}]], it deals [[ [NH] 1d4+3]] damage. }}
1437578144

Edited 1437629397
The Aaron
Pro
API Scripter
DK Heinrich, there might be some unicode characters sneaking in from the browser. &nbsp;Here's a gist with just this line changed. &nbsp;See if that works for you: &nbsp; gist.github.com/shdwjk/f1e153a6a16803f7a886 &nbsp; Get the updated version that has this patch in it now!
1437578485

Edited 1437578656
Gen Kitty
Forum Champion
Darek, the first thing that draws my attention is the non-standard apostrophes around longsword and claw.&nbsp; x.x The second thing I'm wondering is what would happen if you were testing $Weapon.base instead of $Weapon. Edited to add: Also, might want to pull the space from "Claw, claw" since you don't have a space for the longsword section.
1437579375
DK Heinrich
Marketplace Creator
Sheet Author
the drop down menus work but you have to give them value for conditionals to read them (or that is what worked for me) name|opt1, 1|opt2, 2|opt3, 3|&nbsp; then you can refer back to $blah == 1 then.... or &nbsp;$blah &lt;&gt; 2 then...
1437579901
DK Heinrich
Marketplace Creator
Sheet Author
The Aaron said: DK Heinrich, there might be some unicode characters sneaking in from the browser. &nbsp;Here's a gist with just this line changed. &nbsp;See if that works for you: &nbsp;gist.github.com/shdwjk/f1e153a6a16803f7a886 that got it - i figured it was an invisible something sneaking in (has happened to me before) but did not want to use HBs gist and the c/p your line into it just to have it do same thing.&nbsp; Thanks for popping that up there :)&nbsp;
1437580248

Edited 1437580291
DK Heinrich
Marketplace Creator
Sheet Author
with drop down menu - has anyone been able to make it default to a particular answer? so you can just 'enter' past it without having to make the choice if the choice is the 'normal' answer?&nbsp; ?Attack Type: Attack, 1|Attack-Adv, 2|Attack-Dis, 3|1 &nbsp; --- the last '1' would tell it to default to that answer, but it is not working for me. Hitting enter just makes it open the list up, enter again closes the list, so you have to actually click on the button to close the box.&nbsp; I know its silly but moving and clicking with mouse is much slower than entering though a question or two if they are the 'normal'' answers. EDIT: this should move to a drop down menu thread in theory I guess.
1437580885
Gen Kitty
Forum Champion
Whee, new crashy bug! /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ SyntaxError: Expected "[" or [ |\t] but "d" found. !power {{ --name|Silva --bgcolor|#E6BE8A&nbsp; --txcolor|#000000 --titlefont|Helvetica --subtitlefont|Helvetica --titlefontsize|18px --subtitlefontsize|12px --bodyfontsize|10px --leftsub|Fortitude Save --rightsub|[[d20+ @{Fortitude} + ?{MiscMods?|0} ]] --!L1|**@@<a href="http://www.d20pfsrd.com/classes/core-classes/paladin#TOC-Divine-Health-Ex-||$$#000|__Divine" rel="nofollow">www.d20pfsrd.com/classes/core-classes/paladin#TOC-Divine-Health-Ex-||$$#000|__Divine</a> Health__$$@@:** Silva is //immune// to **all** diseases. }}
GK - Try it with a 1 in front of the d20.
1437583083

Edited 1437583529
Loaded TheAaron's hack and fixed problems i was having with conditionals. Now i'm having trouble with the kh1 functions. Error Message: /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v Example: (attribute calls removed for example) [[{1 - [[2 + 2]], 0}kh1]] This works just fine in the chat window but putting it in a powercard will crash the API.
1437583240
DK Heinrich
Marketplace Creator
Sheet Author
I am using kh1 with no trouble in powercards - try loading the full gist that The Aaron posted above instead of inserting the single line change.