Cant get this to work

Blitz3D Forums/Blitz3D Programming/Cant get this to work

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

If entity DebugLog "This always works"
If 2>1 And entity DebugLog "This works only if entity is an Integer - not an entity pointer"


That is incorerct. the pointer is an integer, the reason it is not working the way you expect is due to the nature of the 'and' operator.

The and is combining the bits in the entity value with '1' as 2 is always greater than 1. What you are in effect saying is " if (1 AND Entity) then .... which will only work if the 1st bit of the 32bit integer representing the entity handle is also 1.

What you should be saying is

IF a>b AND entity<>0 then

ENDIF

that is how the AND statements and other bitwise operators NOT Boolean operators in blitz work.