This code works fine for me:
rem setup screen
sync on
sync rate 60
backdrop on
rem define key constants
#constant Minus 16
#constant Minus2 17
rem main loop
do
rem reset cursor so print command prints to top of screen
set cursor 0,0
rem let user know which keys to press
print "Press <Q> or <W>"
rem check for input
If KeyState(Minus) = 1 OR KeyState(Minus2) = 1
print "horses have souls"
endif
rem refresh screen
sync
rem end of main loop
loop
I did notice that the word
minus is highlighted as if it is a keyword, if DBP is trying to perform a mathematical operation with that command, the error message would make sense to me.
Perhaps you're also doing something wrong after the if statement?
Quote: "Also, does anybody know a good tutorial for dbpro complex logical expressions? As far as i have seen, all tutorials present simple examples of AND, OR, etc. usage."
There's a lot of scattered information, but no real tutorial. You'll have to search the forums for more information.
There are two types of logical operators, bytewise and bitwise operators.
Bytewise
-AND
-OR
-NOT
-XOR
Bitwise
>> (bitshift right)
<< (bitshift left)
&& (bitwise and)
|| (bitwise or)
~~ (bitwise xor)
.. (bitwise not)
This is from the help files:
BITWISE OPERATORS
Bitwise operators, unlike boolean operators work on all the bits of the specified variable or value. There are six bitwise operators as follows:
BITWISE LSHIFT using two less-than symbols will shift all bits one space to the left. %0111 becomes %1110.
BITWISE RSHIFT using two greater-than symbols will shift all bits one space to the right. %0111 becomes %0011.
BITWISE AND signified by the symbol && will AND all bits of one value with another. %1111 && %0011 becomes %0011.
BITWISE OR signified by the symbol || will OR all bits of one value with another. %1111 || %0011 becomes %1111.
BITWISE XOR signified by the symbol ~~ will XOR all bits of one value with another. %1111 ~~ %0011 becomes %1100.
BITWISE NOT signified by the symbol .. will NOT all bits of the right value. %1111 .. %1010 becomes %0101.
TheComet