cujo56 2 Posted June 2, 2014 Report Share Posted June 2, 2014 Is it just my system (or me) but is there something wrong with the Ubot Comparison function? set(#testvar, 1, "Global")if($comparison(#testvar, "=", $true)) { then { alert("Has Value") } else { alert("Does Not Have Value") }} I would expect this simple statement to pop up the Alert with "Has Value" because the variable #testvar has a value of 1 and is true. Instead ubot is telling be this is false and giving me the else Alert. What am I missing here? Quote Link to post Share on other sites
Steve 30 Posted June 2, 2014 Report Share Posted June 2, 2014 for your example, try setting #testvar = $true... or use the comparison to check if #testvar = 1 set(#testvar, 1, "Global") if($comparison(#testvar, "=", 1)) { then { alert("Has Value") } else { alert("Does Not Have Value") } } Quote Link to post Share on other sites
Bot-Factory 602 Posted June 2, 2014 Report Share Posted June 2, 2014 True is not 1 true = true 1 = 1 set(#testvar, "true", "Global") if($comparison(#testvar, "=", $true)) { then { alert("Has Value") } else { alert("Does Not Have Value") } } Dan Quote Link to post Share on other sites
cujo56 2 Posted June 2, 2014 Author Report Share Posted June 2, 2014 Thanks Steve and Dan, Yes 1=1, and true = $true. I am trying to see if the variable as a value, any value. Is $true just for checkboxes? . Asserting the negative, !=, with $nothing works. Related, is there a built in way to test a variable type (numeric integer/decimal, text, date, etc.) or do I have test my variable with a regular expression? Quote Link to post Share on other sites
Bot-Factory 602 Posted June 2, 2014 Report Share Posted June 2, 2014 Thanks Steve and Dan, Yes 1=1, and true = $true. I am trying to see if the variable as a value, any value. Is $true just for checkboxes? . Asserting the negative, !=, with $nothing works. Related, is there a built in way to test a variable type (numeric integer/decimal, text, date, etc.) or do I have test my variable with a regular expression? I always use != $nothing if I want to check if a variable has a value.There are no variable types in ubot. So you can't distinguish between integer or text. Maybe with an eval / javascript command. But not with one of the built in functions. As far as I know. Dan 1 Quote Link to post Share on other sites
the_way 52 Posted June 2, 2014 Report Share Posted June 2, 2014 $true != $false Quote Link to post Share on other sites
blumi40 222 Posted June 2, 2014 Report Share Posted June 2, 2014 $true != $falsehttp://img3.wikia.nocookie.net/__cb20130815124007/transformers-legends/images/c/c4/Triple-facepalm.jpg 3 Quote Link to post Share on other sites
cujo56 2 Posted June 3, 2014 Author Report Share Posted June 3, 2014 yeah, I was thinking of how True works in PHP... (so long as the variable has a value and isn't false it is then considered True) Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.