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 4)

1482211369
Tetsuo
Forum Champion
That did it. Thanks!
1482211813
Tetsuo
Forum Champion
As an aside, when I simply call [^Roll1] and [^Roll2] it returns the values I want to compare. Why is the .base needed?
No clue, it just worked when I tested it...
1482218405
Tetsuo
Forum Champion
Hmm ok. Well thanks anyway!
Franky H. said: I can't get this macro to properly compare conditionals.  !power {{ --name|Attack --roll|[[ [$Roll1] {1d10-1}*10 + [$Roll2] {1d10-1}]] --?? $Roll1 <> $Roll ?? Damage|[^Roll1] --?? $Roll1 == $Roll2 ?? MAX DAMAGE|[[floor(?{skill level}*0.10)]] --?? $Roll2 == 0 ?? Target|Head --?? $Roll2 == 1 ?? Target|Left Chest --?? $Roll2 == 2 ?? Target|Right Chest --?? $Roll2 == 3 ?? Target|Abdomen --?? $Roll2 == 4 ?? Target|Left Arm --?? $Roll2 == 5 ?? Target|Right Arm --?? $Roll2 == 6 ?? Target|Left Hand --?? $Roll2 == 7 ?? Target|Right Hand --?? $Roll2 == 8 ?? Target|Left Leg --?? $Roll2 == 9 ?? Target|Right Leg }} any idea where I went wrong? A couple points... Your macro still isn't going to work properly because you used the same TAG name (Target) on each conditional. You need to use fake tags or same name tags to fix this. FAKE TAG:  !Target0|**Target:** SAME NAME: Target *0|Head Target *1|Left Chest If you use just the roll id in a conditional, it defaults to the Roll1.total value of the entire inline roll. So both Roll1 and Roll2 will have the same value. [^Roll1] only pulls the Roll1.base value by default.
1482244686
Ziechael
Forum Champion
Sheet Author
API Scripter
Ok, my head hurts... I've tried to trouble shoot this myself and I'm still getting "TypeError: Cannot read property '0' of null". Please excuse my likely archaic and messy conditional usage but I've narrowed the error down to this section... what gives?: --hrolls|[[ [$loc] 0d0 + ?{Familiarity?|Very Familiar,0|Studied Carefully,1|Seen Casually,2|Viewed Once,3|False destination,4} ]]-[[ [$hit] 1d100+0d0 ]]-[[ [$mis] 1d20+80 ]] --?? $loc.total == 0 AND $hit.total < 98 ?? !1|On Target --?? $loc.total == 0 AND $hit.total > 97 AND $hit.total < 100 ?? !2|Off Target by [[1d10*1d10]]% of the distance to be travelled in a random direction --?? $loc.total == 0 AND $hit.total == 100 ?? !3|Similar Area - You arrive in a visually or thematically similar place to the target area --?? $loc.total == 1 AND $hit.total < 95 ?? !4|On Target --?? $loc.total == 1 AND $hit.total > 94 AND $hit.total < 98 ?? !5|Off Target by [[1d10*1d10]]% of the distance to be travelled in a random direction --?? $loc.total == 1 AND $hit.total > 97 AND $hit.total < 100 ?? !6|Similar Area - You arrive in a visually or thematically similar place to the target area --?? $loc.total == 1 AND $hit.total == 100 ?? !7|Mishap! Each creature teleported takes [[1d10]] damage, keep rolling Mishaps with damage dealt on each failure. --?? $loc.total == 2 AND $hit.total < 89 ?? !8|On Target --?? $loc.total == 2 AND $hit.total > 88 AND $hit.total < 95 ?? !9|Off Target by [[1d10*1d10]]% of the distance to be travelled in a random direction --?? $loc.total == 2 AND $hit.total > 94 AND $hit.total < 99 ?? !10|Similar Area - You arrive in a visually or thematically similar place to the target area --?? $loc.total == 2 AND $hit.total > 98 ?? !11|Mishap! Each creature teleported takes [[1d10]] damage, keep rolling Mishaps with damage dealt on each failure. --?? $loc.total == 3 AND $hit.total < 77 ?? !12|On Target --?? $loc.total == 3 AND $hit.total > 76 AND $hit.total < 89 ?? !13|Off Target by [[1d10*1d10]]% of the distance to be travelled in a random direction --?? $loc.total == 3 AND $hit.total > 88 AND $hit.total < 97 ?? !14|Similar Area - You arrive in a visually or thematically similar place to the target area --?? $loc.total == 3 AND $hit.total > 96 ?? !15|Mishap! Each creature teleported takes [[1d10]] damage, keep rolling Mishaps with damage dealt on each failure. --?? $loc.total == 4 AND $mis.total < 93 !16|Similar Area - You arrive in a visually or thematically similar place to the target area --?? $loc.total == 4 AND $mis.total > 92 ?? !17|Mishap! Each creature teleported takes [[1d10]] damage, keep rolling Mishaps with damage dealt on each failure. Sorry for the wall of text...
Ziechael said: -- ?? $loc.total == 4 AND $mis.total < 93 !16| This, probably. (No closing ??)
1482250290

