|
Trey Harris
Registered User
Join date: 28 Mar 2006
Posts: 8
|
11-19-2006 05:06
Im pretty new to LSL, I cant seem to figure out how to test something like the following. if ( interger test != 3 or 6 or 7). I tired if ( interger test != (3 | 6 | 7)), but that did not seem to work even though it compiled ok. Please assist!!
|
|
carol Wombat
Registered User
Join date: 29 Jan 2006
Posts: 16
|
11-19-2006 05:25
one easy way testFor3or6or7 (integer test) { if (test == 3) return FALSE; if (test == 6) return FALSE; if (test == 7) return FALSE; return TRUE; }
|
|
carol Wombat
Registered User
Join date: 29 Jan 2006
Posts: 16
|
11-19-2006 05:33
A more complicated way: if ((test != 3) && (test != 6) && (test != 7)) return a false else return a true
turning all that around with De Morgan: if ((test == 3) || (test == 6) || (test == 7)) return a true else return a false
by the way, 3 | 6 | 7 => 7
|
|
Trey Harris
Registered User
Join date: 28 Mar 2006
Posts: 8
|
thank you!!
11-19-2006 06:27
Thanks alot that got it! 
|
|
Corey Braendle
Registered User
Join date: 26 Oct 2006
Posts: 27
|
11-19-2006 07:02
From: Trey Harris I tired if ( interger test != (3 | 6 | 7)), but that did not seem to work even though it compiled ok. Please assist!! You should have been trying a double pipe operator anyway  if(blah || blah || blah) But i dont think this works in LSL 
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
11-19-2006 08:41
the || does not awake yet to think about syntax 
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
11-19-2006 09:52
From: Corey Braendle You should have been trying a double pipe operator anyway  if(blah || blah || blah) But i dont think this works in LSL  No, there's no simple operator for that. Overcomplex redundant way of doing it, why not: list gValues = [3, 6, 7];
...
return (llListFindList(gValues, [test]) != -1);
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!
http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal
http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
|