Ares Baroque
Registered User
Join date: 11 Aug 2007
Posts: 8
|
09-26-2009 06:21
Hi I am wanting to setup a basic script that when touched only users I designate in a list can activate the script. This is what I have so far and no luck. list people = ["Ares Baroque","Jasmin Chaffe"]; default { touch_start(integer x) { key people; if (llDetectedName(0) != people) //if the detected name isn't on the list. { llOwnerSay("you cannot pass."  ; } else { llOwnerSay("You can pass."  ; } } } thanks
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
09-26-2009 07:16
Your if test is going to run into a problem because you're trying to compare a single element, llDetectedName(0), to a list, people. There's a good LSL function for doing this...
if (llListFindList(people,[llDetectedName(0)]) != -1){ //Do stuff) }
llListFindList returns an integer that is the position of the second list, llDetectedNamey(0) in this case, in the first list. You have to cast the element llDetectedName(0), as a list by putting it in square brackets here. If the second list isn't in the first one, the integer is -1. This if test, then, says "if llDetectedName(0) isn't in 'people', do stuff."
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....  Look for my work in XStreetSL at 
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
09-26-2009 09:01
Or, alternatively, if (~llListFindList( people, [llDetectedName(0)] )){ //do stuff} Several more ways of handling conditionals at /54/36/321736/1.html
|