Edited 1482250314
Ziechael
Forum Champion
Sheet Author
API Scripter
Silvyre said: Ziechael said: -- ?? $loc.total == 4 AND $mis.total < 93 !16| This, probably. (No closing ??) So simple... told you my head hurt, thanks for the fresh eyes!
I had that problem many times, so I started doing all my conditions as --?? a == b ?? Tag|Content before I did anything else.
1482325035
Ziechael
Forum Champion
Sheet Author
API Scripter
The sad fact is that I tend to do the first one and then copy>paste>amend... and I still bodged it up lol ;)
1482548629

Edited 1482550746
Hello.  I created the following power cards script and I was hoping for some feedback.  In the system I play, PC's roll their attributes individually as a "d60"+10. (A "d60" is a d6 for the tens digit and a d10 as the ones digit).  If the sum of all attributes is less than 275 they are given the rest as "bonus points" to apply to their attributes as they see fit.  I would like to find a way to avoid displaying a negative value if the player rolls extremely well.  Thanks! !power {{ --name|Create a New Agent --format|encounter --leftsub|?{Agent Name} --rightsub|Attribute Rolls --STR| [^Str1.base][^Str2.base]+10 --REF| [^Ref1.base][^Ref2.base]+10 --INT| [^Intl1.base][^Intl2.base]+10 --WIL| [^Wil1.base][^Wil2.base]+10 --CON| [^Con1.base][^Con2.base]+10 --Total Skill Points | You have a total of [[ 275 - ([$totalroll] (([$Str1] { [NH]1d6})*10 + [$Str2] {[NH]1d10-1} + ([$Ref1] {[NH]1d6})*10 + [$Ref2] {[NH]1d10-1} + ([$Intl1] {[NH]1d6})*10 + [$Intl2] {[NH]1d10-1} + ([$Wil1] {[NH]1d6})*10 + [$Wil2] {[NH]1d10-1} + ([$Con1] {[NH]1d6})*10 + [$Con2] {[NH]1d10-1})+50) ]] bonus points to raise your attributes, but no individual attribute may be raised above **70**. --!Note3 | **MOV** and **DEX** will be caclulated based on your final STR, REF, and INT. --!Note2 | **Good luck, Agent ?{Agent Name}** }}
Here's my recommendation, Mike C. : !power {{ --name|Create a New Agent --format|encounter --leftsub|?{Agent Name|007} --rightsub|Attribute Rolls --STR| [^Str] --REF| [^Ref] --INT| [^Intl] --WIL| [^Wil] --CON| [^Con] --?? $points <= 0 ?? !Total Skill Points| Your attributes sum to at least 275, so you do not receive any bonus skill points to raise them. --?? $points >= 1 ?? !Raise Your Attributes| You have a total of [[ [$points|NH] 275 - ([$Str] {d60+10} + [$Ref] {d60+10} + [$Intl] {d60+10} + [$Wil] {d60+10} + [$Con] {d60+10}) ]] bonus points to raise your attributes, but no individual attribute may be raised above **70**. --!Notes| **MOV** and **DEX** will be caclulated based on your final STR, REF, and INT. ^^ ~C **Good luck, Agent ?{Agent Name}.** ~C }}
I learned a lot from your example.  Thanks a bunch, Silvyre!
1482572961
Garrett K.
Marketplace Creator
Can command buttons be placed into the cards?
Yeah.
You'll have to use --whisper|all to add Command Buttons, though
1482644797

