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

5e Defender macro using APIs / mods

January 22 (3 weeks ago)

Hey folks! I'm looking to make a macro that would allow a player to set their AC and attack and damage bonuses when they roll to attack. She has the 5e Defender sword, so ideally what would happen is

1. click attack roll

2. be asked to set AC bonus to 0, 1, 2, 3

3. adjust character / token AC accordingly

4. decrease attack and damage rolls by 0, 1, 2, 3 to match the AC boost

4. roll attack and damage with the adjusted modifiers


the player wants to be asked every time, which works from my perspective as DM.

I'm a pro user, so I was thinking I'd use TokenMod? but The Aaron suggested using ChatSetAttr instead, which I haven't used much.

Any help is very much appreciated! Thank you!

January 22 (3 weeks ago)
Gauss
Forum Champion

Hi Ken R., 

Which character sheet is being used? 

January 23 (3 weeks ago)
timmaugh
Pro
API Scripter

@Gauss... They said in another post its the 5ExR20 2014 sheet.

@Ken... Yes, ChatSetAttr is the one you want. If you want to change token properties, that's TokenMod. If you want to change character attributes, ChatSetAttr.

Unfortunately I don't know that sheet wekk, but Gauss does!

January 24 (2 weeks ago)

ah, thanks! and yes, it's the 5e 2014 R20 sheet -- any thoughts, Gauss?

January 25 (2 weeks ago)

Edited January 25 (2 weeks ago)
Gauss
Forum Champion

So problem 1: 
D&D 5e 2014 by Roll20 character sheet attack rolls cannot have a query in them. To solve that we will need to make a macro of the attack. For that I will need the template of the attack. 

Please trigger the weapon, click the chat box where you type, click the up arrow on your keyboard, copy the text and paste it here. 

Problem 2: 
Damage, this is solved by adding it in via the template as above. 

Note: if your player rolls damage separately please provide the damage template as well (same instructions except it is damage for the weapon). 

Problem 3: 
AC changes. This should be simple to have ChatSetAttr apply the AC change using the same query as the one that modifies attack/damage. 

January 25 (2 weeks ago)

Amazing, okay, thank you! here's the attack template:

@{Konstantin Bellows|wtype}&{template:atk} {{mod=+11}} {{rname=[Defender longsword](~-NjJ6oL05Ahx_zi5gxPf|repeating_attack_-OHAJFJZbYCJYAa5Ee4I_attack_dmg)}} {{rnamec=[Defender longsword](~-NjJ6oL05Ahx_zi5gxPf|repeating_attack_-OHAJFJZbYCJYAa5Ee4I_attack_crit)}} {{r1=[[@{Konstantin Bellows|d20}cs>20 + 3[STR] + 5[PROF] + 3[MAGIC]]]}} @{Konstantin Bellows|rtype}cs>20 + 3[STR] + 5[PROF] + 3[MAGIC]]]}} {{range=}} {{desc=}} {{spelllevel=}} {{innate=}} {{globalattack=@{Konstantin Bellows|global_attack_mod}}} ammo= @{Konstantin Bellows|charname_output}


here's the damage template (which I got when clicking the weapon name in the above template):

%{-NjJ6oL05Ahx_zi5gxPf|repeating_attack_-OHAJFJZbYCJYAa5Ee4I_attack_dmg}

As for the AC, I set up three global AC modifiers (1, 2, 3) to reflect that within her character sheet, like so:


And based on some advice Keith gave me for adding a damage modifier to a macro, it seems like something similar could work with the AC? which it sounds like is what you're suggesting?

thanks for your help!

January 25 (2 weeks ago)

