Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Boolean problem, and solution (sort of)

Author
Message
Ratty Rat
22
Years of Service
User Offline
Joined: 24th Sep 2002
Location:
Posted: 26th Feb 2003 15:13
The following code should tell you the value of the boolean in the type:-




It works with the boolean set to 1, if its zero it shows both answers (weird).
The following variation fixes it:-


The Big Babou
22
Years of Service
User Offline
Joined: 10th Feb 2003
Location: Cyberspace
Posted: 26th Feb 2003 15:28
i'm still thinking about the problem with the first code snippet, but for the second one:
0 and variable always returns 0, variable and variable2 returns 1 when both variables are 1
MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 26th Feb 2003 15:43
I think there is a problem with boolean variables anyway - try it with, say, integers and see what happens.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
The Big Babou
22
Years of Service
User Offline
Joined: 10th Feb 2003
Location: Cyberspace
Posted: 26th Feb 2003 15:53
perhaps kind of bug
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 26th Feb 2003 16:19
personally i'd write it


to me it doesn't seem like a bug because DarkBasic doesn't have an automatic TRUE / FALSE indication with variables (and why should it?)

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
Ratty Rat
22
Years of Service
User Offline
Joined: 24th Sep 2002
Location:
Posted: 26th Feb 2003 17:19
Raven - Try changing the boolean to 1, your way does not work.

TheBigBabou - I see what your saying, IE that a boolean 'AND' would return 0, however it obviously does not or else the second print would never get run, which is does when the boolean is zero.

MrTAToad - Works fine with integers (using Ravens method that is) but in theory using true booleans should be quicker.

Incidentally (and with a nod to Raven here) this works too:-
MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 26th Feb 2003 18:05
Indeed it should be better with booleans, which makes me think the boolean type is bugged...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Shadow
22
Years of Service
User Offline
Joined: 17th Oct 2002
Location: In the shadows
Posted: 26th Feb 2003 23:48
I had a problem with booleans

e.g.

Doesn't text "exist" ever



whereas this prints even when it's not supposed to:



The only way around it was to set an integer equal to the boolean, e.g.

integer1=win(1).exist

and then check if the integer equalled 1, e.g.

if integer1
print "exist"
endif

OR

if integer1=1
print "exist"
endif
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 27th Feb 2003 02:19
i wonder why these problems never arrose for fmtBSP as i check the boolean value of the binary in a similar way

you know i think perhaps we need more precise operators
like adding == for boolean match and such ... but then again maybe it because i'm not actually using a boolean value, i'm checking a bytes boolean value - but still use a boolean to check it against. ho hum eh

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?

Login to post a reply

Server time is: 2025-05-20 02:18:58
Your offset time is: 2025-05-20 02:18:58