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

Kurt J. said:

Carl F. said:

Still banging my head on the --api_ tag  I have stripped it down to the bare bones.  I am on the ribboned page trying two different api's as the syntax is different for both.  Tracker jacker and token mod.  I get the powercard header and no out put after that.

!power {{
--name|API Test
--leftsub|PC selected
--rightsub|place marker
--api_tj| -listfavs
--api_token-mod|_ids @{selected|token_id} _ignore-selected _set statusmarkers|!stopwatch
}}


any assistance would be appreciated.  the goal is to place a marker if the PC is knocked pron on a hit.

Ah! I'll bet I know what is wrong, at least on the token-mod (I've never used Tracker Jacker). Did you set Token-Mod to allow non-GMs (and PowerCards usually run as non-GMs) to use the --ids command? The command is:

!token-mod --config players-can-ids

Which will toggle the option on or off. It needs to be on for --api_token-mod to work with the _ids option.

nope, no difference.  and i reset the sandbox to make sure.

crap, must be script interference.  I fired up a blank game they a map and PC in it with the bare number of api's loaded and it worked fine.  Once i toggled players can ID.  Thanks, I will have to figure out what is causing it

June 10 (6 years ago)
Ravenknight
KS Backer
Hi guys, having a problem with the macro below. 

When a character roll a 20 I get the output of both Failure and Critical Success - can somebody help me and tell me what's wrong?

!power {{
--emote|@{target|token_name} tries to break down a door.
--tokenid|@{target|token_id}
--format|atwill
--hroll|[[ [$Atk] ?{Tools?| No, 1d20+@{target|strength_mod} | Crowbar, 2d20KH1+@{target|strength_mod} | Portable Ram (alone), 1d20+@{target|strength_mod}+4 | Portable Ram (with aid), 2d20KH1+@{target|strength_mod}+4  } ]]
--?? $Atk.base == 1 OR $Atk.total < [[@{selected|bar1|Max}+5]]?? !Failure:|$$#ff0000|**Door remain closed**$$ 
--?? $Atk.total >= [[@{selected|bar1|Max}+5]] AND $Atk.base > 1 AND $Atk.base < 20 ?? !Success:|**Door is opened!**
--?? $Atk.base == 20 ?? !Critical Success:|**You manage to open the door without destroying it!**
--DC to notice break-in?|**[[ {[[ [NH] 1d20+@{target|stealth_bonus}-5]],[[5]]}kh1 ]]**
}}


June 10 (6 years ago)

Edited June 10 (6 years ago)
Kurt J.
Pro
API Scripter

Ravenknight said:

Hi guys, having a problem with the macro below. 

When a character roll a 20 I get the output of both Failure and Critical Success - can somebody help me and tell me what's wrong?



I tried this out by creating an NPC with a +4 strength bonus and setting the @{selected|bar1|max} value to anything above 19. It is happening because the conditionals for both the failure and the critical success are true.

If a character with a +4 strength bonus rolls a 20 on a 1d20, the result is 24. Taking the first line:

--?? $Atk.base == 1 OR $Atk.total < [[@{selected|bar1|Max}+5]]?? !Failure:|$$#ff0000|**Door remain closed**$$

The base is 20, so it isn't 1. The total is 24, which IS less than 25, so the failure line is displayed. Then the critical line comes along, and the base is 20, so it gets displayed as well... essentially both conditions are true, so both lines get displayed.

I would suggest the following:

--?? $Atk.base == 1 ?? !Critical Failure:|$$#ff0000|**Door remain closed**$$ 
--?? $Atk.base <> 1 AND $Atk.base <> 20 AND $Atk.total < [[@{selected|bar1|Max}+5]] ?? !Failure:|$$#ff0000|**Door remain closed**$$ 
--?? $Atk.total >= [[@{selected|bar1|Max}+5]] AND $Atk.base > 1 AND $Atk.base < 20 ?? !Success:|**Door is opened!**
--?? $Atk.base == 20 ?? !Critical Success:|**You manage to open the door without destroying it!**

By splitting the case where the player rolls a 1 onto its own line, we can use all AND conditions in the failure check to make sure we don't display it if a 20 is rolled as well.
June 10 (6 years ago)
Ravenknight
KS Backer
Thanks Kurt! I really appreciate it.
I knew it was something obvious but I just couldn't see it. :D

Carl F. said:

Kurt J. said:

Carl F. said:

Still banging my head on the --api_ tag  I have stripped it down to the bare bones.  I am on the ribboned page trying two different api's as the syntax is different for both.  Tracker jacker and token mod.  I get the powercard header and no out put after that.

!power {{
--name|API Test
--leftsub|PC selected
--rightsub|place marker
--api_tj| -listfavs
--api_token-mod|_ids @{selected|token_id} _ignore-selected _set statusmarkers|!stopwatch
}}


any assistance would be appreciated.  the goal is to place a marker if the PC is knocked pron on a hit.

Ah! I'll bet I know what is wrong, at least on the token-mod (I've never used Tracker Jacker). Did you set Token-Mod to allow non-GMs (and PowerCards usually run as non-GMs) to use the --ids command? The command is:

!token-mod --config players-can-ids

Which will toggle the option on or off. It needs to be on for --api_token-mod to work with the _ids option.

nope, no difference.  and i reset the sandbox to make sure.

crap, must be script interference.  I fired up a blank game they a map and PC in it with the bare number of api's loaded and it worked fine.  Once i toggled players can ID.  Thanks, I will have to figure out what is causing it


Just an FYI to this issue.  it was a corrupt character token.  Once recreated it was fine.  Thanks for your patience.
June 13 (6 years ago)
Kurt J.
Pro
API Scripter
Version 3.7.6 is now up on OneClick Install. I've updated the Wiki to reflect updates since 3.7.2.

I'm planning on spending some time revising the Wiki page, especially if I can figure out how to get authorized to upload images.
June 13 (6 years ago)
Ziechael
Forum Champion
Sheet Author
API Scripter

Kurt J. said:


I'm planning on spending some time revising the Wiki page, especially if I can figure out how to get authorized to upload images.

Send an email to team@roll20.net requesting image upload access and stating your case :)
Hey Guys, I wonder if i can get some help with the charid.
I am trying to make a speak macro where I can see on chat iwch player speak and their avatar on it.

When i add the --charid|-LEsmyhkFSrke4Noypaq is not showing the character avatar. Am i doing something wrong?
ok, I am kind of stumped here.  I do not know if this is a Powercards thing or an alterbar thing.
I have created a powercard for guiding bolt attack.  Macro is as follows:

