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.

One-Click API script checkbox type

1477195459

Edited 1477195612
Ada L.
Marketplace Creator
Sheet Author
API Scripter
I'm not sure if this is a bug, or if it's intentional but just seems counter-intuitive. When using checkbox-type user options in scripts for the One-Click API, it is interpretting the checkbox values "true" and "false" as strings rather than as boolean values.  This causes some weirdness when a script writer would want to do something like this: if(globalconfig.myscript.myCheckBoxOption) doTheThing(); else doTheOtherThing(); In this scenario, doTheOtherThing will never be called, because even if the checkbox for the option is unchecked, it is interpretted as the string "false", which is a truthy value. If it's intentionally done this way, I guess I can live with it though. :/
1477678953
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Yeah, that's strange. I can see on the back end it's being saved as a boolean, when it's making it locally it appears to be text. While it probably shouldn't be working that way I'm reluctant to change it now because there are several scripts already making use of it, so I don't want to break existing behavior. I'll go ahead and document the issue to help avoid future confusion.
1477679090
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Ok. Thanks for looking into it though!