Edited 1482644813
Garrett K.
Marketplace Creator
Silvyre said: You'll have to use --whisper|all to add Command Buttons, though Awesome. Got that working. Is there a command to make it whisper the GM and the Player using the Macro? Ideally, I would like players to be able to cast a spell without other players seeing the card. The player themselves, and I, would both see the card however. As it stands I can get whisper|all, all can see; whisper|gm, only I can see (player who used macro can not see card); whisper|@{selected|character_name}, only player can see (I can not see)
Yeah, use --whisper|self, gm instead of --whisper|all. As long as --whisper is being used, the Command Buttons can work.
1482661104
Garrett K.
Marketplace Creator
the comma, that's the key i was missing ;) TY once again Silvyre, you've been my Sage all month.
Haha, you're welcome! Happy rolling!
Yeah, Silvyre probably knows Powercards better than I do.
1482784400

Edited 1482784572
Allrighty guys, I've got another special circumstance here that I'd like to figure out, if possible.  I'm trying to give my players a button that will give a rough estimate of the health of their foes, based on current HP / total HP.  Is this even doable?  I know math doesn't work inside conditionals, but it seems that math also doesn't work when referencing one attribute against another attribute, such as: [[ [$HPchecker] @{target|Target1|hp} / @{target|Target1|hp|max} ]] This results in: Could not determine result type of: [{"type":"L","text":"$HPchecker"},{"type":"M","expr":"52/93"}] ) This was my initial iteration, which failed with the above error: !power {{ --name|Damage Assessment --tokenid|@{selected|token_id} --emote|@{selected|token_name} takes a quick look at @{target|Target1|token_name}, assessing their health. --Calculator(ignore me)|[[ [$HPchecker] @{target|Target1|hp}/@{target|Target1|hp|max}]] --?? [$HPchecker.total] < .1 Status|Near Death --?? [$HPchecker.total] > .1 AND [$HPchecker.total] < .3 ?? Status|Gravely Wounded --?? [$HPchecker.total] > .3 AND [$HPchecker.total] < .5 ?? Status|Severely Wounded --?? [$HPchecker.total] > .5 AND [$HPchecker.total] < .7 ?? Status|Moderately Wounded --?? [$HPchecker.total] > .7 AND [$HPchecker.total] < .9 ?? Status|Mildly Wounded --?? [$HPchecker.total] > .9 ?? Status|Healthy }}
1482787139