!power {{
--titlefontshadow|none
--emote|** @{selected|token_name} Cast the spell - Guiding Bolt. **
--tokenid|@{selected|token_id}
--format|atwill
--corners|10
--name|Guiding Bolt
--leftsub|Ranged Attack
--rightsub|Spell
--Range| 120'
--Attack|[[ [$Atk] ?{Advantage?| Normal, 1d20 + [[@{selected|wisdom_mod}]] [WIS] + [[@{selected|pb}]] [PROF]] | Advantage, 2d20KH1 + [[@{selected|wisdom_mod}]] [INT] + [[@{selected|pb}]] [PROF]] | Disadvantage, 2d20KL1 + [[@{selected|wisdom_mod}]] [INT] + [[@{selected|pb}]] [PROF]]} ]] vs **AC** [[@{target||npc_ac}]]
--Spell Level|[[ [$Lvl] ?{Level?| Level 1, 1d1 | Level 2, 2d1 | Level 3, 3d1} ]]
--?? $Atk < @{target||npc_ac} ?? !Missed|**You missed!*
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 AND $Lvl == 1 ?? Hit:|[[ [$Dam] 4d6 ]] radiant damage
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 AND $Lvl == 2 ?? Hit:|[[ [$Dam] 5d6 ]] radiant damage
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 AND $Lvl == 3 ?? Hit:|[[ [$Dam] 6d6 ]] radiant damage
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 ?? alterbar1|_target|@{target||token_id} _bar|1 _amount|-[^Dam] _show|all
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 ?? vfx_opt|@{target||token_id} burst-magic
--?? $Atk.base == 20 AND $Lvl == 1 ?? Critical Hit:|[[ [$CritDmg] 8d6 ]] radiant damage
--?? $Atk.base == 20 AND $Lvl == 2 ?? Critical Hit:|[[ [$CritDmg] 10d6 ]] radiant damage
--?? $Atk.base == 20 AND $Lvl == 3 ?? Critical Hit:|[[ [$CritDmg] 12d6 ]] radiant damage
--?? $Atk.base == 20 ?? vfx_opt|@{target||token_id} burst-magic
--?? $Atk.base == 1 ?? !|**Fumble:**
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 ?? alterbar3|_target|@{selected|token_id} _bar|1 _amount| [^Dmg]/2 _show|all
--?? $Atk == 20 ?? alterbar4|_target|@{selected|token_id} _bar|1 _amount| [^CritDmg]/2 _show|all
}}


So far the attack roll, selecting advantage/disadvantage/normal, and spell level are working fine.  The damage roll according to spell level rolls the correct number of die.  However The damage rolled and what alterbars deals the token are different.  Screenshot below:



Any assistance is appreciated and needed.  Thanks
June 17 (6 years ago)

Edited June 17 (6 years ago)

Carl F. said:

ok, I am kind of stumped here.  I do not know if this is a Powercards thing or an alterbar thing.
I have created a powercard for guiding bolt attack.  Macro is as follows:

!power {{
--titlefontshadow|none
--emote|** @{selected|token_name} Cast the spell - Guiding Bolt. **
--tokenid|@{selected|token_id}
--format|atwill
--corners|10
--name|Guiding Bolt
--leftsub|Ranged Attack
--rightsub|Spell
--Range| 120'
--Attack|[[ [$Atk] ?{Advantage?| Normal, 1d20 + [[@{selected|wisdom_mod}]] [WIS] + [[@{selected|pb}]] [PROF]] | Advantage, 2d20KH1 + [[@{selected|wisdom_mod}]] [INT] + [[@{selected|pb}]] [PROF]] | Disadvantage, 2d20KL1 + [[@{selected|wisdom_mod}]] [INT] + [[@{selected|pb}]] [PROF]]} ]] vs **AC** [[@{target||npc_ac}]]
--Spell Level|[[ [$Lvl] ?{Level?| Level 1, 1d1 | Level 2, 2d1 | Level 3, 3d1} ]]
--?? $Atk < @{target||npc_ac} ?? !Missed|**You missed!*
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 AND $Lvl == 1 ?? Hit:|[[ [$Dam] 4d6 ]] radiant damage
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 AND $Lvl == 2 ?? Hit:|[[ [$Dam] 5d6 ]] radiant damage
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 AND $Lvl == 3 ?? Hit:|[[ [$Dam] 6d6 ]] radiant damage
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 ?? alterbar1|_target|@{target||token_id} _bar|1 _amount|-[^Dam] _show|all
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 ?? vfx_opt|@{target||token_id} burst-magic
--?? $Atk.base == 20 AND $Lvl == 1 ?? Critical Hit:|[[ [$CritDmg] 8d6 ]] radiant damage
--?? $Atk.base == 20 AND $Lvl == 2 ?? Critical Hit:|[[ [$CritDmg] 10d6 ]] radiant damage
--?? $Atk.base == 20 AND $Lvl == 3 ?? Critical Hit:|[[ [$CritDmg] 12d6 ]] radiant damage
--?? $Atk.base == 20 ?? vfx_opt|@{target||token_id} burst-magic
--?? $Atk.base == 1 ?? !|**Fumble:**
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 ?? alterbar3|_target|@{selected|token_id} _bar|1 _amount| [^Dmg]/2 _show|all
--?? $Atk == 20 ?? alterbar4|_target|@{selected|token_id} _bar|1 _amount| [^CritDmg]/2 _show|all
}}


So far the attack roll, selecting advantage/disadvantage/normal, and spell level are working fine.  The damage roll according to spell level rolls the correct number of die.  However The damage rolled and what alterbars deals the token are different.  Screenshot below:



Any assistance is appreciated and needed.  Thanks

OK, i found a reference in the forums that states that alterbars has an issue with multiple rolls with the same variable name.  alterbars will always take the last roll.  To get past this I roll different damage with different variable names, then apply alterbars damage.  Corrected macro is as follows:

!power {{
--titlefontshadow|none
--emote|** @{selected|token_name} Cast the spell - Guiding Bolt. **
--tokenid|@{selected|token_id}
--format|atwill
--corners|10
--name|Guiding Bolt
--leftsub|Ranged Attack
--rightsub|Spell
--Range| 120'
--Attack|[[ [$Atk] ?{Advantage?| Normal, 1d20 + [[@{selected|wisdom_mod}]] [WIS] + [[@{selected|pb}]] [PROF]] | Advantage, 2d20KH1 + [[@{selected|wisdom_mod}]] [INT] + [[@{selected|pb}]] [PROF]] | Disadvantage, 2d20KL1 + [[@{selected|wisdom_mod}]] [INT] + [[@{selected|pb}]] [PROF]]} ]] vs **AC** [[@{target||npc_ac}]]
--Spell Level|[[ [$Lvl] ?{Level?| Level 1, 1d1 | Level 2, 2d1 | Level 3, 3d1} ]]
--?? $Atk < @{target||npc_ac} ?? !Missed|**You missed!*
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 AND $Lvl == 1 ?? Hit:|[[ [$Dam1] 4d6 ]] radiant damage
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 AND $Lvl == 2 ?? Hit:|[[ [$Dam2] 5d6 ]] radiant damage
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 AND $Lvl == 3 ?? Hit:|[[ [$Dam3] 6d6 ]] radiant damage
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 AND $Lvl == 1 ?? alterbar1|_target|@{target||token_id} _bar|1 _amount|-[^Dam1] _show|all
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 AND $Lvl == 2 ?? alterbar1|_target|@{target||token_id} _bar|1 _amount|-[^Dam2] _show|all
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 AND $Lvl == 3 ?? alterbar1|_target|@{target||token_id} _bar|1 _amount|-[^Dam3] _show|all
--?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 ?? vfx_opt|@{target||token_id} burst-magic
--?? $Atk.base == 20 AND $Lvl == 1 ?? Critical Hit:|[[ [$CritDmg1] 8d6 ]] radiant damage
--?? $Atk.base == 20 AND $Lvl == 2 ?? Critical Hit:|[[ [$CritDmg2] 10d6 ]] radiant damage
--?? $Atk.base == 20 AND $Lvl == 3 ?? Critical Hit:|[[ [$CritDmg3] 12d6 ]] radiant damage
--?? $Atk.base == 20 ?? vfx_opt|@{target||token_id} burst-magic
--?? $Atk.base == 1 ?? !|**Fumble:**
--?? $Atk == 20 AND $Lvl == 1 ?? alterbar4|_target|@{selected|token_id} _bar|1 _amount| [^CritDmg1]/2 _show|all
--?? $Atk == 20 AND $Lvl == 2 ?? alterbar4|_target|@{selected|token_id} _bar|1 _amount| [^CritDmg2]/2 _show|all
--?? $Atk == 20 AND $Lvl == 3 ?? alterbar4|_target|@{selected|token_id} _bar|1 _amount| [^CritDmg3]/2 _show|all
}}
June 17 (6 years ago)
Boz
Pro
Hi All, like most people here I'm beating my head against a wall with something I thought was simple but is now destroying my will to live. I've got this guy:

