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)

DK Heinrich said: 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. I had already loaded the full gist before posting.
1437583766
Gen Kitty
Forum Champion
SeanOG said: GK - Try it with a 1 in front of the d20. *smooch*  Thank you :>
You know it's funny... when I use the Gist Aaron posted, or even the one from HB for the newest version, I keep getting: Unexpected token ) So, I disable an bounce back to my previously running edition, 3.2.1 and all is fine... Going to have to hunt through and figure out where the Unexpected token ) is coming from. More shocking is that no one else has been having this problem. I guess I'll sort out where it's having the issue.
1437584907
DK Heinrich
Marketplace Creator
Sheet Author
--?? $BB >= 0 ?? Agility| [[ [nh|$RollRes1] 1d20 + @{selected|AGI} + (?{ Boons} -?{Banes})d6 kh1 ]] vs **Defense** [[ @{target|DEF} ]] is an example line in one of mine that is functioning correctly and with no crash of API. past checking for spare spaces and or extra {[( things, I think I am out of help :( 
Ah, I can see the difference now, you're not using a number to pivot around. I'm pretty sure my issue is the curly brackets inside the inline that i need for it to drop the numbers below 0. This: " /roll {1 - [[2 + 2]], 0}kh1 " works just fine and pasting And pasting: "[[{1 - [[2 + 2]], 0}kh1]]" into the chat is fine but putting the curly brackets and inlines into a powercard breaks the API
Yes, it seems DK is correct. Going back to numeric values is necessary: --title|[[ [$Weapon] ?{Weapon|Longsword,1|Claw,2} +0d0 ]] I was hoping to be able to use $variables both to determine branching and in the flavor text, but at least the selection presentation is cleaner IMO. Also, I think given the new drop down syntax uses the | character to delimit choices, that a default (that is not the first in the list) is not likely to work.
1437586240
Gen Kitty
Forum Champion
DK Heinrich said: --?? $BB >= 0 ?? Agility| [[ [nh|$RollRes1] 1d20 + @{selected|AGI} + (?{ Boons} -?{Banes})d6 kh1 ]] vs **Defense** [[ @{target|DEF} ]] Try it with $BB.base or $BB.total.
Try putting a space between [[ and { and see if that works. I've just returned home with two new pets (a pair of rabbits) after being up at work all night. Going to bed and then have board game night at a friends. When I get home, I'm gonna dig into this and see what I can do with what Aaron has done.
1437586302
Gen Kitty
Forum Champion
SeanOG said: You know it's funny... when I use the Gist Aaron posted, or even the one from HB for the newest version, I keep getting: Unexpected token ) yeah, I had that issue for a bit.  Copied Aaron's gist and it suddenly works again.  x.x
DK Heinrich said: 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?  ?Attack Type: Attack, 1|Attack-Adv, 2|Attack-Dis, 3|1   --- 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.  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. A better way to use drop down queries for 5e advantage/disadvantage would be: [[ ?{Attack Type|Standard, 1d20|Advantage, 2d20kh1|Disadvantage, 2d20kl1} + 0 [Mods] ]]
1437587221

Edited 1437588086
HoneyBadger said: Try putting a space between [[ and { and see if that works. I've just returned home with two new pets (a pair of rabbits) after being up at work all night. Going to bed and then have board game night at a friends. When I get home, I'm gonna dig into this and see what I can do with what Aaron has done. A space didn't do it, but putting a "("  in did work. Example: [[({1, 0})kh1]] EDIT: Silvrye actually pointed out that this [[ ({1, 0}kh1) ]] is a better option DOUBLE EDIT: Nesting the function will also make it work. Example: [[ [[ {1, 0}kh1 ]] ]]
GenKitty said: SeanOG said: You know it's funny... when I use the Gist Aaron posted, or even the one from HB for the newest version, I keep getting: Unexpected token ) yeah, I had that issue for a bit.  Copied Aaron's gist and it suddenly works again.  x.x That's what's bizarre. I copied his gist directly, and received the error. I hadn't even had a chance to make my alterations. :P
1437588124
Gen Kitty
Forum Champion
Hey, I copied it directly both times, but it only worked once.  I swear there's a voodoo element involved!
1437589196

Edited 1437589274
There could very well be. The issue comes from another script, as it were, to where when it is enabled with the new PowerCards, there is that issue, whereas if it is an older version (the one I have been using for some time now), the issue isn't present. So, I'll go through and figure out where the problem is on that one. Edit: I added a ; at line 1 of that other script, and the problem went away...
1437589455
The Aaron
Pro
API Scripter
Dylan S. said: HoneyBadger said: Try putting a space between [[ and { and see if that works. I've just returned home with two new pets (a pair of rabbits) after being up at work all night. Going to bed and then have board game night at a friends. When I get home, I'm gonna dig into this and see what I can do with what Aaron has done. A space didn't do it, but putting a "("  in did work. Example: [[({1, 0})kh1]] EDIT: Silvrye actually pointed out that this [[ ({1, 0}kh1) ]] is a better option DOUBLE EDIT: Nesting the function will also make it work. Example: [[ [[ {1, 0}kh1 ]] ]] try something like: !power --a|[[ [test] {1,0}kh1 ]] Probably the API doesn't like that it ends up getting: [[{1,0}kh1 ]] on line 63, you can add: |\{ like this: msg.content = msg.content.replace("$[[" + Count + "]]", ("[[ " + msg.inlinerolls[Count].expression + " ]]").replace(/\[\[ (\d |\{ |\()/g,"[[$1"));
1437589792
The Aaron
Pro
API Scripter
I'm going to assemble a full bug report tonight about the API sendChat() dice inconsistencies with as many examples as I can find.  Keep them coming. =D
1437590399
Silvyre
Forum Champion
The Aaron said: Probably the API doesn't like that it ends up getting: [[{1,0}kh1 ]] on line 63, you can add: |\{ like this: msg.content = msg.content.replace("$[[" + Count + "]]", ("[[ " + msg.inlinerolls[Count].expression + " ]]").replace(/\[\[ (\d |\{ |\()/g,"[[$1")); Yes, that fixed our issues! Thank you so much!
1437590568
The Aaron
Pro
API Scripter
Great!
Silvyre said: The Aaron said: Probably the API doesn't like that it ends up getting: [[{1,0}kh1 ]] on line 63, you can add: |\{ like this: msg.content = msg.content.replace("$[[" + Count + "]]", ("[[ " + msg.inlinerolls[Count].expression + " ]]").replace(/\[\[ (\d |\{ |\()/g,"[[$1")); Yes, that fixed our issues! Thank you so much! +1 Thank you
I haven't even tried to hack together something to throw out the 3D dice with this new set up now... just been working on getting conditionals and such to work. Thus far, the only thing which seems sketchy, as it were, is the .base check on conditionals. Yesterday, I couldn't get the crits to work properly, whereas today, they are working fine now, but the .base check for a fumble (e.g.: Atk1.base == 1) is not working. Ice pick. Eye. Go.
1437594868
The Aaron
Pro
API Scripter
SeanOG said: I haven't even tried to hack together something to throw out the 3D dice with this new set up now... just been working on getting conditionals and such to work. Thus far, the only thing which seems sketchy, as it were, is the .base check on conditionals. Yesterday, I couldn't get the crits to work properly, whereas today, they are working fine now, but the .base check for a fumble (e.g.: Atk1.base == 1) is not working. Ice pick. Eye. Go. Got a minimal repeatable case?  I'll take a look tonight.
1437597501

Edited 1437597571
Sure.... !power {{ --^1Attack:|~R [[ [$Atk1] 1d20 ]] ~R --?? $Atk1.base <= 9 ?? !Miss:|Like a dumbass, you missed horribly. --?? $Atk1.base >= 10 ?? ^2Crit:|~R [[ 1d10 ]] ~R }} For some reason, and it may just be me, the .base will work for the Crit side, but not for the Miss side. It may be having a shit fit with the less than sign again, like it use to whenever there were issues in tooltips, I don't know. Edit: Actually, I don't think it has to do with the less than sign because I can set it for == 1, and it still won't send the fumble.
1437604312
The Aaron
Pro
API Scripter
I think this is more along the lines of a minimal repeatable case? !power {{ --a|[[ [$A] 1d2 ]] --?? $A.base <= 1 ?? V|L --?? $A.base > 1 ?? V|G }} See if that works for you.  It works fine for me, as does your example.  Possibly I'm missing something?
1437605642

Edited 1437605677
Well, you asked minimal repeatable case, I assumed you meant of what I was working with. ;) I think I know what the problem may have been... an extra space between $Atk1.base and <=. I removed that extra space, and it seems to be working now... I hope.
1437613117
The Aaron
Pro
API Scripter
Well, cool. =D   I thought your bug was with .base, which is why my test case as the minimum you'd need to test .base in the script.  Either way, glad it's working for you!
Well, it was with .base, but it was because of that ruddy extra space, or so it seems.
1437613677

Edited 1437629329
The Aaron
Pro
API Scripter
I just updated my patched version of powercards to fix the crash with expressions like: !power --a|[[d20]] Also, I added a bug report for these sendChat() regressions: &nbsp; <a href="https://app.roll20.net/forum/post/2217884/api-regressions-for-inline-dice-expression-in-the-sendchat-api-function/#post-2217884" rel="nofollow">https://app.roll20.net/forum/post/2217884/api-regressions-for-inline-dice-expression-in-the-sendchat-api-function/#post-2217884</a> Complete with a test script and nice output!
Seriously Aaron -- between you and HB on this... you two put the awesome and amazing in awesomazing...
1437626766
The Aaron
Pro
API Scripter
=D &nbsp;Thanks!
This one is all Aaron. I don't know how I would have fixed this myself. Testing my powercards and will be posting the updated script soon.
July 23rd, 2015 ~ 12:45 am eastern Version: 3.2.8 (The Aaron Line 63 Update) Link: &nbsp;gist.github.com/Sky-Captain-13/452330a3d926b32da49c Major Bugfix: This update fixes a number of crashes due to sendChat interaction with the API.
1437638061
Ziechael
Forum Champion
Sheet Author
API Scripter
^^ fixed all my problems, thanks HB... just in time for my game tonight =D
Ziechael said: ^^ fixed all my problems, thanks HB... just in time for my game tonight =D All thanks should go to Aaron for this one.
1437654161
DK Heinrich
Marketplace Creator
Sheet Author
SeanOG said: Seriously Aaron -- between you and HB on this... you two put the awesome and amazing in awesomazing... +1
1437673052
Gen Kitty
Forum Champion
[PSA] 3d Dice & API continue to not get along; of course the API can't roll 3d dice! :) To replicate this bug Use any Powercard macro that rolls dice Enable 3D Dice Do NOT enable 'Automatically Roll 3D Dice' Use the Powercard. You'll be asked to roll the 3d dice. The macro will work just fine, the user may become confused and testy because no dice rolled on the table. If you have 'Automatically Roll 3D Dice' turned on, you still get no dice but the user hasn't been prompted to do something. Suggested Workaround: Tell your users to either not turn on 3d dice or automatically roll 3d dice, if your campaign uses Powercards or any similar dice-rolling API.
GK, I haven't actually changed the sendChat command in PowerCards to handle 3D dice yet.
1437673514
Gen Kitty
Forum Champion
Well, that'd explain it.&nbsp; Still, until the change it's going to catch people by surprise. :) Query: I noticed var ALLOW_URLS is now false by default.&nbsp; Deliberate change?
Well to me functionality is the priority over the 3D dice, though I know one of my players has been begging for this. Since the Power Cards work again now, it's been delievered indeed. The new Drop down query option has been useful in making some new options for the power cards avalible also, one example is Psionic augments in 4E, the option allows it so you can't enter a value that wasn't intended.&nbsp;
GenKitty said: Well, that'd explain it.&nbsp; Still, until the change it's going to catch people by surprise. :) Query: I noticed var ALLOW_URLS is now false by default.&nbsp; Deliberate change? Dunno. I was tired when I made those changes... lol.
Odd behavior: I updated PowerCards from 2.x to 3.2.8. For one character, it no longer pulls the avatar for character_ID: !power --charid|@{character_id} --emote|Deckard takes careful aim with his crossbow and squeezes the trigger! --format|ranged --name|Light Crossbow --leftsub|Ranged --rightsub|Standard Action --Attack|[[1d20 + 5]] vs AC --Inflicts|[[1d8]] piercing damage It also puts in&nbsp;FMyFJ under the name. On another character the first word after --emote is always missing! &nbsp;(???) !power --emote|Deckard takes careful aim with his crossbow and squeezes the trigger! --format|ranged --name|Light Crossbow --leftsub|Ranged --rightsub|Standard Action --Attack|[[1d20 + 5]] vs AC --Inflicts|[[1d8]] piercing damage Any help would be greatly appreciated. Marko
I am seeing this thing since the update this week where the @{selected|token_name} that I have in the EMOTE section of the macros I have for Power Cards produces a blank in the output, but it works like normal in the rest of the macros (in other "--" fields). Is there something that needs to be changed, on my end or in the script?
Most likely the character id has some characters in it that breaks the string. You could try making a copy of the character to force it to generate a new character id.
I do not use "character id" in any my macros, though. Here is an example of a macro I have using the Power Cards: !power {{ --name|Sneak Attack [ROGUE] --emote|@{selected|token_name} knows how to strike subtly and exploit a foe's distraction. --leftsub|Passive --rightsub|Self --format|player --Effect|If @{selected|token_name} is using a finese or ranged weapon and has advantage on the attack, they do extra damage to one creature they hit with an attack (once per turn). --Hit:|[[ [nh] ( @{selected|rogue_level} / 2 )d6 ]] extra damage --Critical:|[[ [nh] ( @{selected|rogue_level} / 2 )d6 ]] extra damage --Special|@{selected|token_name} doesn’t need advantage on the attack roll if another enemy of the target is within 5' of it, that enemy isn’t incapacitated, and @{selected|token_name} doesn’t have disadvantage on the attack roll. }} The @{selected|token_name} displays the name fine in the "--Effect" and "--Special" sections, but outputs nothing in the "--emote" section. It is doing this for all of the macros that used to work fine before the last Roll20 update. And I am using&nbsp;PowerCards version 3.2.8 for the record.
1437772476

Edited 1437772672
vÍnce
Pro
Sheet Author
I only get the last letter of the character's first name when using --emote| ! @{selected|token_name} &nbsp;If the name has multiple words in it, it shows the last letter of the first name and the rest of the name.&nbsp; var CUSTOM_EMOTES = true var SHOW_AVATAR = true v3.2.8 on Production server Updated to show I'm actually using&nbsp;--emote|!
1437777149

Edited 1437777210
I am not sure why you have the exclamation mark in the "--emote|" there, Vince. I am mainly confused about why it works in 2 of the lines but never in the first one now (the "--emote|" one), when it did before the update this week.
1437777783
vÍnce
Pro
Sheet Author
Nyghtmare said: I am not sure why you have the exclamation mark in the "--emote|" there, Vince. I am mainly confused about why it works in 2 of the lines but never in the first one now (the "--emote|" one), when it did before the update this week. emote - Creates an emote on top of the power card. Set CUSTOM_EMOTES to false in script to return to standard Roll20 orange emotes. If you have charid and emote together in the macro to use the power card styled emotes, you can put an exclamation mark in front of the emote to not show the avatar for that macro. Example: --emote|This emote would have an avatar. Example: --emote|!This emote would not have an avatar. There appears to be something wrong with the --emote| tag (which is a reserved tag, meaning it has special characteristics built into powercards for it) &nbsp;That's why adding your @{selected|character_name} works on the other sections of your card but not the actual --emote. &nbsp;I'm sure HB will have it solved when he has a minute. &nbsp;Cheers
Okay, I got ya now, Vince. It is to toggle whether or not a picture of the avatar is displayed with the printout. Hopefully it is a quick fix for HB to wrap his head around, if he has a chance to look at it — real life seems to be kicking his butt lately. ;)
Maybe TheAaron could even take a quick peek into the script again and see if he can figure it out... * hope hope *
1437789666
The Aaron
Pro
API Scripter
The problem is a regression in the /emas as sent by the API. &nbsp;Whereas previously, you sent: sendChat('something', '/emas Rook eats a sandwich.'); It would return: something &nbsp; &nbsp; &nbsp; &nbsp;Rook eats a sandwich. Now it takes whatever is in the first parameter and prepends that to the message, and strips out whatever is at the beginning of the message: &nbsp; &nbsp; &nbsp; &nbsp; something eats a sandwich. Here is a hacked version that should fix that for now: &nbsp;gist.github.com/shdwjk/f1e153a6a16803f7a886