Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Why doesn't this IF work?

Tarak Voss
Meanderer
Join date: 14 Oct 2006
Posts: 330
12-05-2008 21:31
I have the following IF statement that passes any vector?

if (llGetPrimitiveParams([PRIM_SIZE]) == [<1.564000, 1.000000, 0.080000>])

Actually I only need one of the vector values x,y or z, but in its current form this IF line lets any vector pass?
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
12-05-2008 21:59
Guess it doesn't like comparing a list to a list.

This works thou:

if (llList2Vector(llGetPrimitiveParams([PRIM_SIZE]),0) == <1.564000, 1.000000, 0.080000>;)

EDIT: I THINK what is happening is that comparing the vectors in the lists is actually comparing NULL_VECTOR to NULL_VECTOR:

See this wiki entry:

"Q: Why are there so many llList2* functions?
A: LSL2 doesn't support run-time typing, meaning you have to actually specify the type of each variable. The Lindens could have implemented a single function, llList2String, then required explicit typecasting, as in (integer)llList2String(foo, 0). However, that isn't as memory- or CPU-efficient as llList2Integer(foo,0) (yes, really) and the amount of work required for the Lindens to implement seperate functions for each type was negligible.
You can still typecast values stored in a list, of course, but it's advised to use the llList2* functions, unless it's a vector or rotation stored as a string, in which case you should cast to a vector or rotation after using llList2String. llList2Vector and llList2Rotation do not cast from strings automatically. See the next question for more.

Q: Have the old problems concerning the odd behavior of llList2Vector and llList2Rot when requesting a TYPE_STRING element from the list been fixed yet?
A: No. If a list element is a string containing text that would otherwise be directly typecast to a vector or rotation, It will not be converted. The resulting vector or rotation will be ZERO_VECTOR or ZERO_ROTATION respectively. This is a bug. To get around it, use llList2String to retrieve elements from your list, then cast them to vectors or rotations as needed: (vector)llList2String(positions,2);"

While not directly addressing your problem, I think an offshoot of it is happening to you.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Tarak Voss
Meanderer
Join date: 14 Oct 2006
Posts: 330
12-05-2008 22:09
Thanks Jesse :)