You can add queries to the sheet attack rolls, but you have to go through the description input field - for example, putting the following in the description of a weapon attack gives you a query for selecting defender modifier for the attack:

}} {{r1=[[d20}cs>20 + @{strength_mod}[STR] + 3[PROF] + ?{defender|3|2|1|0}[DEFENDER]]]}} @{rtype}cs>20 + @{strength_mod}[STR] + @{pb}[PROF] + ?{defender|3|2||1|0}[DEFENDER] ]]}} {{dmg1=[[1d8 + @{strength_mod}[STR] + ?{defender}[DEFENDER]]]}} {{mod=[[@{pb} + @{strength_mod} + ?{defender}]]

The downside to this approach is that if you roll the attack and damage separately, you get the query on both instances, as the description applies to both.

January 25 (2 weeks ago)

ah, nice, thanks, Tuo!

so that handles the attack and damage nicely, but ideally, I'm hoping for something that would also set the AC to the correct value.

the way the defender sword works (apologies if this is an unnecessary explanation) is that the player can choose to have anything from a +0 to +3 bonus to attack and damage rolls. If they choose 2 or lower, then that lost attack/damage bonus becomes a bonus to AC, so like +1 to atk/dmg and +2 to AC.

January 25 (2 weeks ago)


Ken R. said:

ah, nice, thanks, Tuo!

so that handles the attack and damage nicely, but ideally, I'm hoping for something that would also set the AC to the correct value.

the way the defender sword works (apologies if this is an unnecessary explanation) is that the player can choose to have anything from a +0 to +3 bonus to attack and damage rolls. If they choose 2 or lower, then that lost attack/damage bonus becomes a bonus to AC, so like +1 to atk/dmg and +2 to AC.

For that, I can't get you all the way (as I do not have pro subscription and so can't work mod scripts), but I can give you the attribute that might work with ChatSetAttr - it's @{repeating_acmod_$0_global_ac_val}, assuming you have the AC global modifier for the Defender first in the list of your AC global modifiers. The value of that attribute is the value the modifier contributes to AC, but I'm not sure if you can change it cleanly with ChatSetAttr - manually creating it as a duplicate attribute and changing it creates a phantom modifier that doesn't work and cannot be removed from the sheet.

January 26 (2 weeks ago)

Edited January 26 (2 weeks ago)
Gauss
Forum Champion

Alright, I think I have a setup that should be clean and simple. It is a different direction than I initially indicated. 

The problem: it is difficult to have a single query that affects both attack and damage when they are rolled separately. 
Problem 2: An API Script cannot interrupt something already sent to Roll20 (ie, an attack). 
Using Metascripting tools I think that would be possible but that is over my head. 

So my solution is this: 
User presses a macro, it asks the query, and then plugs all the correct values into the attack. The macro also provides a chat menu button for the user to fire the weapon attack. 

The other advantage to this macro is that they can fire the same macro button to revert the values to no modifier (after combat is over for example).

Please create an Ability macro on the character's Attributes & Abilities tab. Give the Ability macro an appropriate name. Put the following in the body. 

!setattr {{
--name charactername
--nocreate
--silent
--repeating_attack_$0_atkmod|-?{Defender setting?|0|1|2|3}
--repeating_attack_$0_dmgmod|-?{Defender setting?}
--repeating_acmod_$0_global_ac_val|?{Defender setting?}
}}
/w charactername [Defender](~charactername|repeating_attack_$0_attack)


Note1: The three instances of "charactername" (without quotes) needs to be replaced by the character's name. 

Note2: each instance of "$0" (without quotes) needs to be tweaked to properly account for which weapon is being used or which global modifier is being used. Change "0" as desired so that it reads the correct line number.
For example, the 3rd weapon would be "$2" (without quotes). 

Note3: This only requires one instance of Global AC modifier. You do not need four Global AC lines for this purpose anymore. :)

Note4: Remove the line that says "--silent" (without quotes) while testing. This will output a statement of what is being changed. Restore the "--silent" line when you are done testing to not annoy the user. 

Warning: If there is normally anything in the red boxes (see image) this will overwrite those boxes. The normal values in those boxes need to be added to the macro above in the relevant lines. 

 

January 27 (2 weeks ago)

Ah, thank you!

So I should add the code you have above and the attack template code to a single macro? and I can switch it to roll damage automatically if that would be easier / smoother?

January 27 (2 weeks ago)
timmaugh
Pro
API Scripter

What Gauss gave you included a button at the end to prompt the user to actually attack. If you wanted to combine the parts (setting the modifiers, then running the attack), you would need to remove that button.

