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)

Silvyre said: Patrick said: [[ [$RandGen] d20t[Randomness] ]] Try [[ [$RandGen] [[d20]]t[Randomness] ]] Ok, that worked fine, and thanks.  My next question is is there any way to refer to another variable, such as[[ [$RandGen] [[SpellNum]]t[Randomness] ]] ?
1468530538

Edited 1468530753
Silvyre
Forum Champion
You could do this: !power {{ --Number of spells|[^SpellNum] --Spell List|[[ [$SpellList] [[ [$SpellNum] d20 ]]t[Wizard Spells] ]] }}
Duh.  I never thought to just invert the formula.  Thanks again.
1468677096

Edited 1468677302
Ok, try this one on for size.  My goal below is to add a conditional inquiry from the player for advantage/disadvantage/neither, but the formulas after the conditional attempt to execute immediately, displaying the jibberish you don't want, instead of the powercard. This powercard works fine without the added code asking the player what their situation is. The line I added is: --Base Attack Roll|?{Select Situation|Advantage,[[ [$Atkbase] 2d20KH1 ]|Disadvantage,[[ [$Atkbase] 2d20KL1 ]|Neither,[[ [$Atkbase] d20 ] The full card is here: !power {{ --name|@{meleeweaponname2}  --tokenid|@{selected|token_id} --bgcolor|red --leftsub|Action --rightsub|Melee --Base Attack Roll|?{Select Situation|Advantage,[[ [$Atkbase] 2d20KH1 ]|Disadvantage,[[ [$Atkbase] 2d20KL1 ]|Neither,[[ [$Atkbase] d20 ] --@{meleeweaponname2} Attack|[[ [$Atk1] [[$Atkbase]] + @{meleetohit2} ]] vs @{target|token_name}'s [[@{target|bar2}]] AC --?? $Atk1.base == 1 OR $Atk1.total < [[@{target|bar2}]] ?? Under AC|You deal no damage --?? $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 ?? Over AC|Deal [[ [$Dmg1] @{meleedmg2} + @{meleeattackstat2} + @{meleemagic2} ]] @{meleedmgtype2} damage --?? $Atk1.base == 20 ?? Critical hit|Deal [[ [$Dmg2] @{meleedmg2} ]] @{meleedmgtype2} damage --?? $Atk1.base == 1 ?? emote|[[ [$PM] 1t[Piercing Miss] ]] --?? $Atk1.base > 1 AND $Atk1.total < [[@{target|bar2}]] ?? emote|[[ [$PM] 1t[Piercing Miss] ]] --?? $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Dmg1.total < [[@{target|Bar3}]] ?? emote|[[ [$PH] 1t[Piercing Hit] ]] --?? $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Dmg1.total > [[@{target|Bar3}]] ?? emote|[[ [$PK] 1t[Piercing Kill] ]] --?? $Atk1.base == 20 AND $Dmg1.total + $Dmg2.total < [[@{target|Bar3}]] ?? emote|[[ [$PC] 1t[Piercing Critical] ]] --?? $Atk1.base == 20 AND $Dmg1.total + $Dmg2.total > [[@{target|Bar3}]] ?? emote|[[ [$PK] 1t[Piercing Kill] ]] }}  The question I have is, is there a way to delay the calculation of the rest of the card until the player has provided the necessary input to allow it? *Edit* A workaround I have found is using the ammo script, I give the player an additional button prompting their situational advantage, altering a reference variable on each of their character sheets, linking to a more complex set of conditionals.  This does the trick, but it's ugly as it gets.
1468678989

