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
This post has been closed. You can still view previous posts, but you can't post any new replies.

Sheet button with complex math and !API command added to macro bar bug.

1464553298

Edited 1464553774
DXWarlock
Sheet Author
API Scripter
I believe I found a bug in adding repeating field buttons to the macro bar. Rolling from the sheet is fine, when added to the bar it debugs in the log totally different. My sheet feildset is this:   <fieldset class="repeating_occsk">     <button class="sheet-blank" type='roll' value='!rb 1d100 @{OCCT} ?{Modifier|0} ?{Blind|Y} @{OCCSK}' name='roll_SkillCheck' /></button>     <input type="text" style="width:15px; background:#777; color:#fff;" name="attr_OCCSKLV" value=1>     <input class="sheet-skill" type="text" name="attr_OCCSK" >     <input class="sheet-baseinputbox" type="number" name="attr_OCCSKP">     <input class="sheet-perinputbox" type="number" name="attr_OCCSKPL">     <input disabled="true" type="hidden" type="number" name="attr_min_OCCs" value="@{min_IQ}+@{OCCSKP}+(@{OCCSKPL}*(@{LEVEL}-@{OCCSKLV}))" />     <input disabled="true" type="hidden" type="number" name="attr_min_OCCt" value="(((@{min_OCCs} + 98) - abs(@{min_OCCs} - 98) ) / 2)" />     <input class="sheet-sdinputbox" type="text" style="width:40px;" name="attr_OCCT" value="@{min_OCCt}" disabled="true">   </fieldset> The math for figure out the last row, OCCT is a bit complex. When rolling from the sheet. the  msgFormula sent by the first row (the button) whos value is: !rb 1d100 @{OCCT} ?{Modifier|0} ?{Blind|Y} @{OCCSK} returns API log of: ["!rb","1d100","92","0","Y","Spanish"] Which is correct. But when dragging to the macro bar, logs in API as: ["!rb","1d100","(((((((11-14)","+","0)","+","abs((11-14)","-","0))","/","2)+92+(0*(1-1))","+","98)","-","abs(((((11-14)","+","0)","+","abs((11-14)","-","0))","/","2)+92+(0*(1-1))","-","98)",")","/","2)","0","Y","Spanish"] The only difference in usage is: First one I click on the sheet itself Second I dragged to macro bar and clicked. Gif showing the issue, the 2 rolls from the sheet work, the 3rd on bar doesn't:
1464800816
Phil B.
Forum Champion
Sheet Author
After you hit the button, go to the chat box and hit the up arrow. That should give you the exact macro text that the button sent to chat. Then, do the same thing with the macro bar button. Then if you can paste both of those texts here, I can try and figure out where the issue lies.
1464802801
DXWarlock
Sheet Author
API Scripter
Can do! From the sheet and hitting up gives: !rb 1d100 73 ?{Modifier|0} ?{Blind|Y} Basic Math Dragging it to the bar and hitting up it sends: %{Bobby|repeating_occsk_2_SkillCheck}
1465413662
Phil B.
Forum Champion
Sheet Author
We haven't forgotten about you, I've been looking into this whenever I have some spare time. I have a copy of your game, but I'm not able to use the !rb API script at all, it always errors, so I can't test everything I'd like to. Can you try modifying the button function to be "!rb 1d100 [[@{OCCT}]] ?{Modifier|0} ?{Blind|Y} @{OCCSK}" and see if that fixes anything for you?
1465414052
DXWarlock
Sheet Author
API Scripter
No problem at all, its not world ending or anything. Take your time. And sorry if your having to try to muddle through my API scripts that I muddled together to do things, they aren't the most elegant I'm sure. A lot of them look like the truck stop bathroom version of JS coding :) But I'll be happy to test that when I get some time after work and report back for you. Thanks for taking the time to look into it.
1465431473
DXWarlock
Sheet Author
API Scripter
I THINK that will fix it! my !rb maco looks for a number in that place and they both return: Prowl NPC FAILED!17 out of NaN ($[[0]] + 0) So at least its consistent via button or bar. I just need to work out my API script to get the result of the 2nd roll in the macro and test it. I will let you know
1465474127
DXWarlock
Sheet Author
API Scripter
With a bit of fighting the API to read $[[0]] as a result and not give me that "syntax error expected..'' error I got it working. Thanks for the help. Any idea why the button vs bar would read it different the original way? Just curious.
1465579499
Phil B.
Forum Champion
Sheet Author
Honestly? No idea. This code was written before my time and is quite complex, and would take quite a big of digging to figure out exactly. If it becomes more of an issue we can do the digging, but I'd rather not if we don't have to :P. I'm glad you got everything figured out. I'm going to go ahead and close this thread, if anything else or this same issue pops up again please feel free to open a new thread.