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

What is wrong with this macro?

January 27 (10 years ago)
Tom
Plus
Sheet Author
I have no clue what is breaking this macro. I run it without the @{target|armor} and it works fine. I run it WITH @{target|armor} and it sticks. The target in question has an armor score of 0. This is frustrating the living daylights out of me, so I'm really hoping someone can shed some light on this.

/em rolls [[{((?{Bonus Successes|0}+?{Ability+DM|2})-(?{Opponent Dodge/Parry Successes|0}+@{target|armor}))d10!sd}>7]] points of damage

Thanks!
January 27 (10 years ago)
The Aaron
Pro
API Scripter
hmm.. I just tried this, and while I do get the Target Selection box hanging out for the whole time, finishing out all the Roll Queries completes the macro and the Target Selection box goes away for me. I ran this on Dev, are you on Dev or Prod?
January 27 (10 years ago)

Edited January 27 (10 years ago)
Tom
Plus
Sheet Author
Prod. The roll queries should all default to 0, so why should leaving them alone be an issue?

edit: Just ran it adding 1 to each query and still no luck. Not sure why the hang up would be a 0 value in the armor score.

January 27 (10 years ago)
The Aaron
Pro
API Scripter
Hopefully someone has some ideas... =/
January 27 (10 years ago)
Tom
Plus
Sheet Author
And what's really weird is this works perfectly well in another campaign:

/em rolls [[{((?{Bonus Successes|0}+@{Agility}+2)-(?{Opponent Dodge Successes|0}-@{target|armor}))d10!sd}>7]] points of damage
January 27 (10 years ago)
Tom
Plus
Sheet Author
The strangeness keeps adding up.

On a lark, I tried it against a generic NPC token and it worked just fine.

Tried it against a PC token. Got the hanging target.

Checked the character sheet for an error in the "armor" attribute formula (the same one the NPC uses, BTW), found a possibility and fixed it. Again, macro worked against the NPC, but not against the PC.

Set both PC and NPC armor values to 0 (could be the issue). Again, worked against the NPC, not against the PC.

Just...strange.
January 28 (10 years ago)

Edited January 28 (10 years ago)
Roger A.
Sheet Author
Try checking the attributes and abilities section of the players sheet for another attribute of the same name with a different value than 0. It has to be something specific to that character if it works fine on something else using the same sheet. Unless it doesn't work on any player characters, but works on all the npc characters. That would mean there is definitely something wrong with the sheet.
Edit= if you can confirm it works on other pc tokens but just not that one, you might have to make another version of the character, then re-input the info by hand and reassign a new default token etc...
January 28 (10 years ago)
Tom
Plus
Sheet Author
There is an instance of duplication. The armor attribute is identified in two places in the sheet, with the value being the same formula in both places. The figures that make up the formula are not duplicated. This could easily be fixed, but not sure why it would cause the problem. Guess I'll try it out and see if it fixes the issue. AND not sure why it would affect some characters and not others.
January 28 (10 years ago)
Roger A.
Sheet Author
When I mentioned the duplication I actually meant on the attributes and abilities tab, not the actual character sheet itself. Which sheet is this with? Since you said something about changing it I assume this is a custom sheet? Does it work on all of your tokens except the one, or is it an issue of it works for NPCs, but not for PCs? Is the token it doesnt work for an imported token or one created in the campaign? One thing I found in my messing around with custom sheets and their attributes, is if you change the formulas for auto-calculated attributes it can create a second copy of that attribute that is a pain to get rid of, and that can cause all sorts of weird fails in your rolls. I actually got to a point where I had to recreate the character as a new entry in the journal and delete the old one, to fix some problems I had after a semi-major rewrite of my character sheet. I think it had to do with the way the autocalc attribute entries are stored vs the way other attributes are, but I don't know for sure.
January 28 (10 years ago)
Tom
Plus
Sheet Author
Roger,