Of course, if you wanted to combine them, you would need to account for ChatSetAttr having to process your command (a small amount of time). Metascripts can help with that, but it might take some further changes... For instance, running the repeating item attack from a button like Gauss has it, the shorthand character references will still resolve (ie, @{wtype} instead of @{Volcano Man|wtype}). Running from a script, those would probably need to be expanded, or Fetch would need to be updated to expand those automatically.

(Alternatively, if Gauss can explain how the query would be needed by both the CSA line and the attack line, I might be able to point out whether/how metascripts can help with *that*, too.)

January 27 (2 weeks ago)
Gauss
Forum Champion


Ken R. said:

Ah, thank you!

So I should add the code you have above and the attack template code to a single macro? and I can switch it to roll damage automatically if that would be easier / smoother?

You cannot combined them, that is why I gave you the button. 

You would need a Metascript as Timmaugh stated to have ChatSetAttr fire first, and the attack second. 

The reason for this is is EVERYTHING is sent to the chat before the API Command is even processed.
Example:
Player pushed button
Attack (which is after the API Command) is sent to chat and output to everyone. 
API Command is executed, which now modifies things that are already long gone. 
Result: the attack is not properly set up. 

January 27 (2 weeks ago)
Gauss
Forum Champion


timmaugh said:


(Alternatively, if Gauss can explain how the query would be needed by both the CSA line and the attack line, I might be able to point out whether/how metascripts can help with *that*, too.)


The query is determining the value in ChatSetAttr which then sets the values in the actual attack. ChatSetAttr would need to run before the command to make the attack runs. Of course, Roll20 doesn't natively do that, but a Metascript might delay the attack command until after ChatSetAttr has run?

January 27 (2 weeks ago)

My expertise ends where scripts start, and I have no way to test this myself - but couldn't you just use the same query for both ChatSetAttr and the attack? Something like...

!setattr {{
--name charactername
--nocreate
--silent
--repeating_acmod_$0_global_ac_val|?{Defender setting?|3,0|2,1|1,2|0,3}
}}
@{repeating_attack_$0_attack}

