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

Macro works with one GM and game, does not work with different GM and game.

I built a macro for calculating damage taken after subtracting armor.  The macro works on my game in my account. It does not work in my boyfriend's game in his account.  Essentially, the macro takes the damage input, then subtracts the armor's "stopping power" (SP) and also the character's "body type modifier" (BTM).  Here is the macro. It is done as "show as token action". Standard-ammo &{template:custom} {{title=@{selected|character_name} is getting DAMAGE from}}    {{subtitle=Standard ammo}}    {{ [[ 0 + ?{Damage|0} - ?{SP|0} - @{selected|BTM} ]] }} I'm making these macros because other types of ammunition have more complex calculations than this example; those macros have the same problem.  Can anyone explain what the problem is -- or might be? AND how to fix it? One possibility, in my account, I have the character tokens on the map layer. But in his account, right now they are on the token layer. And the result of the calculation in his game is always zero. Since I play in his game, I can't move tokens onto a map layer and retest the macro.
What game are you playing and what character sheet are you using? Is that the same for your boyfriend's game? Are you playing in a Jumpgate or legacy game?  Is that the same for your boyfriend's game? When it "doesn't work" in your boyfriend's game in his account, what is happening or not happening?  Screenshots would be helpful. Tokens on the map layer versus token layer shouldn't impact this macro at all.
Hi Jarren, Game is Cyberpunk (mostly version 2020). The character sheet is one that I built. And yes, it's the same in both. My game is mostly for development of things for his game. (That is, I'm not actually GM'ing a game.) Eg, I built and debugged the character sheet in my game, then transferred the code to his. I don't know what you mean by Jumpgate or legacy game. What happens in his game is that instead of doing a calculation, the result is always 0. That is, when one hovers over the calculation, it says something like [ 0 + 30 - 20 - 3 ], which should result in a 7. But instead it results in 0. No matter what the inputs are. (There, the damage was 30 and the SP was 20 and the BTM was 3.) The BTM comes off the character sheet. Also the character name part is working fine. Result in boyfriend's game: Result in my game (also with damage of 30 and SP of 20, but BTM of 1) :
1732325691

Edited 1732326881
Do any of the attribute values on the sheet in his game have a + or - at start? That'd result in a parser halt, from double operation. You can proof against this by placing 0 immediately in front of the query and each attribute, without space in between. Edit: to clarify, ++ and -- cause a parser halt, if you put a 0 in front of the query or attribute call, this is read as +0+X, rather than the breaking ++X. Edit2: for the reductions, do (0@{attribute}) Instead, so a - +X doesn't turn into -0 +X. Also, I'm not sure why you have the 0 at the start, it seems redundant - just starting with the query should be fine. Edit3: or you can just put parentheses around each query and attribute call, that sanitizes then just fine and prevents the undesired parser halt.
Hi Tuo, Thanks for this reply. Some of these terms are over my head, but I think I understand that putting 0 in front may be causing a "parser halt" problem. I'm guessing that means a variety of crashing the computation. Also that this frontal was serving no useful function. I have incorporated these two suggestions -- remove that frontal 0 and change to  (0@{attribute}) -- on my own game. And confirmed that the macro still works. (Of course, well duh.) I will see if this fixes the problem in my boyfriend's game. He needs to make a map layer for me to play with this on, so that I don't inadvertently see things he doesn't want a player to see.
Hi Tuo (and everyone), Aha!! I discovered what was different between his and mine. His BTM's were negative in the character sheet, whereas mine were positive. So I changed the -BTM to +BTM, and that worked. However, there is still the problem that plenty of people's BTMs are 0. So I am now checking to see if that also causes a parser halt. Thanks again!
Aha again!! Macro still works just fine with BTM of zero. Yay!! (Again, probably a well duh. But worth checking out. And yes, I was logged in as boyfriend on previous post.)
1732463154

Edited 1732463181
It's not the zero, it's that if the value is negative (-10, for instance), and if you deduct that value, with -@{attribute}, you end up with --10, which causes the parser to ignore all rolls and math in the inline roll. As long as the value isn't negative, it'll work fine, but if it needs to be negative for whatever reason, you can get around it by writing it as -(@{attribute}) instead, as the parser can handle deducting negative values, it's just that it hiccups if it runs into two minuses or plusses in a row. This behavior is actually useful for some complex macros, as it can be used to alter the behavior of a roll depending on the starting value.
" if it needs to be negative for whatever reason, you can get around it by writing it as -(@{attribute}) instead" Cool, thanks! I'll make that change as well, since a ++ would be just as deadly. The character sheet is set up so that a player could put a positive number into that box as well as a negative.