Parack Posted July 13, 2011 Share Posted July 13, 2011 Hello,I'm starting my first script; It's supposed to be a barrier that only allows people in a list access. The idea is that it goes phantom when they are allowed, and turns red and physical when they're not. list access = ["Parack Resident"]; default { collision_start(integer total_number) { if (access); { llSetStatus(STATUS_PHANTOM, TRUE); llPlaySound("7053d699-0b55-2892-80da-b63aa1b6fc5d", 1.5); } if(llGetTime() < 5.0) { llResetScript(); } else { llWhisper(0,"No Access"); } } collision_end(integer total_number) { llSetColor(<1.0,1.0,1.0>, ALL_SIDES); } } When I was first doing the script I noticed that the collision was repeating, so I played a timer on it to halt the repitition. When I'm testing the script and I collide with it, it goes phantom and I get the "No access" message. Is there any chance that someone could help me get this script working? Link to comment Share on other sites More sharing options...
Zena Juran Posted July 14, 2011 Share Posted July 14, 2011 Nothing to see here. :-) Link to comment Share on other sites More sharing options...
Zena Juran Posted July 14, 2011 Share Posted July 14, 2011 Nothing to see here... lol :-) Link to comment Share on other sites More sharing options...
Zena Juran Posted July 14, 2011 Share Posted July 14, 2011 Nothing to see here! :-) Link to comment Share on other sites More sharing options...
Void Singer Posted July 14, 2011 Share Posted July 14, 2011 if (~llListFindList( access, [llDetectedName( 0 )] ){ //-- is found in the list} list find returns an index, or negative one if not in the list. ~(-1) == 0 (FALSE for our purposes) ~(any-number-greater-than-neg-one) == a negative number (TRUE for our purposes) Link to comment Share on other sites More sharing options...
Zena Juran Posted July 14, 2011 Share Posted July 14, 2011 I should have just taken the code and worked it out in-world first instead of trying to do it in here. It has been a whiles since I posted to the forums until about a week ago. I forgot or didn't realize how bad trying to do code in here is. My sincerest apologies for botching around with this. :-) Link to comment Share on other sites More sharing options...
Rolig Loon Posted July 14, 2011 Share Posted July 14, 2011 Take a look at http://community.secondlife.com/t5/LSL-Library/Generic-Whitelist/td-p/713895 Link to comment Share on other sites More sharing options...
Parack Posted July 16, 2011 Author Share Posted July 16, 2011 Hello everyone, Thanks for the replies. @Rolig I tried using your script; at the 'state okay' I added a collision_start and a status change to phantom, however, now when I run the script (when it's rezzed) it stays phantom. state OK{ state_entry() { llSetTimerEvent(10.0); llSay(0,"You're in!"); } changed(integer change) { if (change & CHANGED_INVENTORY) { llResetScript(); } } collision_start(integer total_number) { llSetStatus(STATUS_PHANTOM, ALL_SIDES); } collision_end (integer total_number) { llResetScript(); } //SNIP Link to comment Share on other sites More sharing options...
Rolig Loon Posted July 16, 2011 Share Posted July 16, 2011 That's mostly because you never change it back to non-phantom. It's not going to change back by itself. :smileywink: Step back and rethink the script's logic here. The script has three states, not because I necessarily like multiple states, but because in this case they help separate three modes of operation. The whole purpose of segregating state default from the operating states of the script is to make that initialization step a one-time thing (unless you modify the notecard, of course). So you don't want to loop back to state default or re-initialize with llResetScript unless it's truly necessary. State running is your filter state. It determines whether the action that a user has taken is permitted or not. The internal logic decides what level of permission the user has (owner only, group only, whitelist, or everyone). The script only gets to state OK if a user has passed the filter of state running. That is, state OK is where you open a door, make a wall phantom, turn on the lights, or divulge clubhouse secrets. When that is done, the script hops back to state running to wait for the next user. So...... the collision_start event is part of the filter. When someone collides with the wall, the script has to decide whether the person is allowed to pass or not. The script enters state OK only if the person passes the test. That's where the wall has to become phantom. And it has to become non-phantom again in time to be ready for the next collider. 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