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 and conditional statements problem

I created a blank character sheet for neither PC nor NPC and added these Attributes: coin_treasure_1  value: CP| [[5d6]] --SP| [[4d5]] --EP| [[3d6]] --GP| [[3d6]] --PP| [[ 1d2 ]] coin_treasure_2   value: SP| [[4d5]] --EP| [[3d6]] --GP| [[3d6]] --PP| [[ 1d4 ]] coin_treasure_3   value: EP| [[6d6]] --GP| [[3d10]] --PP| [[ 1d8 ]] Using  PowerCards , I created two simple macros utilizing conditional statements within the Abilities area of the sheet. This one works !power {{  --name| @{selected|token_name}'s Punch Attack  --leftsub|Non-lethal dmg 1d4  --rightsub|Range touch  --Attempt|[[ [$Atk] 1d20 + @{strength_save_bonus} ]] vs @{target|token_name}  --?? $Atk <= @{target|AC} AND $Atk.bas <> 20 ?? Hey, @{selected|token_name},|You missed!  --?? $Atk > @{target|AC} ?? Hit for | [[ [$Dmg] 1d4 + @{strength_save_bonus} ]] points damage  --?? $Atk.base == 20 ?? Nat 20 Critical Hit|[[ [$CritDmg]  8 + 1d4 + @{strength_save_bonus} ]]  --?? $Atk > @{target|AC} AND $Atk.base <> 20 ?? api_token-mod|_ids @{target|token_id} _ignore-selected _set bar1_value|-[^Dmg] }}   This one does not !power {{  --name| Pouch 1-4  --leftsub|Treasure  --rightsub|Coins  --Rolled Percent| [[ [$Atk] 1d100 ]]  --?? $Atk >   0 AND $Atk < 31 ?? { @{selected|coin_treasure_1 }  --?? $Atk > 30 AND $Atk < 61 ?? { @{selected|coin_treasure_2 } --?? $Atk  > 60 AND $Atk < 71 ?? { @{selected|coin_treasure_3 } }}   The conditional statements in the first macro work well. The conditional statements in the second macro always default to the last line. The data gathering and display works, but I cannot get  the pre-last-line conditions to intercept. I tried reversing the order – no difference. I tried using $Atk.bas – another no-go. Help? 
Rosco,  I think your syntax and spacing may be a bit off in your last macro. You also have some bracket issues. An attribute call should be @{selected|ATTRIBUTE}. Also, with the way calls are processed by the server, each of your attributes are expanded when submitted. So with the -- in each attribute what the server sees is:  !power {{  --name| Pouch 1-4  --leftsub|Treasure  --rightsub|Coins  --Rolled Percent| [[ [$Atk] 1d100 ]]  --?? $Atk > 0 AND $Atk < 31 ??CP| [[5d6]]  --SP| [[4d5]]  --EP| [[3d6]]  --GP| [[3d6]]  --PP| [[1d2]]  --?? $Atk > 30 AND $Atk < 61 ??SP| [[4d5]]  --EP| [[3d6]]  --GP| [[3d6]]  --PP| [[1d4]]  --?? $Atk  > 60 AND $Atk < 71 ??EP| [[6d6]]  --GP| [[3d10]]  --PP| [[1d8]] }} So your conditionals are evaluating correctly, but you will always see the coins as all are rolled and the last one is displayed.  Change your attributes to: coin_treasure_1   value: CP| [[5d6]] SP [[4d5]] EP [[3d6]] GP [[3d6]] PP [[1d2]] coin_treasure_2   value: SP| [[4d5]] EP [[3d6]] GP [[3d6]] PP [[1d4]] coin_treasure_3   value: EP| [[6d6]] GP [[3d10]] PP [[1d8]] Then try and see if this works: !power {{  --name| Pouch 1-4  --leftsub|Treasure  --rightsub|Coins  --Rolled Percent| [[ [$Atk] 1d100 ]]  --?? $Atk > 0 AND $Atk < 31 ??@{selected|coin_treasure_1}  --?? $Atk > 30 AND $Atk < 61 ??@{selected|coin_treasure_2}  --?? $Atk > 60 AND $Atk < 71 ??@{selected|coin_treasure_3} }}
Lessons learned: 1. Spacing between brackets – don’t. @{ get_something } has to be @{get_something} who’d thunk? 2. @{selected|coin_treasure_1) also works as @{coin_treasure_1} cause I have to select the token to run the macro. Guess it assumes selected. I tested your suggestion: so far so good. It’s good to have all y’all out there looking after each other. And thanks for the straight up answer without the: “Why do you want to do it that way, anyhow.” We all have reasons (good or bad) that are beside the point of the question.   fyi: The reason I put the double-dashes was to stack them vertically rather than horizontally. Going horizontal when the number get larger creates a wrap-around. Doesn’t thwart the info, just makes it ugly. I was hoping there where some HTML code that could be used for line-feed, but there doesn’t seem to be any.   Grateful for your input. It would have been nice if I’d asked before the 5 hours I spent trying to figure it out.
If you want to have the stacked output, you can use some formatting in the attributes to pass to the card to move things onto a new line.  ^^ will add a line break and **TEXT** will make text bold.  coin_treasure_1   value: **CP** [[5d6]] ^^ **SP** [[4d5]] ^^ **EP** [[3d6]] ^^ **GP** [[3d6]] ^^ **PP** [[1d2]] coin_treasure_2   value: **SP** [[4d5]] ^^ **EP** [[3d6]] ^^ **GP** [[3d6]]  ^^ **PP** [[1d4]] coin_treasure_3   value: **EP** [[6d6]] ^^ **GP** [[3d10]] ^^ **PP** [[1d8]]