And then have

}} {{r1=[[d20}cs>20 + @{strength_mod}[STR] + @{pb}[PROF] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} @{rtype}cs>20 + @{strength_mod}[STR] + @{pb}[PROF] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER] ]]}} {{dmg1=[[@{repeating_attack_$0_dmgbase} + @{strength_mod}[STR] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} {{mod=[[@{pb} + @{strength_mod} + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]] ]]

in the attack description (if you want to roll damage separately, that can be done without re-querying, but it requires a few extra steps to set up) - queries match through line breaks, so using the same query for both shouldn't be an issue.

Like I said, I have no way to test this myself, though.

January 27 (2 weeks ago)
Gauss
Forum Champion


Tuo said:

My expertise ends where scripts start, and I have no way to test this myself - but couldn't you just use the same query for both ChatSetAttr and the attack? Something like...

!setattr {{
--name charactername
--nocreate
--silent
--repeating_acmod_$0_global_ac_val|?{Defender setting?|3,0|2,1|1,2|0,3}
}}
@{repeating_attack_$0_attack}

And then have

}} {{r1=[[d20}cs>20 + @{strength_mod}[STR] + @{pb}[PROF] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} @{rtype}cs>20 + @{strength_mod}[STR] + @{pb}[PROF] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER] ]]}} {{dmg1=[[@{repeating_attack_$0_dmgbase} + @{strength_mod}[STR] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} {{mod=[[@{pb} + @{strength_mod} + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]] ]]

in the attack description (if you want to roll damage separately, that can be done without re-querying, but it requires a few extra steps to set up) - queries match through line breaks, so using the same query for both shouldn't be an issue.

Like I said, I have no way to test this myself, though.


Hmmm, that isn't working. The dice rolls but nothing is being added in on the attack. 

I think I might have a way forward though, I'll work on it. 

January 28 (2 weeks ago)

Edited January 28 (2 weeks ago)


Gauss said:


Tuo said:

My expertise ends where scripts start, and I have no way to test this myself - but couldn't you just use the same query for both ChatSetAttr and the attack? Something like...

!setattr {{
--name charactername
--nocreate
--silent
--repeating_acmod_$0_global_ac_val|?{Defender setting?|3,0|2,1|1,2|0,3}
}}
@{repeating_attack_$0_attack}

And then have

}} {{r1=[[d20}cs>20 + @{strength_mod}[STR] + @{pb}[PROF] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} @{rtype}cs>20 + @{strength_mod}[STR] + @{pb}[PROF] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER] ]]}} {{dmg1=[[@{repeating_attack_$0_dmgbase} + @{strength_mod}[STR] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} {{mod=[[@{pb} + @{strength_mod} + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]] ]]

in the attack description (if you want to roll damage separately, that can be done without re-querying, but it requires a few extra steps to set up) - queries match through line breaks, so using the same query for both shouldn't be an issue.

Like I said, I have no way to test this myself, though.


Yes, but you still cannot set up the damage that way. 
Although, I guess you could set up the damage via ChatSetAttr while using the attack in the template. I can play with that and test it later. 

Edit: also I just realized a problem that Tuo fixed regarding my query, nice catch. 

I'm glad it works  I found the issue, I missed a @{ in the r1 row. The damage is already included in case the attack and damage are rolled at once, but if they're rolled separately, what can be done is to have

}} {{r1=[[@{d20}cs>20 + @{strength_mod}[STR] + @{pb}[PROF] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} @{rtype}cs>20 + @{strength_mod}[STR] + @{pb}[PROF] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER] ]]}} {{dmg1=[[@{repeating_attack_$0_dmgbase} + @{strength_mod}[STR] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} {{mod=[[@{pb} + @{strength_mod} + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]] ]]}} {{rname=[@{repeating_attack_$0_atkname}](` %{@{character_name}|defender-damage} {{dmg1=[[@{repeating_attack_$0_dmgbase} + @{strength_mod}[STR] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}}"style=" display:inline-block; border: 1px solid black; border-radius: 5px; background-color; #e8e8e8; color: black; text-align: center; font-weight: bold; padding: 2px; margin-bottom: 3px)}} {{rnamec=[@{repeating_attack_$0_atkname}](` %{@{character_name}|defender-damage} {{dmg1=[[@{repeating_attack_$0_dmgbase} + @{strength_mod}[STR] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} {{crit=1}}"style=" display:inline-block; border: 1px solid black; border-radius: 5px; background-color; #e8e8e8; color: black; text-align: center; font-weight: bold; padding: 2px; margin-bottom: 3px)

as the attack description, and then have an ability called defender-damage, consisting of

&{template:dmg} {{damage=1}} {{dmg1flag=1}} {{dmg1type=@{repeating_attack_$0_dmgtype}}} {{crit1=[[@{repeating_attack_$0_dmgbase}]]}} {{desc=}}

This way, you don't get queried again for the defender mode, as the selection is baked into the damage button and the description isn't added again.

EDIT2 - set up like this, the query works both with auto-rolling damage and without, and should by all reason work with ChatSetAttr.

January 28 (2 weeks ago)

Edited January 28 (2 weeks ago)
Gauss
Forum Champion


@{Konstantin Bellows|wtype}&{template:atk} {{mod=+11}} {{rname=[Defender longsword](~-NjJ6oL05Ahx_zi5gxPf|repeating_attack_-OHAJFJZbYCJYAa5Ee4I_attack_dmg)}} {{rnamec=[Defender longsword](~-NjJ6oL05Ahx_zi5gxPf|repeating_attack_-OHAJFJZbYCJYAa5Ee4I_attack_crit)}} {{r1=[[@{Konstantin Bellows|d20}cs>20 + 3[STR] + 5[PROF] + 3[MAGIC]]]}} @{Konstantin Bellows|rtype}cs>20 + 3[STR] + 5[PROF] + 3[MAGIC]]]}} {{range=}} {{desc=}} {{spelllevel=}} {{innate=}} {{globalattack=@{Konstantin Bellows|global_attack_mod}}} ammo= @{Konstantin Bellows|charname_output}


Alright, please give this a try. 

@{Konstantin Bellows|wtype}&{template:atk} {{mod=+[[@{strength_mod} + @{pb} + ?{Defender AC?|0,3|1,2|2,1|3,0}]]}} {{rname=[Defender longsword](~-NjJ6oL05Ahx_zi5gxPf|repeating_attack_-OHAJFJZbYCJYAa5Ee4I_attack_dmg)}} {{rnamec=[Defender longsword](~-NjJ6oL05Ahx_zi5gxPf|repeating_attack_-OHAJFJZbYCJYAa5Ee4I_attack_crit)}} {{r1=[[@{Konstantin Bellows|d20}cs>20 + @{strength_mod}[STR] + @{pb}[PROF] + ?{Defender AC?}[MAGIC]]]}} @{Konstantin Bellows|rtype}cs>20 + @{strength_mod}[STR] + @{pb}[PROF] + ?{Defender AC?}[MAGIC]]]}} {{range=}} {{desc=}} {{spelllevel=}} {{innate=}} {{globalattack=@{Konstantin Bellows|global_attack_mod}}} ammo= @{Konstantin Bellows|charname_output}
!setattr {{--name Konstantin Bellows --nocreate --silent --repeating_acmod_$0_global_ac_val|[[3-?{Defender AC?}]] --repeating_attack_$0_dmgmod|-[[3-?{Defender AC?}]]}}

