Jump to content

Black Color and ZERO_VECTOR


Dimitri Cloud
 Share

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

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

Recommended Posts

Hello ­čÖé

Have done a script with some settings driven via a configuration NC.

One of the setting is a color who should be typed as a vector in the NC. Through the process of processing datas (value) read in the NC, I've added a condition to check if the typed color vector is correctly typed if((vector)value) //keep this data; else //it's not a vector, put a default forced value just in case the typed setting would be wrongly typed.

Surprisingly <0, 0, 0> -corresponding to black color vector- and even correctly typed is treated as FALSE as a conditional in if((vector)value) as it is equivalent to ZERO_VECTOR, which is also the result of anything else wrongly typed in this case.

Do you have any clue to overpass this? Have a nice day!

Link to comment
Share on other sites

Yes, in a condition test the zero vector (whether intended or the result of a failed conversion from a mangled string) is treated as false, and any other valid vector is treated as true.

There's a nice little piece of code here that tests if a string is a valid vector: http://wiki.secondlife.com/wiki/Category:LSL_Vector#Useful_Snippets.

  • Thanks 1
Link to comment
Share on other sites

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