i thought to check that and didn't see any red flags. I need to do a bit more experimenting, but right now the problem appears to be isolated to the three PC tokens. I still need to create entries for the bad guys, so I'll test the macro against them. If it doesn't work, then it's a real problem. The silver lining here is that the macro that isn't working is designed for the players, so if it doesn't affect the PCs but does work on the opposition, it can still do the job.

But for the life of me I can't figure out where the issue with the armor attribute would be.
January 28 (10 years ago)
Tom
Plus
Sheet Author
Test complete. No dice. Macro doesn't work against newly created NPC.

The only thing I can think it could be is the duplicate attributes built into the sheet. So I'm going to tweak that and see what happens.
January 28 (10 years ago)
Tom
Plus
Sheet Author
Testing continues. On a lark, I decided to go a bit old school and use my old macro formula:

/r {[[((?{Bonus Successes|0}+?{Ability+DM|2})-?{Opponent Dodge/Parry Successes|0})]]d10!sd>7} vs @{target|armor}[armor]

This works perfectly and has no issues. But when I put the targeted attribute inside the calculation field, like so...

/r {[[(((?{Bonus Successes|0}+?{Ability+DM|2})-?{Opponent Dodge/Parry Successes|0})-@{target|armor})]]d10!sd>7}

...it breaks.

So I'm starting to think this isn't a attribute issue so much as it is a calculation issue. Either my brackets are messed up, or the mathematics are running into a error. I'm leaning towards submitting this problem as a bug, because it's just so...off. I was hoping someone might catch a bracket issue by now.
January 28 (10 years ago)
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Tom, try this:
/em rolls [[{(?{Bonus Successes|0}+?{Ability+DM|0}-?{Opponent Dodge/Parry Successes|0}-@{target|armor})d10!sd}>7]] points of damage
January 28 (10 years ago)
Tom
Plus
Sheet Author
Sorry Steve. Doesn't work. Works on older journals, but not on anything newly created, PC or NPC. Just hangs up.
January 28 (10 years ago)
Tom
Plus
Sheet Author

AH-HA!


FIGURED IT OUT! And I still have hair left. Oh you sorry stinking unforgiving backroom wrangling code error!

Awhile back (for reasons that made sense at the time) I was trying to get the character sheet attributes to play nicely with the Attributes/Abilities page of the character journal. So a LOT of the formula calculations I put into inline brackets. This way, when you make a change on the character sheet, it shows up as a number in the attributes/abilities tab rather than ((X+Y)/Z)*A or whatever. Lovely right?

Except the dice system chafes at making an inline roll inside of an inline roll.

So when my macro read:

/em rolls [[{(?{Bonus Successes|0}+?{Ability+DM|0}-?{Opponent Dodge/Parry Successes|0}-@{target|armor})d10!sd}>7]] points of damage

What the system was reading was:

/em rolls [[{(?{Bonus Successes|0}+?{Ability+DM|0}-?{Opponent Dodge/Parry Successes|0}-[[@{arvalue}+@{shield}+@{armormod}]])d10!sd}>7]] points of damage

The results were explosive.

Unfortunately, there isn't a coherent error code that pops up when you do this. It just hangs, which I suppose an even less helpful syntax error code than what already pops up.

So I removed the inline brackets from the armor attribute values and POOF! Now everything works. HUZZAH!

So Steve, if you are still following this, any chance this can be worked into a real error code somewhere? Assuming I'm not the only nitwit with an overly complicated sheet that is going to run into this problem?
January 28 (10 years ago)

Edited January 28 (10 years ago)
The Aaron
Pro
API Scripter
Awesome!!!

Tom, I just uploaded a script in another thread that I just realized could be generalized for the problem it's solving: https://app.roll20.net/forum/post/1544636/#post-15...

In particular, once generalized it could maintain calculated forms of those formula attributes. =D
January 28 (10 years ago)
Tom
Plus
Sheet Author
Nice tip! Thanks, Aaron.