Jump to content
You are about to reply to a thread that has been inactive for 1540 days.

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

Recommended Posts

Posted
Original: if(Tpos!=(OP1|OP2)) { }

What it's doing: if (Detected Vector != ( Vector1 | Vector2 ) ) { }

 

On this line in my script, I get a type mismatch error after "Vector2".

Since it is indeed a vector comparing to other vectors,(double checked) I'm probably doing the operator wrong. I am eternally confused by some operators. So, since I haven't been able to find an answer to this, here goes: What am I doing wrong, or how do you compare (Xvector to Yvector OR Zvector)?

Posted (edited)

You are trying to use logical operations on a vector, which isn't valid. If I am guessing right, what would work for you is:

if (llVecDist(Tpos, OP1) > .01 && llVecDist(Tpos, OP2) > .01) { }

Basically that checks to see if Tpos and either one of the other vectors are very close.... you can adjust the .01 to vary HOW close they have to be to be a match.

You could also use:

if (Tpos != OP1 && Tpos != OP2) { }

But, since vectors are floating point, you may encounter failures if they aren't EXACT matches, even when they should be considered matches.

 

EDIT: I know I goofed calling them logical operators instead of bitwise.... corrected below.

Edited by Phate Shepherd
  • Thanks 1
Posted

 

8 minutes ago, Rowan Afterthought said:

That was quick, Thanks! I get confused by the terminology. Didn't know vectors don't count as logical operators... or... oof I feel dumb. xD

I goofed there.... I meant to say bitwise operations like  | and & can only be performed on integer values. Since vectors are comprised of 3 floating point values, that means you can't use bitwise operators (not to be confused with logical operators like || and &&)

  • Thanks 1
Posted (edited)
41 minutes ago, Rowan Afterthought said:

Original: if(Tpos!=(OP1|OP2)) { }

What it's doing: if (Detected Vector != ( Vector1 | Vector2 ) ) { }

 

On this line in my script, I get a type mismatch error after "Vector2".

Since it is indeed a vector comparing to other vectors,(double checked) I'm probably doing the operator wrong. I am eternally confused by some operators. So, since I haven't been able to find an answer to this, here goes: What am I doing wrong, or how do you compare (Xvector to Yvector OR Zvector)?

What you want is, specifically, this: (At least, based on how you worded your question and code.)

if ( (Xvector != Yvector) || (Xvector != Zvector) )

"if Xvector not equal to Yvector, or Xvector not equal to Zvector" (Extra inner-parentheses for clarity.)

Vectors, integers, lists, etc. are values. Operators are the symbols next to values, that do some kind of operation on one or two values. A full list of them can be found here, and this page on an older wiki goes into more detail on how "bitwise operators" work. There's also this wikipedia page on it.

Edited by Wulfie Reanimator
  • Like 1
  • Thanks 1
You are about to reply to a thread that has been inactive for 1540 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
×
×
  • Create New...