Dimitri Cloud Posted December 11, 2018 Share Posted December 11, 2018 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 More sharing options...
KT Kingsley Posted December 11, 2018 Share Posted December 11, 2018 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. 1 Link to comment Share on other sites More sharing options...
steph Arnott Posted December 12, 2018 Share Posted December 12, 2018 (edited) Using integers when it is a float is a bad practice to start with. It forces the server to do unnecessary additional work in converting it to a float. It can also throw up unexpected results. Spelling correction. Edited December 12, 2018 by steph Arnott 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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