!power {{
--name|Test
--Total:|[[ [$PC] 1d20 - [$NPC] 1d20 ]]
--PC:|[^PC]
--NPC:|[^NPC]
}}

I want to see what each roll did.  But all I can get out of it is the "Total" reported against all three tags:


Is it no longer possible to create multiple rollIDs within the same inline roll? Or was it never possible?  Or am I just overlooking something extremely basic?  Thanks. Byron.
June 17 (6 years ago)
Kurt J.
Pro
API Scripter

Danny C. said:

Hey Guys, I wonder if i can get some help with the charid.
I am trying to make a speak macro where I can see on chat iwch player speak and their avatar on it.

When i add the --charid|-LEsmyhkFSrke4Noypaq is not showing the character avatar. Am i doing something wrong?

Can you post the whole macro? CharID is really only used to make other things work, so by itself it won't really do anything.
June 17 (6 years ago)
Kurt J.
Pro
API Scripter

Boz said:

Hi All, like most people here I'm beating my head against a wall with something I thought was simple but is now destroying my will to live. I've got this guy:

!power {{
--name|Test
--Total:|[[ [$PC] 1d20 - [$NPC] 1d20 ]]
--PC:|[^PC]
--NPC:|[^NPC]
}}

I want to see what each roll did.  But all I can get out of it is the "Total" reported against all three tags:


Is it no longer possible to create multiple rollIDs within the same inline roll? Or was it never possible?  Or am I just overlooking something extremely basic?  Thanks. Byron.

As far as I know, assigning multiple RollIDs within the same roll hasn't ever been possible. The entire roll is treated as a single entity.
June 17 (6 years ago)
Boz
Pro

Kurt J. said:

Boz said:

Hi All, like most people here I'm beating my head against a wall with something I thought was simple but is now destroying my will to live. I've got this guy:

!power {{
--name|Test
--Total:|[[ [$PC] 1d20 - [$NPC] 1d20 ]]
--PC:|[^PC]
--NPC:|[^NPC]
}}

I want to see what each roll did.  But all I can get out of it is the "Total" reported against all three tags:


Is it no longer possible to create multiple rollIDs within the same inline roll? Or was it never possible?  Or am I just overlooking something extremely basic?  Thanks. Byron.

As far as I know, assigning multiple RollIDs within the same roll hasn't ever been possible. The entire roll is treated as a single entity.

Yeah, that's definitely what's happening with the single entity.  I was working off a year old thread I found here: https://app.roll20.net/forum/post/4285059/script-p... where it appears it may have once been a workable thing. But definitely not working that way now.

Thanks for the reply. At least now I can focus my energy elsewhere. Cheers.
June 17 (6 years ago)
Kurt J.
Pro
API Scripter

Boz said:

Kurt J. said:

Boz said:

Hi All, like most people here I'm beating my head against a wall with something I thought was simple but is now destroying my will to live. I've got this guy:

!power {{
--name|Test
--Total:|[[ [$PC] 1d20 - [$NPC] 1d20 ]]
--PC:|[^PC]
--NPC:|[^NPC]
}}

I want to see what each roll did.  But all I can get out of it is the "Total" reported against all three tags:


Is it no longer possible to create multiple rollIDs within the same inline roll? Or was it never possible?  Or am I just overlooking something extremely basic?  Thanks. Byron.

As far as I know, assigning multiple RollIDs within the same roll hasn't ever been possible. The entire roll is treated as a single entity.

Yeah, that's definitely what's happening with the single entity.  I was working off a year old thread I found here: https://app.roll20.net/forum/post/4285059/script-p... where it appears it may have once been a workable thing. But definitely not working that way now.

Thanks for the reply. At least now I can focus my energy elsewhere. Cheers.

So I did a little playing around, and this actually DOES work... it is just a little non-intuitive :) You need to use:

!power {{
--name|Test
--Total:|[[ [$PC] 1d20 - [$NPC] 1d20 ]]
--PC:|[^PC.base]
--NPC:|[^NPC.base]
}}

It turns out that the script does correctly store the base value for each defined RollID, but the total for the roll takes the rest of the roll into account. The total is also the value that is displayed if you don't specify anything else. You can use .base in conditionals as well.
June 18 (6 years ago)

Edited June 18 (6 years ago)
Kurt J.
Pro
API Scripter

Justin A. said:

Kurt, 
First of all awesome script! I have just started to use it. 

Question, you have the ability to change the format of the cards using a template on a handout.
Would it be possible for future release to incorporate handouts for some NPC information versus having to build your NPC's in the character sheets first?

Often we simply need base information:
Name
HP
Stats
Abilities


If these could be read from a handout, we could use that as a "standing variable" card for information. We could even then extend it further for information that can be used in other scenarios. For example, right now in macro we cant have a variable that is in a static place unless it is on a character sheet. So we have to query the user every time they fire off the macro. If we could read a handout and have variables on it, "var1, var2, var3," etc that is static, we now have a place where we can update that data versus having to write it into our macros and then adjust every macro versus one location.

--J



NOTE: This is early info about a planned upcoming feature. It isn't available anywhere yet, but if you have suggestions or comments, please share them.

Justin,

  I haven't forgotten this! :) and I'm happy to say that I have a basic system in place in my own version of the script that is actually working pretty well. (I know you were also looking for the other-way-around of what I have here (a handout with names and replacement variables)... that is in the works as well, and I'm using templates in this direction to work out the kinks so I can add the replacements as well). Here is what I've got right now:

   You can create a handout called "PowerCard Templates" that follows the same structure as the PowerCard Formats handout, but the Templates handout can use pretty much any tag available. It also has replacement variables (up to 10 of them per template right now). An example is probably best :



(Ignore the first two templates... they were just the really early testing :))

Parameters are indicated by a ~ followed by a digit from 0-9. When calling the template, simply add a | and a list of parameters separated by semicolons (;) and they will be automatically numbered and slotted in to replace the text in the template.

With that test templates handout, I can make the following PowerCard macros:

!power {{
  --template|character|@{selected|character_name};@{selected|character_id}
}}

Which will display:



In this case, there are two parameters for the template: ~0 which is used for the Name tag, and ~1 which is used as the Character ID for everything that requires that.

For an example with multiple parameters:

!power {{
   --template|weapon|Longsword;Melee Attack; 5 ft. Reach;2d20kh1;@{target|AC};1d8+@{selected|strength_mod}
}}

which gives me:



This one has five parameters, and pretty much defines a whole card display. Other tags can be used of course (but template has to be the first one):

!power {{
  --template|weapon|Longsword;Melee Attack; 5 ft. Reach;2d20kh1;@{target|AC};1d8+@{selected|strength_mod}
  --format|Kara
  --tokenid|@{selected|token_id}
  --emote|@{selected|character_name} Attacks!
  --target_list|@{target|token_id}
}}



