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 ~ Now contains logic!™

Thanks for helping with my stupidity.
Thanks. :-) Incidentally, love having the ability to do these as multiple lines now. Makes them SOOOO much easier to read. :-)
Robert M. said: Thanks. :-) Incidentally, love having the ability to do these as multiple lines now. Makes them SOOOO much easier to read. :-) Thank "The Aaron" for that little tweak. It was all his doing. ^_^
Question how --charid is supposed to work. --charid|@{character_id}}} Doesn't show the avatar. Is the character_id a number or name?
1432751460

Edited 1432751576
--charid|@{character_id} only shows the avatar if the character has one and you are using an emote ( --emote|Soandso strikes with his sword! ) and both SHOW_AVATAR and CUSTOM_EMOTES are set to true (they are by default).
To be clear, Kunguru, just in case: you don't replace character_id with anything. Example: !power {{ --charid|@{character_id} --emote|Oswald recovers! --format|passive --name|Recovery --HP Regained|[[@{Level}@{RecDie}+@{CONMOD}]] }}
I've got a fix in that will eliminate a script crash if the target of an attribute call like @{target|AC} does not have that attribute, but I'm gonna wait to update the script 'til later tonight, just in case anyone else comes across some crashes that I didn't find.
1432774186

Edited 1432774695
Ok one bug and one question on version 3.0.3: First when you set "USE_PLAYER_COLOR = true;" on line 56 the script crashes with the following error: evalmachine.<anonymous>:254 TitleStyle += " color: " + PlayerTxColor + ";"; ^ ReferenceError: PlayerTxColor is not defined at evalmachine.<anonymous>:254:40 at checkFinishedOps ( Second I am wondering if you have the ability to output the result of a contested conditional. What I tried to do was create a macro that would target an NPC, then have it make a contested roll, the NPC stealth vs. the PC perception. Generally this seemed to be working, however I found no way to output the actual value of the PC perception roll. Here is my example using Actoba's default 5e sheet and related values: !power {{ --name|@{target|character_name}'s Stealth --Result|[[ [$Sth] 1d20 + @{target|npc_stealth}]] --?? $Sth total <= [[ [$Mper] 1d20+@{Mal|perception}]] ?? Mal:| Detected "@{target|character_name}" [$Mper] }} While not super important to get, being able to display the result of [$Mper] would at least help confirm that logic is indeed correct while creating such macros. The reason for using [$Mper] in this case is because I had intended to add the same line for all of my PC with each PC logically getting it's own variable [$Xper], that way I have one single macro that would allow me to see if the group detects my stealthy NPC.
Not yet, but the intention is to include some way to reference rolls that have an ID in other rolls and in text. I had it working at one point, but it was so buggy I trashed that iteration of powercards and went with what I have right now. Line 254 should have PlayerTX, not PlayerTx. Just missed capitalizing the x. Will be fixed in the next update.
May 27th, 2015 ~ 11:20 pm eastern Version: 3.0.4 Bugfix: Corrected incorrect case of PlayerTXColor on line 253 Bugfix: Added error checking for non-existent attributes when using an @{attribute} as a target number. Such as looking for AC with @{target|AC} on a token or character that does not have an AC attribute. This will no longer crash the script and will default to a value of zero. It will also send an error message to the person who triggered the script.
Totally awesome. So much work I have to do on this, this weekend for our game day next Saturday... Took a month off to finish out my spring semester, and just started my summer semester after only a week off. I need to turn my attention to something like this before I shoot myself because of Statistical Analysis.
1432785580
Gen Kitty
Forum Champion
HoneyBadger said: Bugfix: Added error checking for non-existent attributes when using an @{attribute} as a target number. Such as looking for AC with @{target|AC} on a token or character that does not have an AC attribute. This will no longer crash the script and will default to a value of zero. It will also send an error message to the person who triggered the script. Oh, nice! That's a useful fix. I'm not sure when I'll have a chance to start chewing on this script again, it may not be until next week alas.
GenKitty said: HoneyBadger said: Bugfix: Added error checking for non-existent attributes when using an @{attribute} as a target number. Such as looking for AC with @{target|AC} on a token or character that does not have an AC attribute. This will no longer crash the script and will default to a value of zero. It will also send an error message to the person who triggered the script. Oh, nice! That's a useful fix. I'm not sure when I'll have a chance to start chewing on this script again, it may not be until next week alas. Yeah, I'm trying to find all the errors that crash the script and fix them. So if anyone finds any... make absolutely sure you post the macro and the error message.
1432794929