Edited 1468679028
Silvyre
Forum Champion
Patrick said: [[ [$Atk1] [[$Atkbase]] + @{meleetohit2} ]] It is not currently possible to use Roll IDs in this manner. Patrick said: ?{Select Situation|Advantage,[[ [$Atkbase] 2d20KH1 ]|Disadvantage,[[ [$Atkbase] 2d20KL1 ]|Neither,[[ [$Atkbase] d20 ] This Roll Query needs a bit of work. I'll recommend: [[ [$Atkbase] ?{Roll|Normal, 1d20|Advantage, 2d20kh1|Disadvantage, 2d20kl1} ]]
That's cleaner, causing the prompt to work, but then the powercard just hangs on target selection, I assume not processing the rest at all, and producing no output.
1468688108

Edited 1468688245
Silvyre
Forum Champion
Patrick said: --?? [...] ?? emote|[...] It is not currently possible to use reserved tags (like 'emote') with conditionals. You should also double-check your Rollable Table calls (e.g. 1t[Piercing Hit]), because Rollable Table names should not include spaces.
Patrick said: --?? [...] ?? emote|[...] It is not currently possible to use reserved tags (like 'emote') with conditionals. You should also double-check your Rollable Table calls (e.g. 1t[Piercing Hit]), because Rollable Table names should not include spaces. Heh, well those methods may not SUPPOSED to be able to work, but they most certainly do.  Like I said, the powercard works flawlessly without that one line of extra code, adding a player input condition that the other powercard conditionals rely on to calculate causes the whole thing to fail outright. To make it work with the player-conditional, I just basically need a code-inserted delay until X happens.  Is that possible?
1468691507
Silvyre
Forum Champion
Patrick said: Heh, well those methods may not SUPPOSED to be able to work, but they most certainly do. Interesting; from a bit of testing, it appears that the whisper tag and the emote tag both work with conditionals. Good to know! Patrick said: Like I said, the powercard works flawlessly without that one line of extra code, adding a player input condition that the other powercard conditionals rely on to calculate causes the whole thing to fail outright. To make it work with the player-conditional , I just basically need a code-inserted delay until X happens.  Is that possible? Are you referring to the ?{Select Situation} Roll Query? Roll Queries are executed before the PowerCard gets processed; it shouldn't pose an issue. I might suggest posting your updated macro code.
Sure, so my original, working code is as follows: !power {{ --name|@{meleeweaponname2}  --tokenid|@{selected|token_id} --bgcolor|red --leftsub|Action --rightsub|Melee --@{meleeweaponname2} Attack|[[ [$Atk1] d20 + @{meleetohit2} ]] vs @{target|token_name}'s [[@{target|bar2}]] AC --?? $Atk1.base == 1 OR $Atk1.total < [[@{target|bar2}]] ?? Under AC|You deal no damage --?? $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 ?? Over AC|Deal [[ [$Dmg1] @{meleedmg2} + @{meleeattackstat2} + @{meleemagic2} ]] @{meleedmgtype2} damage --?? $Atk1.base == 20 ?? Critical hit|Deal [[ [$Dmg2] @{meleedmg2} ]] @{meleedmgtype2} damage --?? $Atk1.base == 1 ?? emote|[[ [$PM] 1t[Piercing Miss] ]] --?? $Atk1.base > 1 AND $Atk1.total < [[@{target|bar2}]] ?? emote|[[ [$PM] 1t[Piercing Miss] ]] --?? $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Dmg1.total < [[@{target|Bar3}]] ?? emote|[[ [$PH] 1t[Piercing Hit] ]] --?? $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Dmg1.total > [[@{target|Bar3}]] ?? emote|[[ [$PK] 1t[Piercing Kill] ]] --?? $Atk1.base == 20 AND $Dmg1.total + $Dmg2.total < [[@{target|Bar3}]] ?? emote|[[ [$PC] 1t[Piercing Critical] ]] --?? $Atk1.base == 20 AND $Dmg1.total + $Dmg2.total > [[@{target|Bar3}]] ?? emote|[[ [$PK] 1t[Piercing Kill] ]] }}  But obviously my players want to have advantage or disadvantage instead of rerunning the entire attack or manually rolling a d20 after the fact. So, my goal is something akin to this: !power {{ --name|@{meleeweaponname2}  --tokenid|@{selected|token_id} --bgcolor|red --leftsub|Action --rightsub|Melee --@{meleeweaponname2} Attack|[[ [$Atkbase] ?{Roll|Normal, 1d20|Advantage, 2d20kh1|Disadvantage, 2d20kl1} ]] + @{meleetohit2} ]] vs @{target|token_name}'s [[@{target|bar2}]] AC --?? $Atk1.base == 1 OR $Atk1.total < [[@{target|bar2}]] ?? Under AC|You deal no damage --?? $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 ?? Over AC|Deal [[ [$Dmg1] @{meleedmg2} + @{meleeattackstat2} + @{meleemagic2} ]] @{meleedmgtype2} damage --?? $Atk1.base == 20 ?? Critical hit|Deal [[ [$Dmg2] @{meleedmg2} ]] @{meleedmgtype2} damage --?? $Atk1.base == 1 ?? emote|[[ [$PM] 1t[Piercing Miss] ]] --?? $Atk1.base > 1 AND $Atk1.total < [[@{target|bar2}]] ?? emote|[[ [$PM] 1t[Piercing Miss] ]] --?? $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Dmg1.total < [[@{target|Bar3}]] ?? emote|[[ [$PH] 1t[Piercing Hit] ]] --?? $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Dmg1.total > [[@{target|Bar3}]] ?? emote|[[ [$PK] 1t[Piercing Kill] ]] --?? $Atk1.base == 20 AND $Dmg1.total + $Dmg2.total < [[@{target|Bar3}]] ?? emote|[[ [$PC] 1t[Piercing Critical] ]] --?? $Atk1.base == 20 AND $Dmg1.total + $Dmg2.total > [[@{target|Bar3}]] ?? emote|[[ [$PK] 1t[Piercing Kill] ]] }}  The problem is scenario 2 hangs on target selection after the player inputs their situational preference, never completing the script at all, and providing no output.  It does not error out the API or require an API reboot, but it also does not run the script.   Are you referring to the ?{Select Situation} Roll Query? Roll Queries are executed before the PowerCard gets processed; it shouldn't pose an issue. I might suggest posting your updated macro code. This may be the case hierarchically, but I know Powercard must attempt to process the script immediately thereafter, as my previous attempt at including an option for adv/disadv sent the broken code to chat before I had even selected an option.  Since the script immediately following the player input conditional was dependent on the conditional itself, it just output broken code.
[[ [$Atkbase] ?{Roll|Normal, 1d20|Advantage, 2d20kh1|Disadvantage, 2d20kl1} ]] + @{meleetohit2} ]] Should be: [[ [$Atkbase] ?{Roll|Normal, 1d20|Advantage, 2d20kh1|Disadvantage, 2d20kl1} + @{meleetohit2} ]]
[[ 1d4 ]] + 0 ]] The above errors out completely in Roll20, doing nothing.
That outputs:  !power {{--name|Dagger --tokenid|-KJbZG6tVUMAc6O5fSDD--bgcolor|red--leftsub|Action--rightsub|Melee--Dagger Attack|25 vs an orc eye of Grummsh's 16 AC--?? $Atk1.base == 1 OR $Atk1.total <16 ?? Under AC|You deal no damage--?? $Atk1.total >= 16 AND $Atk1.base <> 1 ?? Over AC|Deal 5 piercing damage--?? $Atk1.base == 20 ?? Critical hit|Deal4 piercing damage--?? $Atk1.base == 1 ?? emote|0--?? $Atk1.base > 1 AND $Atk1.total <16 ?? emote|0--?? $Atk1.total >= 16 AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Dmg1.total < 45 ?? emote|0--?? $Atk1.total >= 16 AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Dmg1.total > 45 ?? emote|0--?? $Atk1.base == 20 AND $Dmg1.total + $Dmg2.total < 45 ?? emote|0--?? $Atk1.base == 20 AND $Dmg1.total + $Dmg2.total > 45 ?? emote|0}} Which is just the processed script, but without using powercards.
1468705394

Edited 1468705431
You have an empty space in front of !power. It's a problem when copying stuff from the forums.
Bah - couldn't see it.  That allowed the script to run, but only the first couple lines of it.  Nothing from damages onward calculates.  Is there a hard limit for a number of simultaneous calculations that can be done in one script?
Your roll ID's don't match.
1468722685

Edited 1468723957
Ah, beautiful.  Working flawlessly now under all conditions.  Thanks to the both of you. :) For anyone else that is interested, the final code is as follows: !power {{ --name|@{meleeweaponname1}  --tokenid|@{selected|token_id} --bgcolor|red --leftsub|Action --rightsub|Melee --@{meleeweaponname1} Attack|[[ [$Atk1] ?{Roll|Normal, 1d20|Advantage, 2d20kh1|Disadvantage, 2d20kl1} + @{meleetohit1} ]] vs @{target|token_name}'s [[@{target|bar2}]] AC --?? $Atk1.base == 1 OR $Atk1.total < [[@{target|bar2}]] ?? Under AC|You deal no damage --?? $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 ?? Over AC|Deal [[ [$Dmg1] @{meleedmg1} + @{meleeattackstat1} + @{meleemagic1} ]] @{meleedmgtype1} damage --?? $Atk1.base == 20 ?? Critical hit|Deal [[ [$Dmg2] @{meleedmg1} ]] @{meleedmgtype1} damage --?? $Atk1.base == 1 ?? emote|[[ [$PM] 1t[Piercing Miss] ]] --?? $Atk1.total < [[@{target|bar2}]] ?? emote|[[ [$PM] 1t[Piercing Miss] ]] --?? $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Dmg1.total < [[@{target|Bar3}]] ?? emote|[[ [$PH] 1t[Piercing Hit] ]] --?? $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Dmg1.total > [[@{target|Bar3}]] ?? emote|[[ [$PK] 1t[Piercing Kill] ]] --?? $Atk1.base == 20 AND $Dmg1.total + $Dmg2.total < [[@{target|Bar3}]] ?? emote|[[ [$PC] 1t[Piercing Critical] ]] --?? $Atk1.base == 20 AND $Dmg1.total + $Dmg2.total > [[@{target|Bar3}]] ?? emote|[[ [$PK] 1t[Piercing Kill] ]] }}  (just make sure to remove the invisible space from in front of the !power {{ - trust me, it's there)
I'm surprised the emote conditionals work. I don't remember fixing/adding that in, lol.
Yeah, I've been using them for some time now.  They're pretty great for flavoring up the fight scenes.  I've only got seven descriptions (head, neck, chest, arms, groin, legs, feet) for each of the four basic damage types (bludgeoning, slashing, piercing, ranged) for each of the four attacks (miss, hit, critical, kill), but it's enough to keep things different round to round and action to action, especially since my players are big into RP meat.
1468750680
Ziechael
Forum Champion
Sheet Author
API Scripter
SkyCaptainXIII said: I'm surprised the emote conditionals work. I don't remember fixing/adding that in, lol. The sign of a genius is the inclusion of features you didn't even know you'd included ;)
Genius? More like madness.
1468771444
Ziechael
Forum Champion
Sheet Author
API Scripter
Tomato, Toma-h-to
Ok, new problem again.  The following script works perfectly for all methods of hitting EXCEPT criticals.  Any suggestions? !power {{ --name|@{meleeweaponname1}  --tokenid|@{selected|token_id} --bgcolor|red --leftsub|Action --rightsub|Melee --@{meleeweaponname1} Attack|[[ [$Atk1] ?{Roll|Normal, 1d20r<2|Advantage, 2d20kh1r<2|Disadvantage, 2d20kl1r<2} + @{meleetohit1} ]] vs @{target|token_name}'s [[@{target|bar2}]] AC --?? $Atk1.base == 1 OR $Atk1.total < [[@{target|bar2}]] ?? Under AC|You deal no damage --?? $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 ?? Over AC|Deal [[ [$Dmg1] @{meleedmg1} + @{meleeattackstat1} + @{meleemagic1} ]] @{meleedmgtype1} damage --?? $Atk1.base >= 19 ?? Critical hit|Deal [[ [$Dmg2] @{meleedmg1} ]] @{meleedmgtype1} damage --?? $Atk1.base == 1 ?? emote|[[ [$PM] 1t[Slashing Miss] ]] --?? $Atk1.total < [[@{target|bar2}]] ?? emote|[[ [$PM] 1t[Slashing Miss] ]] --?? $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Atk1.base <> 19 AND $Dmg1.total < [[@{target|Bar3}]] ?? emote|[[ [$PH] 1t[Slashing Hit] ]] --?? $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Atk1.base <> 19 AND $Dmg1.total > [[@{target|Bar3}]] ?? emote|[[ [$PK] 1t[Slashing Kill] ]] --?? $Atk1.base >= 19 AND $Dmg1.total + $Dmg2.total < [[@{target|Bar3}]] ?? emote|[[ [$PC] 1t[Slashing Critical] ]] --?? $Atk1.base >= 19 AND $Dmg1.total + $Dmg2.total > [[@{target|Bar3}]] ?? emote|[[ [$PK] 1t[Slashing Kill] ]] }}  I know that bottom one shows red - it was rolled with advantage, and he gets a reroll on his first 1.  He rolled 1, 19, and 11.  He crits on 19-20, which seems to be reflected in the code, as 19s show up green.  But for the life of me, I cant figure out why it won't poll the table.  The table is named correctly, "Slashing Critical", so I don't think that's it.  Any ideas?
Also note, I can roll the table manually, as well as through a direct chat input of /r 1t[Slashing Critical]
You can't do math with conditionals. $Dmg1.total + $Dmg2.total Tried to implement that once and it was very very api crash prone.
Then why do the kills work on the line below?
My guess is that it is simply looking at Dmg1.total and ignoring everything else. I don't know without actually running a macro like that and logging results in the api console.
1468884643

Edited 1468884664
Jesus... I've never had to anti-math a problem before.  That tested my brain-skills a bit, but I got it to work dangit! Final working code: !power {{ --name|@{meleeweaponname1}  --tokenid|@{selected|token_id} --bgcolor|red --leftsub|Action --rightsub|Melee --@{meleeweaponname1} Attack|[[ [$Atk1] ?{Roll|Normal, 1d20r<2|Advantage, 2d20kh1r<2|Disadvantage, 2d20kl1r<2} + @{meleetohit1} ]] vs @{target|token_name}'s [[@{target|bar2}]] AC --?? $Atk1.base == 1 OR $Atk1.total < [[@{target|bar2}]] ?? Under AC|You deal no damage --?? $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Atk1.base <> 19 ?? Over AC|Deal [[ [$Dmg1] @{meleedmg1} + @{meleeattackstat1} + @{meleemagic1} ]] @{meleedmgtype1} damage --?? $Atk1.base >= 19 ?? Critical hit|Deal [[ [$Dmg2] @{meleedmg1} + @{meleedmg1} + @{meleeattackstat1} + @{meleemagic1} ]] @{meleedmgtype1} damage --?? $Atk1.base == 1 ?? emote|[[ [$PM] 1t[LoSlashing Miss] ]] --?? $Atk1.total < [[@{target|bar2}]] ?? emote|[[ [$PM] 1t[LoSlashing Miss] ]] --?? $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Atk1.base <> 19 AND $Dmg1.total < [[@{target|Bar3}]] ?? emote|[[ [$PH] 1t[LoSlashing Hit] ]] --?? $Atk1.base >= 19 AND $Dmg2.total < [[@{target|Bar3}]] ?? emote|[[ [$PC] 1t[LoSlashing Critical] ]] --?? $Dmg1.total > [[@{target|Bar3}]] ?? emote|[[ [$PC] 1t[LoSlashing Kill] ]] --?? $Dmg1.total > [[@{target|Bar3}]] OR $Dmg2.total > [[@{target|Bar3}]] ?? emote|[[ [$PK] 1t[LoSlashing Kill] ]] }}  Thanks for the help again! :)
Allright.  I know I'm way beyond the anticipated scope of your PowerCards at this point, but I want to create the ultimate attack script, universally applicable to all of my (or your) players.  Does anything stand out to you as to why this stalls after prompting me for the appropriate weapon selection and advantage/disadvantage: !power {{ --name|[[ [$WeaponName] ?{Weapon|@{meleeweaponname1},@{meleeweaponname1}|@{meleeweaponname2},@{meleeweaponname2}|@{meleeweaponname3},@{meleeweaponname3}|@{meleeweaponname4},@{meleeweaponname4}|@{meleeweaponname5},@{meleeweaponname5}|@{meleeweaponname6},@{meleeweaponname6}}} ]] --tokenid|@{selected|token_id} --?? @{selected|token_name} == Arah ?? bgcolor|blue --?? @{selected|token_name} == Bo ?? bgcolor|blue --?? @{selected|token_name} == Theodora ?? bgcolor|red --?? @{selected|token_name} == Lo'Kag ?? bgcolor|red --?? @{selected|token_name} == Bodhi ?? bgcolor|black --?? @{selected|token_name} == Martyn ?? bgcolor|orange --leftsub|Action --rightsub|Melee --?? $WeaponName == @{meleeweaponname1} ?? @{meleeweaponname1} Attack|[[ [$Atk1] ?{Roll|Normal, 1d20r<2|Advantage, 2d20kh1r<2|Disadvantage, 2d20kl1r<2} + @{meleetohit1} ]] vs @{target|token_name}'s [[@{target|bar2}]] AC --?? $WeaponName == @{meleeweaponname1} AND $Atk1.base == 1 OR $Atk1.total < [[@{target|bar2}]] ?? Under AC|You deal no damage --?? $WeaponName == @{meleeweaponname1} AND $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Atk1.base <> 19 ?? Over AC|Deal [[ [$Dmg1] @{meleedmg1} + @{meleeattackstat1} + @{meleemagic1} ]] @{meleedmgtype1} damage --?? $WeaponName == @{meleeweaponname1} AND $Atk1.base >= 19 ?? Critical hit|Deal [[ [$Dmg2] @{meleedmg1} + @{meleedmg1} + @{meleeattackstat1} + @{meleemagic1} ]] [[ [$DmgType] @{meleedmgtype1} ]] damage --?? $WeaponName == @{meleeweaponname2} ?? @{meleeweaponname2} Attack|[[ [$Atk1] ?{Roll|Normal, 1d20r<2|Advantage, 2d20kh1r<2|Disadvantage, 2d20kl1r<2} + @{meleetohit2} ]] vs @{target|token_name}'s [[@{target|bar2}]] AC --?? $WeaponName == @{meleeweaponname2} AND $Atk1.base == 1 OR $Atk1.total < [[@{target|bar2}]] ?? Under AC|You deal no damage --?? $WeaponName == @{meleeweaponname2} AND $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Atk1.base <> 19 ?? Over AC|Deal [[ [$Dmg1] @{meleedmg2} + @{meleeattackstat2} + @{meleemagic2} ]] @{meleedmgtype2} damage --?? $WeaponName == @{meleeweaponname2} AND $Atk1.base >= 19 ?? Critical hit|Deal [[ [$Dmg2] @{meleedmg2} + @{meleedmg2} + @{meleeattackstat2} + @{meleemagic2} ]] [[ [$DmgType] @{meleedmgtype2} ]] damage --?? $WeaponName == @{meleeweaponname3} ?? @{meleeweaponname3} Attack|[[ [$Atk1] ?{Roll|Normal, 1d20r<2|Advantage, 2d20kh1r<2|Disadvantage, 2d20kl1r<2} + @{meleetohit3} ]] vs @{target|token_name}'s [[@{target|bar2}]] AC --?? $WeaponName == @{meleeweaponname3} AND $Atk1.base == 1 OR $Atk1.total < [[@{target|bar2}]] ?? Under AC|You deal no damage --?? $WeaponName == @{meleeweaponname3} AND $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Atk1.base <> 19 ?? Over AC|Deal [[ [$Dmg1] @{meleedmg3} + @{meleeattackstat3} + @{meleemagic3} ]] @{meleedmgtype3} damage --?? $WeaponName == @{meleeweaponname3} AND $Atk1.base >= 19 ?? Critical hit|Deal [[ [$Dmg2] @{meleedmg3} + @{meleedmg3} + @{meleeattackstat3} + @{meleemagic3} ]] [[ [$DmgType] @{meleedmgtype3} ]] damage --?? $WeaponName == @{meleeweaponname4} ?? @{meleeweaponname4} Attack|[[ [$Atk1] ?{Roll|Normal, 1d20r<2|Advantage, 2d20kh1r<2|Disadvantage, 2d20kl1r<2} + @{meleetohit4} ]] vs @{target|token_name}'s [[@{target|bar2}]] AC --?? $WeaponName == @{meleeweaponname4} AND $Atk1.base == 1 OR $Atk1.total < [[@{target|bar2}]] ?? Under AC|You deal no damage --?? $WeaponName == @{meleeweaponname4} AND $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Atk1.base <> 19 ?? Over AC|Deal [[ [$Dmg1] @{meleedmg4} + @{meleeattackstat4} + @{meleemagic4} ]] @{meleedmgtype4} damage --?? $WeaponName == @{meleeweaponname4} AND $Atk1.base >= 19 ?? Critical hit|Deal [[ [$Dmg2] @{meleedmg4} + @{meleedmg4} + @{meleeattackstat4} + @{meleemagic4} ]] [[ [$DmgType] @{meleedmgtype4} ]] damage --?? $WeaponName == @{meleeweaponname5} ?? @{meleeweaponname5} Attack|[[ [$Atk1] ?{Roll|Normal, 1d20r<2|Advantage, 2d20kh1r<2|Disadvantage, 2d20kl1r<2} + @{meleetohit5} ]] vs @{target|token_name}'s [[@{target|bar2}]] AC --?? $WeaponName == @{meleeweaponname5} AND $Atk1.base == 1 OR $Atk1.total < [[@{target|bar2}]] ?? Under AC|You deal no damage --?? $WeaponName == @{meleeweaponname5} AND $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Atk1.base <> 19 ?? Over AC|Deal [[ [$Dmg1] @{meleedmg5} + @{meleeattackstat5} + @{meleemagic5} ]] @{meleedmgtype5} damage --?? $WeaponName == @{meleeweaponname5} AND $Atk1.base >= 19 ?? Critical hit|Deal [[ [$Dmg2] @{meleedmg5} + @{meleedmg5} + @{meleeattackstat5} + @{meleemagic5} ]] [[ [$DmgType] @{meleedmgtype5} ]] damage --?? $WeaponName == @{meleeweaponname6} ?? @{meleeweaponname6} Attack|[[ [$Atk1] ?{Roll|Normal, 1d20r<2|Advantage, 2d20kh1r<2|Disadvantage, 2d20kl1r<2} + @{meleetohit6} ]] vs @{target|token_name}'s [[@{target|bar2}]] AC --?? $WeaponName == @{meleeweaponname6} AND $Atk1.base == 1 OR $Atk1.total < [[@{target|bar2}]] ?? Under AC|You deal no damage --?? $WeaponName == @{meleeweaponname6} AND $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Atk1.base <> 19 ?? Over AC|Deal [[ [$Dmg1] @{meleedmg6} + @{meleeattackstat6} + @{meleemagic6} ]] @{meleedmgtype6} damage --?? $WeaponName == @{meleeweaponname6} AND $Atk1.base >= 19 ?? Critical hit|Deal [[ [$Dmg2] @{meleedmg6} + @{meleedmg6} + @{meleeattackstat6} + @{meleemagic6} ]] [[ [$DmgType] @{meleedmgtype6} ]] damage --?? $DmgType == Bludgeoning AND $Atk1.base == 1 ?? emote|[[ [$PM] 1t[Bludgeoning Miss] ]] --?? $DmgType == Bludgeoning AND $Atk1.total < [[@{target|bar2}]] ?? emote|[[ [$PM] 1t[Bludgeoning Miss] ]] --?? $DmgType == Bludgeoning AND $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Atk1.base <> 19 AND $Dmg1.total < [[@{target|Bar3}]] ?? emote|[[ [$PH] 1t[Bludgeoning Hit] ]] --?? $DmgType == Bludgeoning AND $Atk1.base >= 19 AND $Dmg2.total < [[@{target|Bar3}]] ?? emote|[[ [$PC] 1t[Bludgeoning Critical] ]] --?? $DmgType == Bludgeoning AND $Dmg1.total > [[@{target|Bar3}]] ?? emote|[[ [$PC] 1t[Bludgeoning Kill] ]] --?? $DmgType == Bludgeoning AND $Dmg1.total > [[@{target|Bar3}]] OR $Dmg2.total > [[@{target|Bar3}]] ?? emote|[[ [$PK] 1t[Bludgeoning Kill] ]] --?? $DmgType == Slashing AND $Atk1.base == 1 ?? emote|[[ [$PM] 1t[Slashing Miss] ]] --?? $DmgType == Slashing AND $Atk1.total < [[@{target|bar2}]] ?? emote|[[ [$PM] 1t[Slashing Miss] ]] --?? $DmgType == Slashing AND $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Atk1.base <> 19 AND $Dmg1.total < [[@{target|Bar3}]] ?? emote|[[ [$PH] 1t[Slashing Hit] ]] --?? $DmgType == Slashing AND $Atk1.base >= 19 AND $Dmg2.total < [[@{target|Bar3}]] ?? emote|[[ [$PC] 1t[Slashing Critical] ]] --?? $DmgType == Slashing AND $Dmg1.total > [[@{target|Bar3}]] ?? emote|[[ [$PC] 1t[Slashing Kill] ]] --?? $DmgType == Slashing AND $Dmg1.total > [[@{target|Bar3}]] OR $Dmg2.total > [[@{target|Bar3}]] ?? emote|[[ [$PK] 1t[Slashing Kill] ]] --?? $DmgType == Piercing AND $Atk1.base == 1 ?? emote|[[ [$PM] 1t[Piercing Miss] ]] --?? $DmgType == Piercing AND $Atk1.total < [[@{target|bar2}]] ?? emote|[[ [$PM] 1t[Piercing Miss] ]] --?? $DmgType == Piercing AND $Atk1.total >= [[@{target|bar2}]] AND $Atk1.base <> 1 AND $Atk1.base <> 20 AND $Atk1.base <> 19 AND $Dmg1.total < [[@{target|Bar3}]] ?? emote|[[ [$PH] 1t[Piercing Hit] ]] --?? $DmgType == Piercing AND $Atk1.base >= 19 AND $Dmg2.total < [[@{target|Bar3}]] ?? emote|[[ [$PC] 1t[Piercing Critical] ]] --?? $DmgType == Piercing AND $Dmg1.total > [[@{target|Bar3}]] ?? emote|[[ [$PC] 1t[Piercing Kill] ]] --?? $DmgType == Piercing AND $Dmg1.total > [[@{target|Bar3}]] OR $Dmg2.total > [[@{target|Bar3}]] ?? emote|[[ [$PK] 1t[Piercing Kill] ]] }} I get no errors in the API.  It just sticks with the target selection crosshair and box still up.
I know the $DmgType portion works, because I've tested it independently from the upper portion.  The color selector doesn't function as written, and i've removed it til I get it functioning, but the overall code still stalls at the same spot
After snipping bits of the code apart and trying different stuff, it looks like $WeaponName is causing it to hang, but from what I've done with other scripts, this should be working...
1468952927
Silvyre
Forum Champion
Something like [[ [$DmgType] Slashing ]] is an invalid inline roll; you'll have to tailor your approach.
Is that because it's a string and not an integer?
Patrick said: Is that because it's a string and not an integer? Yeah, that's not a valid inline roll in Roll20. Doesn't have anything to do with Powercards. Roll20 simply doesn't recognize that roll.
1468953320
Silvyre
Forum Champion
Inline Dice Rolls will only accept numbers, inline labels (which Roll IDs make use of), and any other operators/functions used by Roll20 .
So how would you go about assigning a string to a variable?
Not possible.
Blasphemy!
Instead of this  power {{ --name|[[ [$WeaponName] ?{Weapon|@{meleeweaponname1},@{meleeweaponname1}|@{meleeweaponname2},@{meleeweaponname2}|@{meleeweaponname3},@{meleeweaponname3}|@{meleeweaponname4},@{meleeweaponname4}|@{meleeweaponname5},@{meleeweaponname5}|@{meleeweaponname6},@{meleeweaponname6}}} ]] --tokenid|@{selected|token_id} --?? @{selected|token_name} == Arah ?? bgcolor|blue --?? @{selected|token_name} == Bo ?? bgcolor|blue --?? @{selected|token_name} == Theodora ?? bgcolor|red --?? @{selected|token_name} == Lo'Kag ?? bgcolor|red --?? @{selected|token_name} == Bodhi ?? bgcolor|black --?? @{selected|token_name} == Martyn ?? bgcolor|orange --leftsub|Action --rightsub|Melee --?? $WeaponName == @{meleeweaponname1} ?? @{meleeweaponname1} Attack|[[ [$Atk1] ?{Roll|Normal, 1d20r<2|Advantage, 2d20kh1r<2|Disadvantage, 2d20kl1r<2} + @{meleetohit1} ]] vs @{target|token_name}'s [[@{target|bar2}]] AC --?? $WeaponName == @{meleeweaponname1} AND $Atk1.base == 1 OR $Atk1.total < [[@{target|bar2}]] ?? Under AC|You deal no damage couldn't you use something along these lines !power {{ --name|[[ [$WeaponName] ?{@{meleeweaponname?{Number|1,1|2,2|3,3|4,4|5,5|6,6}} ]] --tokenid|@{selected|token_id} --?? @{selected|token_name} == Arah ?? bgcolor|blue --?? @{selected|token_name} == Bo ?? bgcolor|blue --?? @{selected|token_name} == Theodora ?? bgcolor|red --?? @{selected|token_name} == Lo'Kag ?? bgcolor|red --?? @{selected|token_name} == Bodhi ?? bgcolor|black --?? @{selected|token_name} == Martyn ?? bgcolor|orange --leftsub|Action --rightsub|Melee --?? $WeaponName == @{meleeweaponname1} ?? ?{Number} == 1 Attack|[[ [$Atk1] ?{Roll|Normal, 1d20r<2|Advantage, 2d20kh1r<2|Disadvantage, 2d20kl1r<2} + @{meleetohit1} ]] vs @{target|token_name}'s [[@{target|bar2}]] AC
Ah yes, you could do that. The value of a query can be numerical. Thus... [[ [$DmgType] ?{Dmg Type|Slashing, 1|Piercing, 2} ]] would work.
1468962511

Edited 1468963324
That's nearly identical to what I did to get around it, but now it's pulling undefined... !power {{ --name|Melee Attack --tokenid|@{selected|token_id} --bgcolor|Green --leftsub|Action --rightsub|Melee --Weapon|[[ [$WeaponName] ?{Weapon|@{meleeweaponname1},[[1]]|@{meleeweaponname2},[[2]]|@{meleeweaponname3},[[3]]|@{meleeweaponname4},[[4]]|@{meleeweaponname5},[[5]]|@{meleeweaponname6},[[6]]}]] -snipped the rest- }} Using the inquiry in the name field resulted in the title being undefined, so I just made it a generic Melee Attack instead, and placed the specifics in the PC.  The problem is, when I run this: ?{Weapon|@{meleeweaponname1},[[1]]|@{meleeweaponname2},[[2]]|@{meleeweaponname3},[[3]]|@{meleeweaponname4},[[4]]|@{meleeweaponname5},[[5]]|@{meleeweaponname6},[[6]]} in a character sheet macro, it produces the expected number just fine, one through six.  The issue is when I add the variable name to it in this format: [[ [$WeaponName] ?{Weapon|@{meleeweaponname1},[[1]]|@{meleeweaponname2},[[2]]|@{meleeweaponname3},[[3]]|@{meleeweaponname4},[[4]]|@{meleeweaponname5},[[5]]|@{meleeweaponname6},[[6]]}]] it results in a TypeError: Cannot read property 'substring' of undefined error, and therefore won't move on to the next line.  I have no idea what's up with it, heh.
When I dont have 1 through six in brackets, it pulls nothing, so I assume it's trying to pull a string number in that case
Simplifying it down to the bare minimum, like this: !power {{ --name|Melee Attack --tokenid|@{selected|token_id} --bgcolor|Green --leftsub|Action --rightsub|Melee --Weapon|[[ [$WeaponName] ?{Weapon|@{meleeweaponname1},[[1]]|@{meleeweaponname2},[[2]]|@{meleeweaponname3},[[3]]|@{meleeweaponname4},[[4]]|@{meleeweaponname5},[[5]]|@{meleeweaponname6},[[6]]}]] --WeaponName|$WeaponName }} does nothing.  No API error, no chat error, just kills it.
1468963195

Edited 1468963212
Also Sylverlokk, I attempted your method to no avail... !power {{ --name|Melee Attack --tokenid|@{selected|token_id} --bgcolor|Green --leftsub|Action --rightsub|Melee --Weapontest|[[ [$WeaponName] ?{@{meleeweaponname?{Number|1,1|2,2|3,3|4,4|5,5|6,6}} ]] --WeaponName|[[ $WeaponName ]] }} Results in: No attribute was found for @{selected|meleeweaponname?{Number}
1468968085
Silvyre
Forum Champion
Patrick said: [[ [$WeaponName] ?{Weapon|@{meleeweaponname1},[[1]]|@{meleeweaponname2},[[2]]|@{meleeweaponname3},[[3]]|@{meleeweaponname4},[[4]]|@{meleeweaponname5},[[5]]|@{meleeweaponname6},[[6]]}]] In order for Roll IDs to work, the inline roll that they're in needs to contain a dice expression of some form. Adding +0d0 to the end of the inline roll is a typical way to work around this. Patrick said: --WeaponName|$WeaponName Recall a $RollID outside of a conditional using [^RollID]
1468968272
Silvyre
Forum Champion
Patrick said: @{meleeweaponname?{Number}} Nesting a Roll Query within an Attribute call is not possible due to Roll20's Order of Operations .
1468969167

Edited 1468972158
Silvyre
Forum Champion
Patrick said: !power {{ --name|Melee Attack --tokenid|@{selected|token_id} --bgcolor|Green --leftsub|Action --rightsub|Melee --Weapon|[[ [$WeaponName] ?{Weapon|@{meleeweaponname1},[[1]]|@{meleeweaponname2},[[2]]|@{meleeweaponname3},[[3]]|@{meleeweaponname4},[[4]]|@{meleeweaponname5},[[5]]|@{meleeweaponname6},[[6]]}]] -snipped the rest- }} After copying and taking a look at the unsnipped macro you posted earlier, I took the liberty of rewriting it (which should make any further troubleshooting a bit easier. I might have fixed a couple things, too). Moved to GitHub: Rewritten macro Alternate rewrite (using Advanced Usage for Roll Queries )
I thought [[ 20 - @{extendedcrit} ]] wouldn't work within the conditional.
1468969888

Edited 1468969963
Silvyre
Forum Champion
Patrick said: I thought [[ 20 - @{extendedcrit} ]] wouldn't work within the conditional. I haven't tested this particular macro, but if @{extendedcrit} is just a number (0 or 1 it seems?), it should work fine. Inline rolls seem to usually work within conditionals.