Still lots of testing to do (I just wrote this code in the last hour or so and haven't put it through its paces yet) but so far very promising.

June 18 (6 years ago)
Boz
Pro

Kurt J. said:

Boz said:

Kurt J. said:

Boz said:

Hi All, like most people here I'm beating my head against a wall with something I thought was simple but is now destroying my will to live. I've got this guy:

!power {{
--name|Test
--Total:|[[ [$PC] 1d20 - [$NPC] 1d20 ]]
--PC:|[^PC]
--NPC:|[^NPC]
}}

I want to see what each roll did.  But all I can get out of it is the "Total" reported against all three tags:


Is it no longer possible to create multiple rollIDs within the same inline roll? Or was it never possible?  Or am I just overlooking something extremely basic?  Thanks. Byron.

As far as I know, assigning multiple RollIDs within the same roll hasn't ever been possible. The entire roll is treated as a single entity.

Yeah, that's definitely what's happening with the single entity.  I was working off a year old thread I found here: https://app.roll20.net/forum/post/4285059/script-p... where it appears it may have once been a workable thing. But definitely not working that way now.

Thanks for the reply. At least now I can focus my energy elsewhere. Cheers.

So I did a little playing around, and this actually DOES work... it is just a little non-intuitive :) You need to use:

!power {{
--name|Test
--Total:|[[ [$PC] 1d20 - [$NPC] 1d20 ]]
--PC:|[^PC.base]
--NPC:|[^NPC.base]
}}

It turns out that the script does correctly store the base value for each defined RollID, but the total for the roll takes the rest of the roll into account. The total is also the value that is displayed if you don't specify anything else. You can use .base in conditionals as well.

Kurt... you're a stone-cold killer.  That's unreal, man.  Thanks heaps for that!  That little work around is the gateway to a bunch of opposed rolls and margin checks that I otherwise had no hope of performing.  Legend!
June 19 (6 years ago)
Kurt J.
Pro
API Scripter
NOTE: This version is now up on the development GIST. It is working for me, but as it is very new there are likely to be some cases where weird things will happen. Please let me know if you encounter anything strange when using these new tags. Also, the examples below just scratch the surface of what is possible with the --template and --replacement tags, especially when used in combination. I'll probably end up making another youtube video on these options at some point when I'm confident the code is generally sound.

2018-06-18 Version 3.7.7

- Now supporting templates and replacement values! This is a pretty major update, and will stay on the development GIST for a while before moving to One-Click. PowerCards now supports two new reserved tags:

  --template : Imports the tags defined in a handout called "PowerCard Templates". Templates are named sets of tags that can include parameters that get passed in by the content of the --template tag when the PowerCard is evaluated. The format for the Templates handout is similar to the PowerCard Formats handout: One line per template (they can wrap around as much as you like, but lines are ended with a carriage return). Templates start with a name, followed by a colon. Then a list of tags denoted by the standard -- prefix. A template can allow for value substitution by including ~#! in the line, where # is a parameter number starting at 0 (so, ~0! is the first parameter, ~1! is the second, and so on).

  When a template tag is used in a PowerCard macro, it is in the format:

  --template|TemplateName|Parameter0;Parameter1;Parameter2

  @{} notation (like @{selected|character_name}, etc) is supported when calling the template, but not within the template itself (the API doesn't have the necessary information to deal with that notation as it is done by the chat server, which just passes IDs).

  The position of the template tag in the PowerCard is preserved, so other lines can appear before or after it.

  --replacement : Basically the opposite of templates. Another new handout called "PowerCard Replacements" can define replacement sets by name, followed by a colon, followed by a list of replacement keys and values. Key/Value pairs are separated from each other with semicolons, and keys and values themselves are separated by vertical bars (|).

  A replacement tag will look at all of the other tags in the PowerCard and replace the keys with the given values. Keys in a PowerCard are denoted with ~keyname$ notation (start with a ~ and end with a $).

  Both --template and --replacement can be used multiple times with the "Same Tag" modifier (--template*1, --template*2, etc). They can also be used together. All --template lines are processed first, then all --replacement lines, so values passed in as parameters to templates could be specified by replacement entries.

  Multiple uses of the replacement tag are cumulative, with earliest definition of a replacement key being the one that will get used.

  Note on Inline Rolls : Inline rolls are processed by the chat server before being sent to PowerCards, but PowerCards will reparse inline rolls if they are added to the card after the initial chat server processing. For this reason, inline rolls work normally in templates (since PowerCards itself is adding them to the card), but not in replacements directly. It IS possible to define replacements that substitute in [[ and ]] so rolls can be generated by replacements.

  Time for some examples. All of these will use the following templates handout:

weapon:--name|~0! --leftsub|~1! --rightsub|~2! --Attack:|[[ [$Atk] ~3! ]] vs AC ~4! --Damage|[[ [$Dmg] ~5! ]]
character:--name|~0! --attribute_summary|~1! --ogl_pc_attack_list|~1! --spell_slots|~1! --spell_list|~1!
description:--!desc|~0!
  And the following replacements handout:

Kara:Name|Kara;Weapon|Shillelagh;DType|bludgeoning;DamageDie|1d8;CritDie|2d8
Skeleton:M_Name|Skeleton;M_AC|12;M_HP|12;C_HP|12
RollVars:RB|[[;RE|]]

This card:

!power {{
--template*1|weapon|Longsword;Melee Attack; 5 ft. Reach;2d20kh1;@{target|AC};1d8+@{selected|strength_mod}
}}


Will use the "weapon" template, passing in "Longsword" for parameter ~0!, "Melee Attack" for parameter ~1!, etc. The output is:



We can combine templates and replacement values as well:

!power {{
--replacement|Kara
--template*1|weapon|~Name$ attacks with ~Weapon$;Melee Attack; 5 ft. Reach;2d20kh1;@{target|AC};~DamageDie$ + @{selected|strength_mod}
}}


which gives:



Here is a card that includes conditional hit or miss logic:

!power {{
--replacement*1|Kara
--replacement*2|Skeleton
--replacement*3|RollVars
--name|~Name$ attacks ~M_Name$
--Attack|~Name$ attacks ~M_Name$ with ~Weapon$ [[ [$Atk] 1d20 + @{selected|strength_mod} [Strength] + @{selected|pb} [Proficiency] ]] vs AC ~M_AC$
--hroll|~RB$ [$Dmg] ~DamageDie$ ~RE$, ~RB$ [$Crit] ~CritDie$ ~RE$
--?? $Atk < ~M_AC$ ??Miss|The attack missed!
--?? $Atk >= ~M_AC$ AND $Atk.base <> 20 ??Hit|~Name$ deals [^Dmg] ~DType$ damage to ~M_Name$.
--?? $Atk.base == 20 ??Critical Hit|~Name$ deals [^Crit] ~DType$ damage to ~M_Name$.
}}


which, as you would expect produces something like:



One important thing to see here is how the ~RB$ and ~RE$ replacements are used to generate [[ and ]] so that we can create an inline roll that uses a replacement variable inside it. If we tried to just use [[ and ]] in the PowerCard macro, the chat server would throw an error because it doesn't know what ~DamageDie$ is.

Going a bit further, if we add the following to the templates handout:

AttackConds:--?? $Atk < ~M_AC$ ??Miss|The attack missed! --?? $Atk >= ~M_AC$ AND $Atk.base <> 20 ??Hit|~Name$ deals [^Dmg] ~DType$ damage to ~M_Name$. --?? $Atk.base == 20 ??Critical Hit|~Name$ deals [^Crit] ~DType$ damage to ~M_Name$.

We can use that template instead of the three conditional lines:

!power {{
--replacement*1|Kara
--replacement*2|Skeleton
--replacement*3|RollVars
--name|~Name$ attacks ~M_Name$
--Attack|~Name$ attacks ~M_Name$ with ~Weapon$ [[ [$Atk] 1d20 + @{selected|strength_mod} [Strength] + @{selected|pb} [Proficiency] ]] vs AC ~M_AC$
--hroll|~RB$ [$Dmg] ~DamageDie$ ~RE$, ~RB$ [$Crit] ~CritDie$ ~RE$
--template|AttackConds
}}


Potentially saving quite a bit of entry and maintenance in macros.
June 19 (6 years ago)
Ravenknight
KS Backer
Impressive work Kurt! I look forward to play with it! Thanks!
Kurt, the template thing is awesome, and I believe the community once they start using it will appreciate it greatly as it will reduce the amount of content they need for the multiple cards by simply calling the template for the unique elements and leveraging the templates. That is great!

I look forward to version 2 of this template/micro variable solution!

--J
June 19 (6 years ago)
I am a little lost but look forward to learning the new features. I have a ton of macros.
June 20 (6 years ago)
Kurt J.
Pro
API Scripter
I've updated 3.7.7 on the Dev GIST with a few fixes for a few bugs I ran into while prepping for a video about the template/replcement system.
June 20 (6 years ago)

Edited June 20 (6 years ago)
Kurt J.
Pro
API Scripter

Justin A. said:

Playing with the table stuff now, outstanding work Kurt!!

--J

Playing around with templates while working on a YouTube video... Here is my new macro to do a Shadowrun stat block with a template:

!power {{ --template|ShadowrunCard|Male Dwarf;5;2(3);3;5;4;6;3;2;3;2.3 }}

:)
June 21 (6 years ago)

