Jump to content

Vector variable - How to check if ZERO_VECTOR


Nescolet
 Share

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

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

Recommended Posts

Hello,

I need a script that can detect if a global vector variable has any value different than ZERO_VECTOR assigned.

If I write this:

vector alfa;
llSay(0,(string)alfa;

Script will say alfa is <0,0000, 0,0000, 0,0000>.

If I write this:

vector alfa;
if(alfa = ZERO_VECTOR){ llSay(0,(string)alfa;} else {llSay(0,"alfa is set");}

The script will say alfa is set!

If I write this:

vector alfa;
vector blankvector = <0,0000, 0,0000, 0,0000>;
if(alfa = blankvector){ llSay(0,(string)alfa;} else {llSay(0,"alfa is set");}

The script won't say alfa is set again!!

Is there a way to check if vector alfa is ZERO_VECTOR?

Link to comment
Share on other sites

You have to be a wee bit more careful about your typing, that's all.  First of all, check to be sure that you are typing decimal points and not commas.

vector blank_vector = <0.000,0.000,0.000> , not <0,000,0,000,0,000>

Then watch out for the distinction between assignment and comparison.  Test for

if (alfa == ZERO_VECTOR) , not if (alfa = ZERO_VECTOR)

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3881 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...