Edited 1482787710
This should work: !power {{ --name|Damage Assessment --tokenid|@{selected|token_id} --emote|@{selected|token_name} takes a quick look at @{target|Target1|token_name}, assessing their health. --hroll|[[ [$HPchecker] @{target|Target1|hp}/@{target|Target1|hp|max} * 100 + 0d0]] --?? $HPchecker < 10 ?? Status|Near Death --?? $HPchecker >= 10 AND $HPchecker < 30 ?? Status|Gravely Wounded --?? $HPchecker >= 30 AND $HPchecker < 50 ?? Status|Severely Wounded --?? $HPchecker >= 50 AND $HPchecker < 70 ?? Status|Moderately Wounded --?? $HPchecker >= 70 AND $HPchecker < 90 ?? Status|Mildly Wounded --?? $HPchecker >= 90 ?? Status|Healthy }} Missed a closing ?? in the Near Death tag Conditionals sometimes don't play nice with non-integers Don't include the square bracket (inline label) syntax in conditional tags (.total is redundant/deprecated, so I removed it, too) Add 0d0 when defining purely-numerical Roll IDs without dice rolls in the inline rolls It's best practice to ensure that no two tags have the same name (e.g. Status). However, since only one can display at a time, you can get away with not renaming them to Status *1, Status *2, etc.
Hi friends.  I'm not sure this is possible, but I'd like to nest tags within a dropdown option.  Basically I'd like to have a single macro for my players to do any attribute check, though I'm not sure how to pass the attribute name AND attribute level in the same option.  (This system uses full stat, 1/2 stat, and 1/4 stat for various circumstances.)  I'm able to get this to work in roll templates (see below), but I'd like to have a power-card for this if it is possible.  (If its not, an answer will save me some more head-scratching.)   Thanks in advance. Below is the roll-template for what I am trying to do in power-cards. &{template:default} ?{Action| STR , {{Saving Throw= vs Strength}} {{name=Strength Check}} {{Roll= [[ 1d100cs100cs01cs02cs02cs04cf99cf98cf97cf96cf95 ]]}} {{Full STR:= [[ @{selected|str} ]] }} {{1/2 STR:=[[ ceil(@{selected|str}*.5) ]]}} {{1/4 STR:=[[ceil(@{selected|str}*.25)]] }} | REF , {{Saving Throw= vs Reflex}} {{name=Reflex Check}} {{Roll= [[ 1d100cs100cs01cs02cs02cs04cf99cf98cf97cf96cf95 ]]}} {{Full STR:= [[ @{selected|ref} ]] }} {{1/2 REF:=[[ ceil(@{selected|ref}*.5) ]]}} {{1/4 REF:=[[ceil(@{selected|ref}*.25)]] }} | INT , {{Saving Throw= vs Intelligence}} {{name=Intelligence Check}} {{Roll= [[ 1d100cs100cs01cs02cs02cs04cf99cf98cf97cf96cf95 ]]}} {{Full INT:= [[ @{selected|int} ]] }} {{1/2 INT:=[[ ceil(@{selected|int}*.5) ]]}} {{1/4 INT:=[[ceil(@{selected|int}*.25)]] }} | WIL , {{Saving Throw= vs Willpower}} {{name=Willpower Check}} {{Roll= [[ 1d100cs100cs01cs02cs02cs04cf99cf98cf97cf96cf95 ]]}} {{Full WIL:= [[ @{selected|wil} ]] }} {{1/2 WIL:=[[ ceil(@{selected|wil}*.5) ]]}} {{1/4 WIL:=[[ceil(@{selected|wil}*.25)]] }} | CON , {{Saving Throw= vs Constitution}} {{name=Constitution Check}} {{Roll= [[ 1d100cs100cs01cs02cs02cs04cf99cf98cf97cf96cf95 ]]}} {{Full CON:= [[ @{selected|con} ]] }} {{1/2 CON:=[[ ceil(@{selected|con}*.5) ]]}} {{1/4 STR:=[[ceil(@{selected|con}*.25)]] }} | MOV , {{Saving Throw= vs Movement}} {{name=Strength Check}} {{Roll= [[ 1d100cs100cs01cs02cs02cs04cf99cf98cf97cf96cf95 ]]}} {{Full MOV:= [[ @{selected|str} ]] }} {{1/2 MOV:=[[ ceil(@{selected|str}*.5) ]]}} {{1/4 MOV:=[[ceil(@{selected|str}*.25)]] }} | DEX , {{Saving Throw= vs Dexterity}} {{name=Dexterity Check}} {{Roll= [[ 1d100cs100cs01cs02cs02cs04cf99cf98cf97cf96cf95 ]]}} {{Full DEX:= [[ @{selected|dex} ]] }} {{1/2 DEX:=[[ ceil(@{selected|dex}*.5) ]]}} {{1/4 DEX:=[[ceil(@{selected|dex}*.25)]] }} }
Nevermind, I totally figured it out.  :-)
1482805154