Kurt J. said:

Justin A. said:

Playing with the table stuff now, outstanding work Kurt!!

--J

Playing around with templates while working on a YouTube video... Here is my new macro to do a Shadowrun stat block with a template:

!power {{ --template|ShadowrunCard|Male Dwarf;5;2(3);3;5;4;6;3;2;3;2.3 }}

:)

Post a screen shot pls
June 21 (6 years ago)
Ravenknight
KS Backer
I...think I need that video. :D
June 22 (6 years ago)

Edited June 22 (6 years ago)
Kurt J.
Pro
API Scripter

Craven said:


Post a screen shot pls

Here you go... the powercard output and the card that created it (I added a --name tag to the template):


I don't actually play shadowrun, so this is based on the table stuff that Justin asked about :)

Video is coming :) Probably over the weekend.
June 23 (6 years ago)
Boz
Pro
Hi All, does anyone know if there is a set maximum number of conditionals?  I have a power card that's attempting to resolve 102 conditions.  With 99 it's gravy.  With 100 it bombs with "TypeError: Cannot read property '0' of null" but it actually looks like a timeout.   Does anyone know if there's a way to either (a) extend the number of conditions that can be handled, or (b) extend the timeout? And I'm non-technical. Just in case this is something a first year IT grad should know about :)

I realise that (c) write a script with less than 100 conditions is probably the best answer but I'd rather explore a and b first.  Here's the full error presented:

For reference, the error message generated was: TypeError: Cannot read property '0' of null
TypeError: Cannot read property '0' of null
at apiscript.js:7684:47
at Array.forEach (native)
at apiscript.js:7674:9
at checkFinishedOps (eval at <anonymous> (/home/node/d20-api-server/api.js:155:1), <anonymous>:751:7)
at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:155:1), <anonymous>:831:8)
at Timeout._onTimeout (/home/node/d20-api-server/node_modules/underscore/underscore.js:825:19)
at ontimeout (timers.js:386:14) at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)
Hi kurt.

I was also wondering if it would be possible to put token id on the title part of the powercard.
At the moment we can use the 
--tokenid|@{selected|Token_Id}
--target_list|@{target|token_id}
--emote| **@{selected|token_name}** Attacks **@{target|token_name}**
so that we can get the emote and pcitures but i was wonder if it would be able to use the same on the title tag istead. Would this be possible?
--name|@{selected|Token_Id}
June 23 (6 years ago)

Edited June 23 (6 years ago)
Something similar to this

So istead of the upper row, that would change for the title.
What i mean is that now the title will have a picture the token and the Head Magister Ulfred Name. Hope you udnerstand what i mean
June 25 (6 years ago)
Kurt J.
Pro
API Scripter

Boz said:

Hi All, does anyone know if there is a set maximum number of conditionals?  I have a power card that's attempting to resolve 102 conditions.  With 99 it's gravy.  With 100 it bombs with "TypeError: Cannot read property '0' of null" but it actually looks like a timeout.   Does anyone know if there's a way to either (a) extend the number of conditions that can be handled, or (b) extend the timeout? And I'm non-technical. Just in case this is something a first year IT grad should know about :)

I realise that (c) write a script with less than 100 conditions is probably the best answer but I'd rather explore a and b first.  Here's the full error presented:

For reference, the error message generated was: TypeError: Cannot read property '0' of null
TypeError: Cannot read property '0' of null
at apiscript.js:7684:47
at Array.forEach (native)
at apiscript.js:7674:9
at checkFinishedOps (eval at <anonymous> (/home/node/d20-api-server/api.js:155:1), <anonymous>:751:7)
at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:155:1), <anonymous>:831:8)
at Timeout._onTimeout (/home/node/d20-api-server/node_modules/underscore/underscore.js:825:19)
at ontimeout (timers.js:386:14) at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)

As far as I can tell, there isn't a hard coded limit... That must be one heck of a macro, though :)
June 25 (6 years ago)
Kurt J.
Pro
API Scripter

Danny C. said:

Something similar to this

So istead of the upper row, that would change for the title.
What i mean is that now the title will have a picture the token and the Head Magister Ulfred Name. Hope you udnerstand what i mean

Not opposed to something along these lines, though it would probably be integrated as part of a larger system I have in mind. That will all have to wait until I'm happy with the templates setup, though.
June 25 (6 years ago)

Edited June 25 (6 years ago)
Kurt J.
Pro
API Scripter
Version 3.7.7 has been updated again on the development gist with more improvements for templates and replacements. No version number update, but the modified date is now 6/24/2018.

An intro video for Templates and Replacements is available here : https://youtu.be/ESfovaVMddw

June 25 (6 years ago)
Boz
Pro

Kurt J. said:

Boz said:

Hi All, does anyone know if there is a set maximum number of conditionals?  I have a power card that's attempting to resolve 102 conditions.  With 99 it's gravy.  With 100 it bombs with "TypeError: Cannot read property '0' of null" but it actually looks like a timeout.   Does anyone know if there's a way to either (a) extend the number of conditions that can be handled, or (b) extend the timeout? And I'm non-technical. Just in case this is something a first year IT grad should know about :)

I realise that (c) write a script with less than 100 conditions is probably the best answer but I'd rather explore a and b first.  Here's the full error presented:

For reference, the error message generated was: TypeError: Cannot read property '0' of null
TypeError: Cannot read property '0' of null
at apiscript.js:7684:47
at Array.forEach (native)
at apiscript.js:7674:9
at checkFinishedOps (eval at <anonymous> (/home/node/d20-api-server/api.js:155:1), <anonymous>:751:7)
at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:155:1), <anonymous>:831:8)
at Timeout._onTimeout (/home/node/d20-api-server/node_modules/underscore/underscore.js:825:19)
at ontimeout (timers.js:386:14) at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)

As far as I can tell, there isn't a hard coded limit... That must be one heck of a macro, though :)

