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

Need help debugging a macro

I'm trying to get a macro to work but I'm getting the following error; TypeError: Cannot read property 'substring' of undefined The macro in question is the following: Melee Weapon Attack #UnarmedStrike  In addition to its usual effects, a creature within 5 feet of the original targets takes @{INT} fire damage. The UnarmedStrike macro is the following: Roll to Hit: /r 1d20 @{DEX} Damage /r 1d4 @{DEX} ?{Magus Stance?|Yes, force|No, bludgeoning} damage Plz halp.
What exactly are you building the macro in?
1534023673

Edited 1534027311
Mike  said: What exactly are you building the macro in? Sorry, but I don't understand what you mean.
1534035296
vÍnce
Pro
Sheet Author
Which sheet are you using?  Verify your attribute calls are correctly named.   I would suggest adding "selected" to your attribute calls as well and change the rolls into inline rolls by wrapping them within double square brackets.  It just helps compact things a little.  You can still hover over inline rolls in chat to see the details of the roll. Here's a slightly modified version of your macros(included selected on attributes, made rolls inline, and added the attribute mod to the roll, ie as per unarmored strike); Melee Weapon Attack #UnarmedStrike  In addition to its usual effects, a creature within 5 feet of the original targets takes [[@{selected|INT}]] fire damage. #UnarmedStrike Roll to Hit: [[1d20+@{selected|DEX}]] Damage: [[1d4+@{selected|DEX}]] ?{Magus Stance?|Yes, force|No, bludgeoning} damage
1534168664
The Aaron
Pro
API Scripter
I'm going to guess that you have the call to #UnarmedStrike in a Character Ability (I believe that's what Mike was referring to).  Character Abilities have the special property that any bare Attribute reference (like @{INT} ) is resolved as if you'd specified the current Character (like @{Bob the Slayer|INT} ).  Macros and the Chat Input do not have this special property, which is likely why your bare Attribute reference @{DEX} is causing that TypeError.  It is interpreting @{DEX} as @{DEX|}, a Character named "DEX" and an Attribute (property) named "", the empty string, which is "undefined'. Your only options for resolving this are going to be: 1) Create your #UnarmedStrike as an Ability on the same Character instead of a Macro.  You can call abilities with the %{ } syntax. 2) Use the @{selected| } specifier in your Macro, and commit to always having a Token that represents your Character selected.