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

[Help] Sheet query suddenly breaks on change.

1543241993
Havoc
Sheet Author
API Scripter
I've got a issue with my sheet + API. Probably mainly sheet. Here's the thing. I've got a long query to calculate Initiative bonus. However, when I log in and change any number on my sheet connected to the calculation, it breaks down. Relogging works, so I don't know what is doing it. The second Argument (PlayerQueryRoll) can be changed to 0, 1 or 2 (or a query) and it was set to 0. API Query: !warinitroll [[@{InitiativeCharacteristic}+@{InitiativeModifier}+?{Modfier|0}]] @{PlayerQueryRoll} @{character_name} Full expression of the first argument: floor(floor( floor((((@{maximumAgility} + floor(@{ag}+@{agAdvance}+@{agMod})) - abs(@{maximumAgility} - floor(@{ag}+@{agAdvance}+@{agMod}))) / 2)/10) + @{agBonusMod} +  @{agBonusUnnatural} ) + @{InitiativeModifier})+?{Modfier|0} Which should give: floor(floor( floor((((60 + floor(44+10+0)) - abs(60 - floor(44+10+0))) / 2)/10) + 0 +  0 ) + 0)+0 Correct Message in logs {"content":"!warinitroll $[[0]] 0 Partheos","inlinerolls":[{"expression":"floor(floor( floor((((60 + floor(44+10+0)) - abs(60 - floor(44+10+0))) / 2)/10) + 0 +  0 ) + 0)+0","results":{"resultType":"M","rolls":[{"expr":"floor(floor(floor((((60+floor(44+10+0))-abs(60-floor(44+10+0)))/2)/10)+0+0)+0)+0","type":"M"}],"total":5,"type":"V"},"signature":false}],"playerid":"-L5Fxccofur3vqwhA5dh","type":"api","who":"Havoc (GM)"} Incorrect Message in logs: {"content":"!warinitroll $[[0]] 1 Partheos","inlinerolls":[{"expression":"2 + 0","results":{"resultType":"M","rolls":[{"expr":"2+0","type":"M"}],"total":2,"type":"V"},"signature":false}],"playerid":"-L5Fxccofur3vqwhA5dh","type":"api","who":"Havoc (GM)"} Suddenly the whole expression changed to 2 + 0. Why? It even broke the second number (1), which should be 0 in this case. It doesn't read the second argument correctly.
I stared at it for a while, but only get a fuzzy feeling that one of the attributes that make up InitiativeCharacteristic is a calculated property that somehow ends up with a string that makes your expression actually a different expression with different arguments (if for example, it contains a bracket or a comma or something like that.)  This is a wild ass theory, but you can rule it out:    I would recommend the following debugging procedure:   1) validate each of the @{attribute} that you are using in your expression by just looking at them in the attributes and abilities section of the sheet.  are any of them returning a nonsense or string value after you make the change? 2) execute InitiativeCharacteristic directly off the attributes and abilities, instead of referencing it in a roll.  Sorry this is weak, but that is all I came up with after staring at this out of context. Cheers, Ammo
1543244012
Havoc
Sheet Author
API Scripter
If I call the query directly (adding character_name| to each of the arguments), it works correctly. Only when I click on the button on the sheet it doesn't work.
1543248294

Edited 1543248315
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
This is definitely something with the macro text entered on the sheet. Havoc said: If I call the query directly (adding character_name| to each of the arguments), it works correctly. Only when I click on the button on the sheet it doesn't work. Do you mean if you call the ability from chat it works, but clicking on the button doesn't? Or just the query attribute? Can you post the full html for the button and for the query attribute radios? I'm guessing that something isn't entered correctly; that's the only way you'd get the log difference.
1543248505
Havoc
Sheet Author
API Scripter
Scott C. said: This is definitely something with the macro text entered on the sheet. Havoc said: If I call the query directly (adding character_name| to each of the arguments), it works correctly. Only when I click on the button on the sheet it doesn't work. Do you mean if you call the ability from chat it works, but clicking on the button doesn't? Or just the query attribute? Can you post the full html for the button and for the query attribute radios? I'm guessing that something isn't entered correctly; that's the only way you'd get the log difference. Found the issue. It was that I had a NPC sheet with an initiative button with the same attribute name. So, if I changed any value, it recalculated and the PC button used the NPC macro. Thanks for the help!
1543248607
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Glad you found the issue