Edited 1432799823
Gen Kitty
Forum Champion
Musing as I work on setting up 3.x and my Pathfinder macros... How hard would it be to enable players to make choices about things like the title style using small caps versus normal font-style? The cf< bug is back. Failure to properly highlight for variable. Macro: !power {{ --name|Variable CF Test --bgcolor|#9F00C5 --txcolor|#FFFFFF --titlefont|Helvetica --subtitlefont|Helvetica --titlefontsize|18px --subtitlefontsize|12px --bodyfontsize|12px --leftsub|Standard Action --rightsub|Melee --!Attack:|[[ [$Atk]1d20cf<?{Misfire|1} [Dice] ]] vs **@{target|Foe 1|token_name}'s** AC --??$Atk base <= ?{Misfire|1}??!CriticalMiss!|$$#F30|**Critical Miss!**$$ No Damage --??$Atk base > ?{Misfire|1}??Possible Damage:|Something --??$Atk base >= 21??!^1Crit|$$#060|**Possible Critical Hit**$$ }} Given a crit-fail of '18', it failed to highlight as a crit-fail, though the conditional stuff worked right.
Having some trouble, here is my code: !power {{ --charid|@{character_id} --emote|@{selected|character_name} throws down his d20 --format|initiative --name| Let's Get Ready to RUMBLE!!! --Initiative|[[1d20+ @(selected|initiative} &{tracker}]] }} The player has an avatar, but it doesn't show up. I do get this error though: No character was found for 'character_id'
1432818842
The Aaron
Pro
API Scripter
Do you have that code in an ability on the character, or as a macro in the settings?
As a macro for all my players to use.
1432819372
The Aaron
Pro
API Scripter
That's what I thought. @{character_id} won't have anything to resolve to. You'd need to use @{selected|character_id}. Within a Character's Abilities, any attribute reference without a specific source (like selected or target) is implicitly sourced against the current character. Assuming you had a character named Bob, it would read @{character_id} as @{Bob|character_id}. In the case of a macro, it is not attached to a character, so can't have an implicit source determined. Based on the rest of the macro, using @{selected|character_id} should work fine for your players.
Kunguru, in that case, you have to indicate the "selected" for the character id too. !power {{ --charid|@{selected|character_id} --emote|@{selected|character_name} throws down his d20 --format|initiative --name| Let's Get Ready to RUMBLE!!! --Initiative|[[1d20+ @(selected|initiative} &{tracker}]] }}
1432820407

Edited 1432820789
GenKitty said: Musing as I work on setting up 3.x and my Pathfinder macros... How hard would it be to enable players to make choices about things like the title style using small caps versus normal font-style? The cf< bug is back. Failure to properly highlight for variable. Macro: !power {{ --name|Variable CF Test --bgcolor|#9F00C5 --txcolor|#FFFFFF --titlefont|Helvetica --subtitlefont|Helvetica --titlefontsize|18px --subtitlefontsize|12px --bodyfontsize|12px --leftsub|Standard Action --rightsub|Melee --!Attack:|[[ [$Atk]1d20cf<?{Misfire|1} [Dice] ]] vs **@{target|Foe 1|token_name}'s** AC --??$Atk base <= ?{Misfire|1}??!CriticalMiss!|$$#F30|**Critical Miss!**$$ No Damage --??$Atk base > ?{Misfire|1}??Possible Damage:|Something --??$Atk base >= 21??!^1Crit|$$#060|**Possible Critical Hit**$$ }} It's pretty easy to add formatting options via tags now. I forgot I changed it to small caps for testing and left it in there by accident. I'll add that to the to do list. As for the tooltip problem, it was a copy paste issue where the html characters were converted from their entity to the actual character. Easy enough to fix. I'll double check the highlight of custom failure though. That shouldn't be happening. Edit - Found it. Line 595 has an error... it is >= instead of <= as it should be.
I'm going to continue to pester people. I have a rollable table that I want to use in the emote, is that possible? I've bolded the table portion, can I do this in the emote or would I have to use a separate line? !power {{ --charid|@{selected|character_id} --emote|Zadik's blade [[ 1t[attack_flavor_slashing] ]] out at his foe --format|Attack --name|Basic Attack --leftsub|Longsword --rightsub|Range Melee --Attack:|[[ [$Atk] 1d20 + 3 [Str Mod] + [[@{Target|pb}]] [Proficiency] ]] vs AC --?? $Atk base == 1 OR $Atk total < [[@{target|ac}]]?? !Miss:|You missed. --?? $Atk total >= [[@{target|ac} ]] AND $Atk base <> 1 AND $Atk base <> 20 ?? Hit:|[[1d8 + 3]] slashing damage --?? $Atk base == 20 ?? Critical Hit:|[[2d8 + 3]] slashing damage }}
1432821327
The Aaron
Pro
API Scripter
You can definitely put that roll there. What you get out of it might be questionable. What happens when you try it?
It spits this out: Zadik's blade $$[[1]] out at his foe It should choose one of these options: hacks slashes chops slices rends rips carves cleaves
May 28th, 2015 ~ 10:00 am eastern Version: 3.0.5 Bugfix: Corrected tooltip on inline rolls when using the less than symbol Bugfix: Corrected logic for custom fumble rolls not highlighting custom fumbles properly Update: Added --titlefontvariant and --subtitlefontvariant to the list of format tags you can use to format things! ( request per GenKitty )
Kunguru said: It spits this out: Zadik's blade $$[[1]] out at his foe I'll poke around and add emotes into the inlineroll replacement stuff. May take some time.
How dare you not work harder and faster HoneyBadger...I'm so dissapointed. Seriously take your time, I appreciate all the incredible work.
HoneyBadger, one thing I noticed (won't be a problem for me since I'm using the Logic stuff to *replace* the XPND rolls' purpose) is that it doesn't appear that you can use a roll label like [$Atk] and use [XPND] at the same time. Am I right on that? Not sure if that would be a problem for anyone. I love the idea of making rolls with labels able to be referenced in more ways. It'll definitely make the logic formulas somewhat cleaner if we can end up able to do that--kind of defining a variable, I guess? I.E. ?? $Atk total < $Def (and separately, ?? $Atk total >= $Def) as opposed to ?? $Atk total < [[@{target|Target1|AC}]] (and separately, $Atk total >= [[@{target|Target1|AC}]]) I find that I'm referencing certain things (such as critical hit ranges, which are pretty variable in 13th Age and thus are being determined by a formula for me) in multiple locations, so it'll be great if this eventually becomes able to reference roll labels in various places. :-) (Unless it can already do the above and I'm just an idiot, which is always a possibility.)
1432822650

Edited 1432822832
Robert M. said: HoneyBadger, one thing I noticed (won't be a problem for me since I'm using the Logic stuff to *replace* the XPND rolls' purpose) is that it doesn't appear that you can use a roll label like [$Atk] and use [XPND] at the same time. Am I right on that? Not sure if that would be a problem for anyone. I love the idea of making rolls with labels able to be referenced in more ways. It'll definitely make the logic formulas somewhat cleaner if we can end up able to do that--kind of defining a variable, I guess? I.E. ?? $Atk total < $Def (and separately, ?? $Atk total >= $Def) as opposed to ?? $Atk total < [[@{target|Target1|AC}]] (and separately, $Atk total >= [[@{target|Target1|AC}]]) I find that I'm referencing certain things (such as critical hit ranges, which are pretty variable in 13th Age and thus are being determined by a formula for me) in multiple locations, so it'll be great if this eventually becomes able to reference roll labels in various places. :-) (Unless it can already do the above and I'm just an idiot, which is always a possibility.) You should be able to with [[ [$Atk|xpnd] 1d20 ]]. You can also do [[ [$Atk|xpnd] 1d20 + [[4 [Str Mod] + 3 [Wpn Prof] ]] ]] to combine all the modifiers into one.
Yep, that works! Thank you--very cool. Sorry if I missed that somewhere earlier. O_O
Robert M. said: Here's an odd one: I have a powercard for rolling initiative, and it worked in earlier Powercards versions, but now sends a different result to the tracker than what the powercard displays (usually quite drastically different, like showing a roll of 23 but posting initiative 11). !power {{ --charid|@{character_id} --emote|@{selected|token_name} rolls initiative! --format|battle --name|Initiative^^(Quick to Fight) --Initiative|[[2d20kh1+@{Initiative} &{tracker}]] }} I've tested the initiative roll there both as an inline roll and with the /roll code separately, and in both cases it is fine. The error only happens when using the PowerCard. My best guess would be that maybe PowerCards is rolling initiative to display, but then somehow rerolling it to post to tracker? JB, I am having the same problem as Robert M with initiative rolls sent to tracker. The rolls in chat are showing up different than what shows up in the Turn Order. !power {{ --emote|@{selected|token_name} ♦ @{Selected|RACE} @{Selected|RACE|Max} --bgcolor|@{selected|ColorCode} --txcolor|#ffffff --name|INITIATIVE --!Roll|[[1d20+@{selected|INITIATIVE} &{tracker}]] Initiative Turn }} Thanks...
Kunguru said: I'm going to continue to pester people. I have a rollable table that I want to use in the emote, is that possible? I've bolded the table portion, can I do this in the emote or would I have to use a separate line? !power {{ --charid|@{selected|character_id} --emote|Zadik's blade [[ 1t[attack_flavor_slashing] ]] out at his foe --format|Attack --name|Basic Attack --leftsub|Longsword --rightsub|Range Melee --Attack:|[[ [$Atk] 1d20 + 3 [Str Mod] + [[@{Target|pb}]] [Proficiency] ]] vs AC --?? $Atk base == 1 OR $Atk total < [[@{target|ac}]]?? !Miss:|You missed. --?? $Atk total >= [[@{target|ac} ]] AND $Atk base <> 1 AND $Atk base <> 20 ?? Hit:|[[1d8 + 3]] slashing damage --?? $Atk base == 20 ?? Critical Hit:|[[2d8 + 3]] slashing damage }} Ok, I have tables working in emotes now, but I need to add some code to add them as text, not an inline roll.
Master MJ said: JB, I am having the same problem as Robert M with initiative rolls sent to tracker. The rolls in chat are showing up different than what shows up in the Turn Order. !power {{ --emote|@{selected|token_name} ♦ @{Selected|RACE} @{Selected|RACE|Max} --bgcolor|@{selected|ColorCode} --txcolor|#ffffff --name|INITIATIVE --!Roll|[[1d20+@{selected|INITIATIVE} &{tracker}]] Initiative Turn }} Thanks... Yeah, I haven't fixed that yet. The reason this is happening is because when you click the macro, Roll20 converts all inline rolls [[1d20]] into actual rolls in the msg object. I replace the placeholder $[[1]] with the expression and they are re-rolled after I have made adjustments to the rolls and such. This is why the roll in the tracker is different from the roll in the card. I have started working on a trkr roll option like [[ [trkr] 1d20 ]] to replace the &{tracker} Roll20 option. It's just not done yet.
1432827746
The Aaron
Pro
API Scripter
Bummer that the existence &{tracker} isn't observable in the message structure passed to the API. You could catch the change:campaign:turnorder event (it appears to occur before the chat:message event) and queue up the changed token_id and check it against the msg.selected to infer when it was used, but you'd not know easily which roll it was I guess. =/
HoneyBadger said: Yeah, I haven't fixed that yet. The reason this is happening is because when you click the macro, Roll20 converts all inline rolls [[1d20]] into actual rolls in the msg object. I replace the placeholder $[[1]] with the expression and they are re-rolled after I have made adjustments to the rolls and such. This is why the roll in the tracker is different from the roll in the card. I have started working on a trkr roll option like [[ [trkr] 1d20 ]] to replace the &{tracker} Roll20 option. It's just not done yet. Sounds like a good idea. I will watch and wait. Thanks JB
First up: Thanks a TON for this, really enjoying it. One thing I have run into, and I didn't see it mentioned anywhere, but I can only use a single variable per powercard macro. Attempting to add a second hangs the macro. EX: !power {{ ... --Attack:| [[ [$Atk] 1d20 + ?{ToHitMod|@{selected|bar1}}]] vs AC [[ @{target|Target|AC}]] --?? $Atk total < [[@{target|Target|AC}]] AND $Atk base <> 1 AND $Atk base <> 20 ?? ! MISS| ~C @{selected|token_name} missed with their ?{Weapon|weapon} attack ~C ... }} works fine, but if I try to save another variable such as --Attack:| [[ [$Atk] 1d20 + ?{ToHitMod|@{selected|bar1}}]] | [[ [$Atkadv] 1d20 + ?{ToHitMod|@{selected|bar1}}]] vs AC [[ @{target|Target|AC}]] then it fails. Am I doing something incorrectly or is that by design and just not documented anywhere? And lastly: Other than here in these forums is there a place where people have come together to share macros they have written using the Power Cards? I am really getting into this and would love to share some of the work I have done and perhaps save others some time and sanity :) Thanks again for the awesome script.
1432830584

Edited 1432831327
Shouldn't be failing... I have a macro that uses $Atk1 and $Atk2 and I can reference them both. Here's a sample macro I've been using for testing: !power {{ --charid|@{character_id} --emote|//Nameless strides forward and [[ [txt] 1t[attack_flavor_slashing] ]] with his spectral blade.// --title|HoneyBadger --name|Long Sword --leftsub|Melee Attack --rightsub|Reach 5 ft --Attack:|[[ [$Atk1] 1d20 + 3 [Strength Mod] + 3 [Proficiency] ]] | [[ [$Atk2] 1d20 + 3 [Strength Mod] + 3 [Proficiency] ]] vs AC --Hit:|[[ [nh] 1d8 + 3 [Str Mod] ]] slashing damage --?? $Atk1 base == 20 OR $Atk2 base == 20??Critical Hit:|[[ [nh] 1d8]] additional slashing damage }}
I'm off to bed. Not near enough sleep last night. As you can see in the sample macro above and the picture below, I have tables in emotes working and showing up as text only. After I have slept, I will catch up on the thread and then add the txt roll option to regular inline rolls too and post an update to the gist. I've also done a little work on cleaning up tooltips and fixed an empty brackets display that was bugging me. Anyway... night all.
1432836197

Edited 1432836429
For some reason I'm still getting the $$[[1]] where the table result should be. I literally copied the emote line directly from above and pasted it in. I did update the script before I tried. When I look at the api output I see this: --emote|//Nameless strides forward and [[ [txt] 1t[attack_flavor_slashing] ]] with his spectral blade.// Even though the script definately has a space between [[ and [txt] the script removes it.
Kunguru said: For some reason I'm still getting the $$[[1]] where the table result should be. I literally copied the emote line directly from above and pasted it in. I did update the script before I tried. When I look at the api output I see this: --emote|//Nameless strides forward and [[ [txt] 1t[attack_flavor_slashing] ]] with his spectral blade.// Even though the script definately has a space between [[ and [txt] the script removes it. That's because I haven't updated the gist with that fix yet.
1432854130

Edited 1432858059
May 28th, 2015 ~ 7:00 pm eastern Version: 3.0.6 Update: Inline rolls and rollable tables now show up in emotes. Update: Added [txt] as a roll option to show a roll as text instead of an inline roll. Bugfix: Cleaned up code involving labels and comments in inline rolls and removing roll options from the tooltip display to reduce garbage/clutter.
1432857488

Edited 1432857501
Is it safe to assume, "... Inline rolls and tables..." means rollable tables?
1432858041

Edited 1432858101
Yeah, sorry. Rollable tables, lol. Working on adding trkr to the roll options now. Also just had an idea for implementing image only rollable tables in powercards. :D
1432862884

Edited 1432863768
I keep getting this error with the new 3.0.6 update. For reference, the error message generated was: evalmachine.<anonymous>:413 if (PowerCard.emote.indexOf("$[[" + i + "]]") !== -1) PowerCar ^ TypeError: Cannot call method 'indexOf' of undefined at evalmachine.<anonymous>:413:37 at Array.forEach (native) at evalmachine.<anonymous>:411:43 at checkFinishedOps ( I am trying to use this script and then it kills the api for power cards. !power {{ --whisper|self --bgcolor|#ff0000 --txcolor|#ffffff --name|SKILL CHECK --leftsub|Group Perception --rightsub|DM Private Rolls --!PC1|[[1d20+@{Abraxus|PERCEPTION}]] **Abraxus** by Matt --!PC2|[[1d20+@{Bannon|PERCEPTION}]] **Bannon** by Voth --!PC3|[[1d20+@{Bard|PERCEPTION}]] **Bard** by Jacob --!PC4|[[1d20+@{Kwai|PERCEPTION}]] **Kwai** by Mark --!PC5|[[1d20+@{Voren|PERCEPTION}]] **Voren** by Clarence }}
No, it's an issue with looking for inline rolls in the PowerCard.emote variable... that doesn't exist. I came across that as well and have it fixed. Soon as I finish the trkr update, it'll be out. Getting close.
1432863797
Gen Kitty
Forum Champion
Can you elaborate on the 'not displaying right'? What are you getting versus what are you expecting?
HoneyBadger said: No, it's an issue with looking for inline rolls in the PowerCard.emote variable... that doesn't exist. I came across that as well and have it fixed. Soon as I finish the trkr update, it'll be out. Getting close. Excellent. JB your the best!!
I get: Unexpected token ) when trying to run 3.0.6 with my other 2 scripts. Powercards3 on its own works fine. The other two scripts together w/o powercards (or with powercards 2.x) work fine. Soon as I add 3.0.6 to the sandbox running the other two scripts I get that "Unexpected token )" Any idea how to troubleshoot this? For reference, one of the "other" scripts adds status effects on bar changes, the other "other" listens for all my other !api commands i use for housekeeping and token management.
DRB GM said: I get: Unexpected token ) when trying to run 3.0.6 with my other 2 scripts. Powercards3 on its own works fine. The other two scripts together w/o powercards (or with powercards 2.x) work fine. Soon as I add 3.0.6 to the sandbox running the other two scripts I get that "Unexpected token )" Any idea how to troubleshoot this? For reference, one of the "other" scripts adds status effects on bar changes, the other "other" listens for all my other !api commands i use for housekeeping and token management. Add one and then the other two scripts, separately, so you know which one is causing the conflict. Then I might be able to help.
1432864184

Edited 1432864219
DRB GM, go to your API page and it should have an error message above the API Output Console. Post it in a reply so JB can look at it and see what is happening. Nevermind, JB is just that quick...
1432864524

Edited 1432864955
Muse
Pro
Either script breaks its. the error message is simply: For reference, the error message generated was: Unexpected token )