The query is set to indicate the AC you are pulling from the magic bonus. 

I went back to my original design, use a template followed by the ChatSetAttr command. Since the damage roll is happening later the ChatSetAttr command can insert the proper value into that. 

Additionally I updated the template to account for Strength and PB changes and the "mod=" bonus will be correct.

January 28 (2 weeks ago)
Gauss
Forum Champion

LOL Tuo, I deleted my previous post because of an error I found in it. And you still managed to reply to it. :D

January 28 (2 weeks ago)

Edited January 28 (2 weeks ago)

Did some refining, with this as the attack description

}} {{r1=[[@{d20}cs>20 + @{strength_mod}[STR] + @{pb}[PROF] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} @{rtype}cs>20 + @{strength_mod}[STR] + @{pb}[PROF] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER] ]]}} {{dmg1=[[@{repeating_attack_$0_dmgbase} + @{strength_mod}[STR] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} {{mod=[[@{pb} + @{strength_mod} + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]] ]]}} {{rname=[@{repeating_attack_$0_atkname}](` %{@{character_name}|defender-damage} {{dmg1=[[@{repeating_attack_$0_dmgbase} + @{strength_mod}[STR] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} "style=" display:inline-block; border: 1px solid black; border-radius: 5px; background-color; #e8e8e8; color: black; text-align: center; font-weight: bold; padding: 2px; margin-bottom: 3px)}} {{rnamec=[@{repeating_attack_$0_atkname}](` %{@{character_name}|defender-damage} {{dmg1=[[@{repeating_attack_$0_dmgbase} + @{strength_mod}[STR] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} {{crit=1}} {{globaldamagecrit=[[@{global_damage_mod_crit}]]}} "style=" display:inline-block; border: 1px solid black; border-radius: 5px; background-color; #e8e8e8; color: black; text-align: center; font-weight: bold; padding: 2px; margin-bottom: 3px)}} {{globalattack=@{global_attack_mod}}} {{globaldamage=[[@{global_damage_mod_roll}]]}} {{globaldamagecrit=[[@{global_damage_mod_crit}]]}}
!setattr {{
--name charactername
--nocreate
--silent
--repeating_acmod_$0_global_ac_val|?{Defender setting?|3,0|2,1|1,2|0,3}

and this as a saved ability as defender-damage

&{template:dmg} {{damage=1}} {{dmg1flag=1}} {{dmg1type=@{repeating_attack_$0_dmgtype}}} {{crit1=[[@{repeating_attack_$0_dmgbase}]]}} {{desc=}} {{globaldamage=[[@{global_damage_mod_roll}]]}}  {{globaldamagetype=@{global_damage_mod_type}}}

It should all now work from clicking the attack from the character sheet, auto-roll damage or not. But, I still can't test the ChatSetAttr part myself, so I can't promise it works - but it should. Also, it is as hands-off as I could, so all the numbers are loaded from the sheet and from the attack card where relevant.

EDIT: Added global attack modifier compatibility, not sure how to call the total of global damage modifiers though.
EDIT2: I figured it out, it's fully global modifier compatible now.

January 28 (2 weeks ago)

awesome! will try these later tonight and let you know. thank you!

January 31 (1 week ago)

Okay, great -- thanks to you both!

So here is what I put in the attack description:

}} {{r1=[[@{d20}cs>20 + @{strength_mod}[STR] + @{pb}[PROF] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} @{rtype}cs>20 + @{strength_mod}[STR] + @{pb}[PROF] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER] ]]}} {{dmg1=[[@{repeating_attack_$0_dmgbase} + @{strength_mod}[STR] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} {{mod=[[@{pb} + @{strength_mod} + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]] ]]}} {{rname=[@{repeating_attack_$0_atkname}](` %{@{Konstantin Bellows}|defender-damage} {{dmg1=[[@{repeating_attack_$0_dmgbase} + @{strength_mod}[STR] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} "style=" display:inline-block; border: 1px solid black; border-radius: 5px; background-color; #e8e8e8; color: black; text-align: center; font-weight: bold; padding: 2px; margin-bottom: 3px)}} {{rnamec=[@{repeating_attack_$0_atkname}](` %{@{Konstantin Bellows}|defender-damage} {{dmg1=[[@{repeating_attack_$0_dmgbase} + @{strength_mod}[STR] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} {{crit=1}} {{globaldamagecrit=[[@{global_damage_mod_crit}]]}} "style=" display:inline-block; border: 1px solid black; border-radius: 5px; background-color; #e8e8e8; color: black; text-align: center; font-weight: bold; padding: 2px; margin-bottom: 3px)}} {{globalattack=@{global_attack_mod}}} {{globaldamage=[[@{global_damage_mod_roll}]]}} {{globaldamagecrit=[[@{global_damage_mod_crit}]]}}
!setattr {{
--name Konstantin Bellows
--nocreate
--silent
--repeating_acmod_$0_global_ac_val|?{Defender setting?|3,0|2,1|1,2|0,3}



and so when I click the attack on the character sheet, this pops up:



looking good, but also this pops up in the chat:


I select "1" to indicate dropping the atk and dam bonus to 1 and upping AC by 2. And then if it's set to auto-roll damage, I get



and the AC has been increased by 2 -- amazing! it all works! thank you!


If I have auto-roll damage off, it looks like this:


There's an invisible link for damage under the rolls that I can click which produces:



which is accurate and what it should be! Amazing! thank y'all so much! : - )

Is there a way to get the formatting / display in the roll output to look like the standard rolls? like show name, name of weapon all that? Like so? not auto-rolling damage?




February 07 (6 days ago)
Gauss
Forum Champion

Sorry, I hadn't seen the responses to this. 

The ChatSetAttr command wasn't closed with "}}" (without quotes). 
Make sure you close it.

February 07 (6 days ago)

I also missed the reply - the description field will add the }}, so you don't need to add that. What prompts those errors is that you replaced @{character_name} with @{Konstantin Bellows} - copy the macro unaltered, and it should work (the parser will expand @{character_name} into the name on the sheet, you don't need to do it yourself).

February 11 (2 days ago)


Tuo said:

I also missed the reply - the description field will add the }}, so you don't need to add that. What prompts those errors is that you replaced @{character_name} with @{Konstantin Bellows} - copy the macro unaltered, and it should work (the parser will expand @{character_name} into the name on the sheet, you don't need to do it yourself).


ah, thanks! I updated the description, but am still getting the same results.

tho i haven't added the saved ability for defender damage -- I wasn't sure if you intended that to be a global damage mod? or like a macro on the "attributes & abilities" tab?

February 12 (1 day ago)


Ken R. said:


Tuo said:

I also missed the reply - the description field will add the }}, so you don't need to add that. What prompts those errors is that you replaced @{character_name} with @{Konstantin Bellows} - copy the macro unaltered, and it should work (the parser will expand @{character_name} into the name on the sheet, you don't need to do it yourself).


ah, thanks! I updated the description, but am still getting the same results.

tho i haven't added the saved ability for defender damage -- I wasn't sure if you intended that to be a global damage mod? or like a macro on the "attributes & abilities" tab?

That would be the issue, I wrote it to be loaded from the character sheet abilities, so if you didn't save it there, it'll be missing a vital chunk. Technically, I could have written it to not require that, but it would require a lot more html substitutions from me, which I wasn't feeling like at the time.
So, yeah, save that as an ability macro in the attributes & abilities tab, with the specific name, and it should work. Essentially, it's just the non-changing parts of the damage template packaged for convenience, but if it's missing, well, that then breaks both the calls for it and the template it would produce. 

2:39PM (11 hours ago)

So I added that bit as a macro:

Does it matter if I make it a token action? or any of those options? 


I'm still getting the same behavior fwiw with it added. Everything works, but the template isn't coming through quite right? 


thanks for your help!


Tuo said:


Ken R. said:


Tuo said:

I also missed the reply - the description field will add the }}, so you don't need to add that. What prompts those errors is that you replaced @{character_name} with @{Konstantin Bellows} - copy the macro unaltered, and it should work (the parser will expand @{character_name} into the name on the sheet, you don't need to do it yourself).


ah, thanks! I updated the description, but am still getting the same results.

tho i haven't added the saved ability for defender damage -- I wasn't sure if you intended that to be a global damage mod? or like a macro on the "attributes & abilities" tab?

That would be the issue, I wrote it to be loaded from the character sheet abilities, so if you didn't save it there, it'll be missing a vital chunk. Technically, I could have written it to not require that, but it would require a lot more html substitutions from me, which I wasn't feeling like at the time.
So, yeah, save that as an ability macro in the attributes & abilities tab, with the specific name, and it should work. Essentially, it's just the non-changing parts of the damage template packaged for convenience, but if it's missing, well, that then breaks both the calls for it and the template it would produce. 




You don't need to check either of the boxes, you just need to save it by pressing the check mark (abilities that are still in the edit view cannot be called). If it still doesn't quite produce the right template, can you post both parts of the macro you have and a shot of the chat output? Also, just to make sure, you have the defender attack listed first on your list of attacks on the character sheet, right?

I did test this in my test game, and though I don't have the pro subscription to test the script part of it, that shouldn't interfere with the template in any way, as it is on a different line.

I did notice though that this macro in the attack description does disrupt the setting to show the attacker's name on the template (for reasons I'm not entirely clear on) - but that's easy enough to fix by adding that row manually as {{charname=@{character_name}}}, for

}} {{r1=[[@{d20}cs>20 + @{strength_mod}[STR] + @{pb}[PROF] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} @{rtype}cs>20 + @{strength_mod}[STR] + @{pb}[PROF] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER] ]]}} {{dmg1=[[@{repeating_attack_$0_dmgbase} + @{strength_mod}[STR] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} {{mod=[[@{pb} + @{strength_mod} + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]] ]]}} {{rname=[@{repeating_attack_$0_atkname}](` %{@{character_name}|defender-damage} {{dmg1=[[@{repeating_attack_$0_dmgbase} + @{strength_mod}[STR] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} "style=" display:inline-block; border: 1px solid black; border-radius: 5px; background-color; #e8e8e8; color: black; text-align: center; font-weight: bold; padding: 2px; margin-bottom: 3px)}} {{rnamec=[@{repeating_attack_$0_atkname}](` %{@{character_name}|defender-damage} {{dmg1=[[@{repeating_attack_$0_dmgbase} + @{strength_mod}[STR] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} {{crit=1}} {{globaldamagecrit=[[@{global_damage_mod_crit}]]}} "style=" display:inline-block; border: 1px solid black; border-radius: 5px; background-color; #e8e8e8; color: black; text-align: center; font-weight: bold; padding: 2px; margin-bottom: 3px)}} {{globalattack=@{global_attack_mod}}} {{globaldamage=[[@{global_damage_mod_roll}]]}} {{globaldamagecrit=[[@{global_damage_mod_crit}]]}} {{charname=@{character_name}}}
!setattr {{
--name charactername
--nocreate
--silent
--repeating_acmod_$0_global_ac_val|?{Defender setting?|3,0|2,1|1,2|0,3}

(using a dagger as a stand-in for the weapon, loading the damage dice, damage type, and weapon name from the weapon)