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

Powercards code check

1600977328

Edited 1600978627
Hello, I am new to powercards and am having some issues. I will post the code below. Can you point out errors in my syntax. Thanks !power {{ --Skill:|[[ ?{SKILL|0} ]] --hroll | [[ [$Main] 1d100 ]] [[ [$FB] 1d100]] [[ [$SB] 1d100]] --MainRoll | [^Main] B/P1 [^FB] B/P2 [^SB]  --?? $Main.base <= ?{SKILL} / 5 OR $FB.base <= ?{SKILL} / 5 OR $SB.base <= ?{SKILL} / 5 ?? +2 |Critical --?+ $Main.base <= ?{SKILL} / 2 OR $FB.base <= ?{SKILL} / 2 OR $SB.base <= ?{SKILL} / 2 ?? +2 |Hard --?+ $Main.base <= ?{SKILL} OR $FB.base <= ?{SKILL} OR $SB.base <= ?{SKILL} ?? +2 |Success  }}
1600984750
Kurt J.
Pro
API Scripter
Anish H. said: Hello, I am new to powercards and am having some issues. I will post the code below. Can you point out errors in my syntax. Thanks !power {{ --Skill:|[[ ?{SKILL|0} ]] --hroll | [[ [$Main] 1d100 ]] [[ [$FB] 1d100]] [[ [$SB] 1d100]] --MainRoll | [^Main] B/P1 [^FB] B/P2 [^SB]  --?? $Main.base <= ?{SKILL} / 5 OR $FB.base <= ?{SKILL} / 5 OR $SB.base <= ?{SKILL} / 5 ?? +2 |Critical --?+ $Main.base <= ?{SKILL} / 2 OR $FB.base <= ?{SKILL} / 2 OR $SB.base <= ?{SKILL} / 2 ?? +2 |Hard --?+ $Main.base <= ?{SKILL} OR $FB.base <= ?{SKILL} OR $SB.base <= ?{SKILL} ?? +2 |Success  }} Standard conditionals (??..?? and ?+..+?) won't be able to handle the ?{SKILL}/5 (also, the spaces (?{SKILL} / 5) will confuse the expression parser. Expanded Conditionals (?!..!? and ?-..-?) can do the math, but they use a slightly different syntax to protect from certain malicious things that could be done if it didn't. This card should do what you are looking for (I've I'm reading the above correctly) !power {{ --Skill:|[[ ?{SKILL|0} ]] --hroll | [[ [$Main] 1d100 ]] [[ [$FB] 1d100]] [[ [$SB] 1d100]] --MainRoll | [^Main] B/P1 [^FB] B/P2 [^SB] --?! $Main.base -le ?{SKILL}/5 -or $FB.base -le ?{SKILL}/5 -or $SB.base -le ?{SKILL}/5 !? +2 *1 |Critical --?- $Main.base -le ?{SKILL}/2 -or $FB.base -le ?{SKILL}/2 -or $SB.base -le ?{SKILL}/2 -? +2 *2 |Hard --?- $Main.base -le ?{SKILL} -or $FB.base -le ?{SKILL} -or $SB.base -le ?{SKILL} -? +2 *3 |Success }} Essentially, just replacing the standard conditionals with expanded conditionals, the <= with -le, OR with -or, and removing the spaces in the ?{SKILL}/5 entries. The only other issue I saw was that the tag names (+2 in each case) need to be unique, so I added the *1, *2, and *3.
Thanks so much, That did it.  Another question, how can you roll a die 0-9? Kurt J. said: Anish H. said: Hello, I am new to powercards and am having some issues. I will post the code below. Can you point out errors in my syntax. Thanks !power {{ --Skill:|[[ ?{SKILL|0} ]] --hroll | [[ [$Main] 1d100 ]] [[ [$FB] 1d100]] [[ [$SB] 1d100]] --MainRoll | [^Main] B/P1 [^FB] B/P2 [^SB]  --?? $Main.base <= ?{SKILL} / 5 OR $FB.base <= ?{SKILL} / 5 OR $SB.base <= ?{SKILL} / 5 ?? +2 |Critical --?+ $Main.base <= ?{SKILL} / 2 OR $FB.base <= ?{SKILL} / 2 OR $SB.base <= ?{SKILL} / 2 ?? +2 |Hard --?+ $Main.base <= ?{SKILL} OR $FB.base <= ?{SKILL} OR $SB.base <= ?{SKILL} ?? +2 |Success  }} Standard conditionals (??..?? and ?+..+?) won't be able to handle the ?{SKILL}/5 (also, the spaces (?{SKILL} / 5) will confuse the expression parser. Expanded Conditionals (?!..!? and ?-..-?) can do the math, but they use a slightly different syntax to protect from certain malicious things that could be done if it didn't. This card should do what you are looking for (I've I'm reading the above correctly) !power {{ --Skill:|[[ ?{SKILL|0} ]] --hroll | [[ [$Main] 1d100 ]] [[ [$FB] 1d100]] [[ [$SB] 1d100]] --MainRoll | [^Main] B/P1 [^FB] B/P2 [^SB] --?! $Main.base -le ?{SKILL}/5 -or $FB.base -le ?{SKILL}/5 -or $SB.base -le ?{SKILL}/5 !? +2 *1 |Critical --?- $Main.base -le ?{SKILL}/2 -or $FB.base -le ?{SKILL}/2 -or $SB.base -le ?{SKILL}/2 -? +2 *2 |Hard --?- $Main.base -le ?{SKILL} -or $FB.base -le ?{SKILL} -or $SB.base -le ?{SKILL} -? +2 *3 |Success }} Essentially, just replacing the standard conditionals with expanded conditionals, the <= with -le, OR with -or, and removing the spaces in the ?{SKILL}/5 entries. The only other issue I saw was that the tag names (+2 in each case) need to be unique, so I added the *1, *2, and *3.
1601133438
Kurt J.
Pro
API Scripter
Anish H. said: Thanks so much, That did it.  Another question, how can you roll a die 0-9? I don't think Roll20 has that ability integrated into the dice rolling system, but you could simulate it like this: Inline Roll: [[ (1d10 % 10) ]] /Roll command: /roll (1d10 % 10) There is a drawback in that you can't roll more than one die this way via Xd10. You would need to add them together as separate rolls: [[ (1d10 %10) + (1d10 %10) + (1d10 %10) ]] for example if you needed 3d10 with 10's counting as zeros. In "what-its-doing" terms, the % operator gives you the remainder of dividing the left part (1d10) by the right part (10), so 1 thru 9 the remainder is just 1 thru 9. For 10, it divides evenly so the remainder is 0.
1601143163
David M.
Pro
API Scripter
[[1d10-1]] should give 0-9 Or for multiple dice [[?{Num Dice|1}d10 - ?{Num Dice}]]