Jump to content

Need lsl help, using ! for NOT


Yamil Dagger
 Share

You are about to reply to a thread that has been inactive for 3857 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts


Yamil Dagger wrote:

I know that adding a ! in scripts means "NOT" but how can I use this code and say while NOT flying? Where do I add the ! or how would I put it?
if (llGetAgentInfo(llGetOwner()) & AGENT_IN_AIR)

Basically I need to detect falling or jumping but not flying.

if (llGetAgentInfo(llGetOwner()) & AGENT_IN_AIR && !(llGetAgentInfo(llGetOwner()) & AGENT_FLYING))

 

// or better

integer info = llGetAgentInfo(llGetOwner());

if(info & AGENT_IN_AIR && !(info & AGENT_FLYING))

 

// alternative way of going about it

if (llGetAgentInfo(llGetOwner()) & (AGENT_IN_AIR | AGENT_FLYING) == AGENT_IN_AIR)

{ETA: Study https://wiki.secondlife.com/wiki/LSL_Operators to learn the difference between logical and bit-wise operators to see how all this works. Keep in mind that logic operators always result in 1 or 0 (TRUE or FALSE) and bit-wise operators result in non-zero (which is interpreted as TRUE) or zero (FALSE).]

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3857 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...