Edited 1482805473
Glad you figured it out! In case you're interested, here's another possibility: &{template:default} {{Saving Throw= vs ?{Action|STR, [Strength] (@{selected|STR})|REF, [Reflex] (@{selected|REF})|INT, [Intelligence] (@{selected|INT})|WIL, [Willpower] (@{selected|WIL})|CON, [Constitution] (@{selected|CON})|MOV, [Movement] (@{selected|MOV})|DEX, [Dexterity] (@{selected|DEX})} }} {{name=Ability Check }} {{Roll= [[ 1d100cs100cs<4cf>95 ]] }} {{1/2 ?{Action}:= [[ ceil([[@{selected|str} + 0d0]] / 2) ]] }} {{1/4 ?{Action}:= [[ ceil([[@{selected|str} + 0d0]] / 4) ]] }} !power {{ --leftsub|Ability Check --name|Saving Throw vs ?{Action|STR, [Strength] (@{selected|STR})|REF, [Reflex] (@{selected|REF})|INT, [Intelligence] (@{selected|INT})|WIL, [Willpower] (@{selected|WIL})|CON, [Constitution] (@{selected|CON})|MOV, [Movement] (@{selected|MOV})|DEX, [Dexterity] (@{selected|DEX})} --Roll| [[ 1d100cs100cs<4cf>95 ]] --1/2 ?{Action}:| [[ ceil([[@{selected|str} + 0d0]] / 2) ]] --1/4 ?{Action}:| [[ ceil([[@{selected|str} + 0d0]] / 4) ]] }}
Thanks as usual Silvyre, however, when I ran it, it returned: SyntaxError: Expected "(", ".", "[", "abs(", "ceil(", "d", "floor(", "round(", "t", "{", [ |\t], [+|\-] or [0-9] but "/" found.
Nevermind.  The character hadn't fully loaded yet.  Works fine.  Thanks again :)
Thanks again, Silvyre.  I always learn something from your examples.
Allrighty guys, new question.  Can I do this and use $DmgTotal as the sum of $Dmg1 and $Dmg2 as a different conditional later in the script? --?? $Atk1.base >= [[ 20 - @{extendedcrit} ]] ?? hroll|[[ [$DmgTotal] [$Dmg1] + [$Dmg2] + 0d0 ]]
This is the workaround we have: !power {{ --hroll|[[ [$DmgTotal] [$Dmg1] {1d8} + [$Dmg2] {1d6} ]] --Atk1|[[ 1d20cs>[[20 - @{extendedcrit}]] ]] --Dmg1|[^Dmg1] or [! [^Dmg1] !] --Dmg2|[^Dmg2] or [! [^Dmg2] !] --?? $Atk1.base >= [[ 20 - @{extendedcrit} ]] ?? DmgTotal|[^DmgTotal] or [! [$DmgTotal] !] }}
Hey guys, Need some help figuring out how to write out a roll. Here is the roll format that I'm trying to use: {(3+4+2)d10s}>6f1, this works just fine on its own. However when I try to format it in a PowerCard, I can't figure it out. Here is the code I'm trying to use: !power {{ --charid|@{character_id} --emote|**@{selected|token_name}** makes a roll! --name|Initiative --Action|**@{selected|token_name}** rolls for Initiative! --Init Roll|~R [NH|TRKR] {(@Wits + @Athletics + ?{Pool Mod|0})d10s}>4f1~R }} As you can see in the code the first two integers reference to Attributes the third can be modified by other circumstances and they have a floor of 4, meaning that anything higher than 4 is a success. When I try to run the code I get the error "TypeError: Cannot read property 'substring' of undefined". Any help would be appreciated. Thanks
Your Attribute calls are missing curly braces and your 'inline roll' is missing square brackets.
1483048035

Edited 1483048183
Silvyre said: Your Attribute calls are missing curly braces and your 'inline roll' is missing square brackets. Ok, DUH! on the Attributes. I don't want it to be an inline roll. Then I won't be able to see the number of successes that I get from the ">4f1" part of the roll. Edit:  I just tried with square brackets: --Init Roll|~R[[ [NH|TRKR] {(@{Wits} + @{Athletics} + ?{Pool Mod|0})d10s}>4f1]]~R And still got the same error.
Post the full macro you're using, now.
Silvyre said: Post the full macro you're using, now. !power {{ --charid|@{character_id} --emote|**@{selected|token_name}** makes a roll! --name|Initiative --Action|**@{selected|token_name}** rolls for Initiative! --Init Roll|~R[[ [NH|TRKR] {(@{Wits} + @{Athletics} + ?{Pool Mod|0})d10s}>4f1]]~R }}
I would update PowerCards. Also, what does the Text Chat return when you enter @{selected|Wits} + @{selected|Athletics}?
1483051438

