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.

Newcomers DBPro Corner / If not problem

Author
Message
Miles Prower
18
Years of Service
User Offline
Joined: 6th Oct 2006
Location: U.S.A.
Posted: 6th Dec 2007 17:38
i really hope this is just my syntax or some missing library, but every time I build an if(false) not(false) code block, like:

if 0 not 0
enemy_turn()
endif

It executes without fail... shouldn't if 0 void the whole block?

~if 0 and not 0 won't compile.
~I've checked F1 help guides, no info on combining if and not.

thanks for any help offered.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 6th Dec 2007 18:23
Quote: "if 0 not 0 "


just doesn't make sense. What are you trying to do?

NOT isn't designed to be used with If statements - you should use =, <, > or <> along with AND and OR:



TDK_Man

Miles Prower
18
Years of Service
User Offline
Joined: 6th Oct 2006
Location: U.S.A.
Posted: 6th Dec 2007 21:05 Edited at: 6th Dec 2007 21:08
I was under the impression that you could combine IF, NOT, OR, and AND statements so you don't have to deal with so much nesting...
so this



would become this





but i know that the above syntax is wrong, as (if 1=1 not 1=0) Returns true and (if 1=1 and not 1=0) doesn't compile. I've worked around it in my game, but i guess what i want to know now is if it's possible to combine (not), (and), and (or) statements with if statements.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 6th Dec 2007 22:44
Quote: "Actually, you can use NOT with an IF statement."


Yes - what you describe is what I meant. I should have put "NOT isn't designed to be used with If statements in that way".

TDK_Man

Dr Schnitzengruber
17
Years of Service
User Offline
Joined: 19th Jul 2007
Location: C:/Projects/failed/ schnitzengruber
Posted: 7th Dec 2007 00:27
Quote: "if turn(timers(turn)<1 not stats(character)=0
enemy_turn()
endif"


I didn't check this but I think

if turn(timers(turn)<1 and not stats(character)=0
enemy_turn()
endif

works

pcRaider
17
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 7th Dec 2007 08:23
Is "NOT" broken?
Is it a bug?
pcRaider
17
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 7th Dec 2007 11:35
How do you explain this?


print not 1
print not 0

wait key

` -2
` -1
pcRaider
17
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 7th Dec 2007 11:56
A document say it,
I want 0/1 return values.

document
pcRaider
17
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 7th Dec 2007 12:22
Thank you for explanation.
I understand.

However
I want 0/1 return values. (the logic)
I think that normal it. .....
pcRaider
17
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 7th Dec 2007 12:50
I see
Miles Prower
18
Years of Service
User Offline
Joined: 6th Oct 2006
Location: U.S.A.
Posted: 7th Dec 2007 19:01
Quote: "Expressions themselves can only be combined using AND and OR."



thanks for the help, guys.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Dec 2007 16:09
@pcRaider,
If you want a logical NOT, then you can simply take what TDK and WindowsKiller provided and create a standard function:


Utility plugins collection and
http://www.matrix1.demon.co.uk for older plug-ins and example code

Login to post a reply

Server time is: 2024-11-25 09:18:33
Your offset time is: 2024-11-25 09:18:33