Ha! Yeah, it's a beast.  I've combined some conditionals to bring it under 100. But since then have discovered another card also failing for the same reason, but with far fewer conditionals (it does have something like 150 lines though).  So I'm thinking it's a timeout set by the roll20 server to stop people like me killing everything with a script the size of War and Peace.

As always, thanks for the response. Greatly appreciated.
June 25 (6 years ago)
Ravenknight
KS Backer
Great additions Kurt! Thanks. 
thanks for the video Kurt! Great stuff the new features!
June 28 (6 years ago)

Edited June 28 (6 years ago)
Kurt J.
Pro
API Scripter

A tip for anyone playing with templates - Keep your templates and replacements text in an external text editor (I use Notepad++) because the built-in editor in Roll20 will add some oddities to the template content (in the conversion back and forth from text to html) which can cause weird errors. I do all my editing in the external editor and the just past the whole thing into the handout whenever I need to update.


Outstanding Kurt!


I need to play with it a bit more, particularly with substitutions. 


--J

June 30 (6 years ago)

Edited June 30 (6 years ago)
Kurt J.
Pro
API Scripter

I've been playing with templates and working on my own starter pack of templates that I'll put up here at some point. I decided I could make more useful macros with a couple of cool new features (ok, one just makes things shorter, but I'm super excited about the optional tags in templates.)

Version 3.7.8 is up on the development GIST. Besides some bug fixes, here is what's new:


Version 3.7.8 Change Log


- Updated --replacement tag to support multiple replacement lists by separating them with semicolons. For eample,

  --replacement|ChainMail
  --replacement|Longsword
  --replacement|RollVars
 
  is equivalent to:

  --replacement|ChainMail;Longsword;RollVars



- Modified the order of replacement and template processing. This was necessary to support the next change. Here is what happens:

  • All replacement values are loaded into memory
  • Templates are looked up starting at the bottom of the card and working upward
  • Every line of a template is processed first by replacing parameters, and then by processing replacements
  • All tags in the card are processed for replacements. This means that a line added by a template might be processed a second time. 


- Templates now support optional line inclusion.

  • An optional tag starts with a [ and ] enclosing one of the following:
  • Nothing : If the option tag starts with [], it won't be added to the card
  • An javascript-style expression : If the expression is true, the tag will be added to the card
  • Anything else : The tag will be added to the card.


  If the above logic determines that a line should not be added, it won't add it at all - so no worries about tag name clashes. This is evaluated when the card is built, so Roll IDs and the like can't be used here, but we already have conditionals for those. These allow you to completely alter the card based on a macro-call-time expression, and you can use replacement variables for the parameters or @{} notation (in the macro), so you could have something like:
 
  --[~10!<5]Damage|Your sacred flame does 1d8 damage
  --[~10!>=5&&~10!<11]Damage|Your sacred flame does 2d8 damage
  --[~10!>=11&&~10!<17]Damage|Your sacred flame does 3d8 damage
  --[~10!>=17]Damage|Your sacred flame does 4d8 damage
 
  When this got called, if you specified @{selected|level} for parameter 10, it would display the appropriate damage dice for the caster based on their level.
 
  Of course, I would make an actual template/macro like this more in-depth and generic enough to handle multiple spells, but that's the idea behind the optional tags.

June 30 (6 years ago)
Kurt J.
Pro
API Scripter

Updated 3.7.8 on the dev server (no version number bump). Replacements in templates now get applied to tag names as well as content, meaning it is possible to use replacement values when determining optional template tags.

July 01 (6 years ago)

Edited July 01 (6 years ago)
Kurt J.
Pro
API Scripter

Here is my current setup for a highly generic attack template (I'm using the 5E OGL Sheet):

Attack:--charid|~0! --emote|~1! <br /> attacks <br /> ~3! --target_list|~2! --name|~AttackName$ Attack --format|~1! --['~AType$' == 'STR']Attack|~1! rolls ~RB$ [$Atk] ~5! + ~6! [STR] + ~10! [PROF] ~RE$ vs AC ~4! --['~AType$' == 'DEX']Attack|~1! rolls ~RB$ [$Atk] ~5! + ~7! [DEX] + ~10! [PROF] ~RE$ vs AC ~4! --['~AType$' == 'WIS']Attack|~1! rolls ~RB$ [$Atk] ~5! + ~8! [WIS] + ~10! [PROF] ~RE$ vs AC ~4! --['~AType$' == 'SPELL']Attack|~1! rolls ~RB$ [$Atk] ~5! + ~9! [Spell Attack] ~RE$ vs AC ~4! --['~AType$' == 'STR']?? $Atk.base <> 1 AND $Atk.base <> 20 AND $Atk >= ~4! ??Hit|~1! hits for [[ [$Dmg] ~BaseDamage$ + ~6! [STR] ]] ~DType$ damage! --['~AType$' == 'DEX']?? $Atk.base <> 1 AND $Atk.base <> 20 AND $Atk >= ~4! ??Hit|~1! hits for [[ [$Dmg] ~BaseDamage$ + ~7! [DEX] ]] ~DType$ damage! --['~AType$' == 'WIS']?? $Atk.base <> 1 AND $Atk.base <> 20 AND $Atk >= ~4! ??Hit|~1! hits for [[ [$Dmg] ~BaseDamage$ + ~8! [WIS] ]] ~DType$ damage! --['~AType$' == 'SPELL']?? $Atk.base <> 1 AND $Atk.base <> 20 AND $Atk >= ~4! ??Hit|~1! hits for [[ [$Dmg] ~BaseDamage$ ]] ~DType$ damage! --['~AType$' == 'STR']?? $Atk.base == 20 ??Critical Hit|~1! scores a critical hit for [[ [$Crit] ~CritDamage$ + ~6! [STR] ]] ~DType$ damage! --['~AType$' == 'DEX']?? $Atk.base == 20 ??Critical Hit|~1! scores a critical hit for [[ [$Crit] ~CritDamage$ + ~7! [DEX] ]] ~DType$ damage! --['~AType$' == 'WIS']?? $Atk.base == 20 ??Critical Hit|~1! scores a critical hit for [[ [$Crit] ~CritDamage$ + ~8! [WIS] ]] ~DType$ damage! --['~AType$' == 'SPELL']?? $Atk.base == 20 ??Critical Hit|~1! scores a critical hit for [[ [$Crit] ~CritDamage$ ]] ~DType$ damage! --['~AType$' == 'SAVE']Spell Effect|~1! casts ~AttackName$ against ~3!, dealing [[ [$Dmg] ~BaseDamage$ ]] ~DType$ damage. ~3! can attempt a **DC ~11! ~SaveType$** saving throw for ~SaveEffect$ --?? $Atk < ~4! AND $Atk.base <> 1 ??Miss|~1! missed. --?? $Atk.base == 1 ??Fumble|~1! fumbles the attack! --['~ADesc$']!desc|~ADesc$


The above would be placed in the "PowerCard Templates" handout. It relies on a replacement set.

The text below would go in the "PowerCard Replacements" handout:

RollVars:RB|[[;RE|]]
Advantage:{{query=1}} {{normal=1}} {{r2=[[0d20|1d20;{{query=1}} {{advantage=1}} {{r2=[[1d20|2d20kh1;{{query=1}} {{disadvantage=1}} {{r2=[[1d20|2d20kl1
Mace:AttackName|Mace;AType|STR;DType|bludgeoning;DType2|NONE;BaseDamage|1d6;CritDamage|2d6;HitBonus|;ADesc|
Light Crossbow:AttackName|Light Crossbow;AType|DEX;DType|piercing;BaseDamage|1d8;CritDamage|2d8;HitBonus|;ADesc|
Sacred Flame Tier 1:AttackName|Sacred Flame;AType|SAVE;DType|radiant;SaveType|DEX;BaseDamage|1d8;SaveEffect|no damage.;ADesc|
Sacred Flame Tier 2:AttackName|Sacred Flame;AType|SAVE;DType|radiant;SaveType|DEX;BaseDamage|2d8;SaveEffect|no damage.;ADesc|
Quarterstaff:AttackName|Quarterstaff;AType|STR;DType|bludgeoning;BaseDamage|1d6;CritDamage|2d6;HitBonus|;ADesc|
Shillelagh:AttackName|Shillelagh;AType|WIS;DType|bludgeoning;BaseDamage|1d8;CritDamage|2d8;HitBonus|;ADesc|
Scimitar:AttackName|Scimitar;AType|STR;DType|slashing;BaseDamage|1d6;CritDamage|2d6;HitBonus|;ADesc|
Longsword:AttackName|Longsword;AType|STR;DType|slashing;BaseDamage|1d8;CritDamage|2d8;HitBonus|;ADesc|
Shortsword:AttackName|Shortsword;AType|STR;DType|piercing;BaseDamage|1d6;CritDamage|2d6;HitBonus|;ADesc|
Dagger:AttackName|Dagger;AType|STR;DType|piercing;BaseDamage|1d4;CritDamage|2d4;HitBonus|;ADesc|
Longbow:AttackName|Longbow;AType|DEX;DType|piercing;BaseDamage|1d8;CritDamage|2d8;HitBonus|;ADesc|
Oath Bow:AttackName|Oath Bow;AType|DEX;DType|piercing;BaseDamage|1d8 + 3d6;CritDamage|2d8 + 3d6;HitBonus|;ADesc|
Naginata:AttackName|Naginata;AType|DEX;DType|slashing;BaseDamage|1d10;CritDamage|2d10;HitBonus|;ADesc|
Unarmed Strike Tier 1:AttackName|Unarmed Strike;AType|DEX;DType|bludgeoning;BaseDamage|1d4;CritDamage|2d4;HitBonus|;ADesc|
Unarmed Strike Tier 2:AttackName|Unarmed Strike;AType|DEX;DType|bludgeoning;BaseDamage|1d6;CritDamage|2d6;HitBonus|;ADesc|
Quarterstaff - Monk:AttackName|Quarterstaff;AType|DEX;DType|bludgeoning;BaseDamage|1d6;CritDamage|2d6;HitBonus|;ADesc|
Warhammer:AttackName|Warhammer;AType|STR;DType|bludgeoning;BaseDamage|1d8;CritDamage|2d8;HitBonus|;ADesc|
Javelin:AttackName|Javelin;AType|DEX;DType|piercing;BaseDamage|1d6;CritDamage|2d6;HitBonus|;ADesc|
Javelin of Lightning:AttackName|Javelin of Lightning;AType|DEX;DType|piercing;BaseDamage|1d6;CritDamage|2d6;HitBonus|;ADesc|Creatures in the path of the javelin take [[ [$LDmg] 4d6 ]] lightning damage. **DC 13 DEX** save for half damage.
Acris:AttackName|Acris (Longsword +1);AType|STR;DType|slashing;BaseDamage|1d8 + 1 [Enchantment];CritDamage|2d8 + 1 [Enchantment];HitBonus|+1 [Enchantment];ADesc|
Eldritch Blast:AttackName|Eldritch Blast;AType|SPELL;DType|force;BaseDamage|1d10;CritDamage|2d10;HitBonus|;ADesc|
Shatter:AttackName|Shatter;AType|SAVE;DType|thunder;SaveType|CON;BaseDamage|3d8;SaveEffect|half damage.;ADesc|Creatures within 10' of the selected point are effected.
Shatter SL 3:AttackName|Shatter;AType|SAVE;DType|thunder;SaveType|CON;BaseDamage|4d8;SaveEffect|half damage.;ADesc|Creatures within 10' of the selected point are effected.


The format for an attack is pretty self explanatory, and the list above has an example of an enchanted weapon (Acris) to show how enchantment bonuses can be accommodated.There is also an example of a multiple tier attack (Sacred Flame) which gets better based on level. I just alter the character's macro with the new attack name when appropriate.

Spells that can be cast in higher level slots are handled by adding another entry for them with the higher level slot indicated and updating the damage. For spells like Eldritch Bolt that can be targeted at different targets as it improves, I just have the player "cast" it multiple times.

The Advantage replacement set replaces the text of the "rtype" character attribute with the appropriate dice. This means the Advantage/Normal/Disadvantage toggle on the character sheet is taken into account by the attack template.

Finally, the macro I use for all character abilities is :

!power {{
--replacement|RollVars;Advantage;Mace
--template|Attack|@{selected|character_id};@{selected|character_name};@{target|token_id};@{target|character_name};@{target|npc_ac};~@{selected|rtype}$ ~HitBonus$;@{selected|strength_mod};@{selected|dexterity_mod};@{selected|wisdom_mod};@{selected|spell_attack_bonus};@{selected|pb};@{selected|spell_save_dc}
}}


The only thing I need to change here in most cases is the last item in the --replacement tag with the name of the attack (Mace in this case) from the replacements list above to set up a new ability.

I'll probably still refine these a bit over time, but so far this format has been able to handle everything my players do on a regular basis.

The cards below all use the same macro (i have a Format in the PowerCard Formats handout for each character name, which is why the cards look different). The only thing changed in these attacks is the attack name in the --replacements tag.




July 01 (6 years ago)

Edited July 01 (6 years ago)

Hey Kurt!

First off, awesome job with taking over maintaining and enhancing PowerCards!  Love this script and would have hated to see it die.  The default roll templates aren't very nice to look at (and yeah, I'm talking both OGL and Shaped).  Anyway, having a bit of a problem.  I'm attempting to replicate what you have in the post above and am running into issues.

Template:

Attack:--charid|~0! --emote|~1! <br /> attacks <br /> ~3! --target_list|~2! --name|~AttackName$ Attack --format|~1! --['~AType$' == 'STR']Attack|~1! rolls ~RB$ [$Atk] ~5! + ~6! [STR] + ~10! [PROF] ~RE$ vs AC ~4! --['~AType$' == 'DEX']Attack|~1! rolls ~RB$ [$Atk] ~5! + ~7! [DEX] + ~10! [PROF] ~RE$ vs AC ~4! --['~AType$' == 'WIS']Attack:|~1! rolls ~RB$ [$Atk] ~5! + ~8! [WIS] + ~10! [PROF] ~RE$ vs AC ~4! --['~AType$' == 'SPELL']Attack|~1! rolls ~RB$ [$Atk] ~5! + ~9! [Spell Attack] ~RE$ vs AC ~4! --['~AType$' == 'STR']?? $Atk.base <> 1 AND $Atk.base <> 20 AND $Atk >= ~4! ??Hit|~1! hits for [[ [$Dmg] ~BaseDamage$ + ~6! [STR] ]] ~DType$ damage! --['~AType$' == 'DEX']?? $Atk.base <> 1 AND $Atk.base <> 20 AND $Atk >= ~4! ??Hit|~1! hits for [[ [$Dmg] ~BaseDamage$ + ~7! [DEX] ]] ~DType$ damage! --['~AType$' == 'WIS']?? $Atk.base <> 1 AND $Atk.base <> 20 AND $Atk >= ~4! ??Hit|~1! hits for [[ [$Dmg] ~BaseDamage$ + ~8! [WIS] ]] ~DType$ damage! --['~AType$' == 'SPELL']?? $Atk.base <> 1 AND $Atk.base <> 20 AND $Atk >= ~4! ??Hit:|~1! hits for [[ [$Dmg] ~BaseDamage$ ]] ~DType$ damage! --['~AType$' == 'STR']?? $Atk.base == 20 ??Critical Hit|~1! scores a critical hit for [[ [$Crit] ~CritDamage$ + ~6! [STR] ]] ~DType$ damage! --['~AType$' == 'DEX']?? $Atk.base == 20 ??Critical Hit|~1! scores a critical hit for [[ [$Crit] ~CritDamage$ + ~7! [DEX] ]] ~DType$ damage! --['~AType$' == 'WIS']?? $Atk.base == 20 ??Critical Hit|~1! scores a critical hit for [[ [$Crit] ~CritDamage$ + ~8! [WIS] ]] ~DType$ damage! --['~AType$' == 'SPELL']?? $Atk.base == 20 ??Critical Hit|~1! scores a critical hit for [[ [$Crit] ~CritDamage$ ]] ~DType$ damage! --['~AType$' == 'SAVE']Spell Effect:|~1! casts ~AttackName$ against ~3!, dealing [[ [$Dmg] ~BaseDamage$ ]] ~DType$ damage. ~3! can attempt a **DC ~11! ~SaveType$** saving throw for ~SaveEffect$ --?? $Atk < ~4! AND $Atk.base <> 1 ??Miss|~1! missed. --?? $Atk.base == 1 ??Critical Miss:|~1! has rolled a 1! Uh oh... --['~ADesc$']!Description:|~ADesc$

Replacement:

RollVars:RB|[[;RE|]]
Advantage:{{query=1}} {{normal=1}} {{r2=[[0d20|1d20;{{query=1}} {{advantage=1}} {{r2=[[1d20|2d20kh1;{{query=1}} {{disadvantage=1}} {{r2=[[1d20|2d20kl1}}
Heavy Crossbow:AttackName|Heavy Crossbow;AType|DEX;DType|piercing;BaseDamage|1d10;CritDamage|2d10;HitBonus|;ADesc|
Shortsword:AttackName|Shortsword;AType|STR;DType|piercing;BaseDamage|1d6;CritDamage|2d6;HitBonus|;ADesc|
Longbow:AttackName|Longbow;AType|DEX;DType|piercing;BaseDamage|1d8;CritDamage|2d8;HitBonus|;ADesc|
Warhammer:AttackName|Warhammer;AType|STR;DType|bludgeoning;BaseDamage|1d8;CritDamage|2d8;HitBonus|;ADesc|

PowerCard:

!power {{
--replacement|RollVars;Advantage;Warhammer
--template|Attack|@{selected|character_id};@{selected|character_name};@{target|token_id};@{target|character_name};@{target|AC};~@{selected|rtype}$ ~HitBonus$;@{selected|strength_mod};@{selected|dexterity_mod};@{selected|wisdom_mod};@{selected|spell_attack_bonus};@{selected|pb};@{selected|spell_save_dc}
}}

Result:


What, if anything, am I doing wrong?  I appreciate any insight or help you can give.


Thanks!

July 01 (6 years ago)
Kurt J.
Pro
API Scripter

Mace isn't listed in your replacements. In the macro:

!power {{
--replacement|RollVars;Advantage;Mace
--template|Attack|@{selected|character_id};@{selected|character_name};@{target|token_id};@{target|character_name};@{target|AC};~@{selected|rtype}$~HitBonus$;@{selected|strength_mod};@{selected|dexterity_mod};@{selected|wisdom_mod};@{selected|spell_attack_bonus};@{selected|pb};@{selected|spell_save_dc}
}}

The bolded part (Mace) needs to be replaced with the weapon name from the Replacements list. Currently, you have Heavy Crossbow, Shortsword, Longbow, and Warhammer defined, but not Mace, so it isn't using any of the replacement pairs to fill things in.

July 01 (6 years ago)
Kurt J.
Pro
API Scripter

Also, I realized I was using @{target|AC} instead of @{target|npc_ac} in the macro above, so I updated it there... otherwise the NPC AC doesn't always get reflected properly. That makes things a little more complicated, but I'm actually using @{target|bar2} in my own macro because I use that as the AC of all of my tokens thanks to the weirdness of the ac/npc_ac split.

July 01 (6 years ago)

Edited July 01 (6 years ago)

Yeah, my bad.  My actual Powercard doesn't contain "Mace".  I must of copied and pasted that from your example.  Sorry about that!  I've got attack macros already setup, but was interested in getting it more generalized with the templates and replacements.  I'll fiddle with it some more.  I'm sure I've got something futzed up.  Thanks for responding and keep up the great work on this!


I can't for the life of me get the formats to work. Whenever I use a format, it is always the default green one. 


I've tried setting up the PowerCard Formats handout in so many ways, but it makes no difference. What am I doing wrong? 

July 04 (6 years ago)

Edited July 04 (6 years ago)

I can't for the life of me get the formats to work. Whenever I use a format, it is always the default green one. 


I've tried setting up the PowerCard Formats handout in so many ways, but it makes no difference. What am I doing wrong? 

Yep, confirmed.  None of my formats work either.  Was trying to use the "bigbad" example and just kept getting this same green one.

July 04 (6 years ago)

Edited July 04 (6 years ago)


Craig L. said:

I can't for the life of me get the formats to work. Whenever I use a format, it is always the default green one. 


I've tried setting up the PowerCard Formats handout in so many ways, but it makes no difference. What am I doing wrong? 

Yep, confirmed.  None of my formats work either.  Was trying to use the "bigbad" example and just kept getting this same green one.

Try mine then you can edit it if it works. Make sure there are no spaces in front of the first word or line break.


atwill: --txcolor|#FFFFFF --bgcolor|#3D59AB --titlefontshadow|none --corners|10
encounter: --txcolor|#FFFFFF --bgcolor|#440000 --titlefontshadow|none --corners|10
default: --txcolor|#FFFFFF --bgcolor|#0000EE --titlefontshadow|none --corners|10
item: --txcolor|#FFFFFF --bgcolor|#e58900 --titlefontshadow|none --corners|10
recharge: --txcolor|#FFFFFF --bgcolor|#000044 --titlefontshadow|none --corners|10
GM: --txcolor|#030303 --bgcolor|#7171C6 --titlefontshadow|none --corners|10
Dice: --txcolor|#FFFFFF --bgcolor|#175b76 --titlefontshadow|none --corners|10
Conditions: --txcolor|#FFFFFF --bgcolor|#800000 --titlefontshadow|none --corners|10
Green: --txcolor|#FFFFFF --bgcolor|#16541c --titlefontshadow|none --corners|10
badguys: --txcolor|#FFFFFF --bgcolor|#175b76 --titlefontshadow|none --corners|10

Edit: Delete the old one and create a new one. Also copy the name from here PowerCard Formats make sure there is no space in front.

July 04 (6 years ago)

https://htmlcolorcodes.com/

July 04 (6 years ago)

Edited July 04 (6 years ago)
Kurt J.
Pro
API Scripter

I believe the latest update to Roll20 includes an updated text editor that is causing havoc with lots of things :)

I suggest copying the text of your handout and pasting into notepad, then editing your handout, hit control-a in the text box to select all and control-v to paste back in.

I keep all of my handout text in an external editor (Notepad++ in my case) and always paste the whole thing in whenever I make edits.