Edited 1483051633
Silvyre said: I would update PowerCards. Also, what does the Text Chat return when you enter @{selected|Wits} + @{selected|Athletics}? Same error. Updating PowerCards now. Edit:  Updated PowerCards, same error still.
What does the Text Chat return when you enter @{selected|Wits} + @{selected|Athletics}?
Silvyre said: What does the Text Chat return when you enter @{selected|Wits} + @{selected|Athletics}? 2 + 4
!power {{ --tokenid|@{selected|token_id} --emote|**@{selected|token_name}** makes a roll! --name|Initiative --Action|**@{selected|token_name}** rolls for Initiative! --Init Roll|~R[[ [NH|TRKR] {(@{selected|Wits} + @{selected|Athletics} + ?{Pool Mod|0})d10s}>4f1 ]]~R }} Does this work?
Silvyre said: !power {{ --tokenid|@{selected|token_id} --emote|**@{selected|token_name}** makes a roll! --name|Initiative --Action|**@{selected|token_name}** rolls for Initiative! --Init Roll|~R[[ [NH|TRKR] {(@{selected|Wits} + @{selected|Athletics} + ?{Pool Mod|0})d10s}>4f1 ]]~R }} Does this work? That worked perfectly. Thanks for your help.
Attribute calls (e.g. @{AC}) that are not placed within one of tabs of a Character Window (e.g. within a field on the Character Sheet Tab or within an Ability on the Attributes & Abilities Tab ) must use a keyword to let the parser know which Character you intend to call that Attribute from (e.g. @{selected|AC}). Using a Selected Token with a Macro Using a Targeted Token with a Macro
Silvyre said: Attribute calls (e.g. @{AC}) that are not placed within one of tabs of a Character Window (e.g. within a field on the Character Sheet Tab or within an Ability on the Attributes & Abilities Tab ) must use a keyword to let the parser know which Character you intend to call that Attribute from (e.g. @{selected|AC}). Using a Selected Token with a Macro Using a Targeted Token with a Macro Got it Silvyre, thanks. It's been too long since I've messed with creating new PowerCards. Simple mistakes.
1483058495

Edited 1483058713
Silvyre said: !power {{ --tokenid|@{selected|token_id} --emote|**@{selected|token_name}** makes a roll! --name|Initiative --Action|**@{selected|token_name}** rolls for Initiative! --Init Roll|~R[[ [NH|TRKR] {(@{selected|Wits} + @{selected|Athletics} + ?{Pool Mod|0})d10s}>4f1 ]]~R }} Does this work? Is there a way to get it to show the actual rolls that were made? Without hovering over the output? Edit:  Nevermind, figured it out. Use XPND.
1483058868

Edited 1483058923
[XPND] - This inline roll option expands the roll into the full formula/expression instead of just the result. [[1d20 + @{Dex Mod}]] becomes [(18) + 3 = 21] instead of [21] Minor Update: Added RPND which is a reverse of XPND. [[ [rpnd] 1d20 + 4 ]] will show up as Total = Roll + Mods (YAGKR... =^_^= ) Otherwise, you could use [^RollID.base] Update: Added an option to display number of successes or test against number of successes using Conditionals. [^RollID.ss] will display the number of successes from that roll. [^RollID.base] is always a sum of all the rolls, no modifiers. Base has nothing to do with successes at all. [^RollID.total] is always a sum of the successes of all rolls in the inline roll, not just the RollID used. So if you use multiple roll ID's in the same inline roll as below, it will always be the total result of all the rolls. The use of .ss is to break out successes from individual rolls within a multi-roll inline roll like this: [[ [$R1] 3d6>3 + [$R2] 3d6>3 ]]. The use of ^R1.ss will only show the successes from the first roll.
Ok, another problem. --Init Roll|~R[[ [NH|TRKR] {(@{selected|Dexterity} + @{selected|Melee} + ?{Pool Mod|0})d10s}>?{Difficulty|4}f1 ]]~R }} Is there a way to write this code that would automatically add 1 to the difficulty ">?{Difficulty|4}f1"?
Replace ?{Difficulty|4} with [[1 + ?{Difficulty|4}]]
Silvyre said: Replace ?{Difficulty|4} with [[1 + ?{Difficulty|4}]] That didn't work, it just stops the script and won't produce an output at all, not even an error.
Post the full macro.