Dotty Darkheart Posted February 13, 2023 Share Posted February 13, 2023 (edited) Hi! I am looking for a script that turns a box phantom only for my group. I did a little research and it should have been simple, i am not a scripter but generally i can understand what a script does when i read it. So i found this "secret door" here : default { // Triggered when objects (including avatars) collide with the object containing this script collision_start(integer nd) { while(nd) { // Cycle through the detected keys of those objects that collided this time checking if each is the owner. if(llDetectedKey(--nd) == llGetOwner()) llSetStatus(STATUS_PHANTOM, TRUE); // Become un-solid } } collision_end(integer nd) { if(llGetStatus(STATUS_PHANTOM)) // If the object is un-solid llSetStatus(STATUS_PHANTOM, FALSE); // Set the object solid. } } which works awesomely except i need it for group. Then i found here a bit about detecting group: //Gives inventory only to agents with the same active group default { touch_start(integer total_number) { if (llDetectedGroup(0) ) //same as llSameGroup(llDetectedKey(0) ) (with llSameGroup, detected must be in the sim) llGiveInventory(llDetectedKey(0), llGetInventoryName(INVENTORY_OBJECT, 0) ); else llSay(0, "Wrong active group!"); } } And after many attempts to actually get anything to compile, attempts that i will not post cuz... useless, i found @Quistess Alpha's post here that finally lead to something being compiled, this: default { collision_start(integer nd) { while(nd) { if(llDetectedGroup(0)) llSetStatus(STATUS_PHANTOM, TRUE); // Become un-solid } } collision_end(integer nd) { if(llGetStatus(STATUS_PHANTOM)) // If the object is un-solid llSetStatus(STATUS_PHANTOM, FALSE); // Set the object solid. } } which it does not actually do anything unfortunately , aka stays solid with the right group on. unsure what is off. I have no idea how to mix-match these to work. - If some of you have a script that does just this somewhere for sale, do let me know, i`ll most probably buy it, i couldn't find one. - if somebody feels like offering to do this commercially, i would be happy to pay for your time, but only if you are ok with giving it to me opened/ modifiable /editable. totally ok to keep your copyright rights and notices in/with it, but i want to actually see it. - if you are kind enough to fix this here on forum, would be very grateful to donate this to the open library, i`m sure more people would want to land their humans in a closed box, cuz group ban lines don`t actually work high in the sky, thank you! Edited February 13, 2023 by Dotty Darkheart typos Link to comment Share on other sites More sharing options...
Love Zhaoying Posted February 13, 2023 Share Posted February 13, 2023 (edited) This specific script use is not my expertise, but I can try to help! Your first script used a loop for "Number Detected", that reduces the counter - so, the loop should exit when the "nd" counter reaches 0. while(nd) { // Cycle through the detected keys of those objects that collided this time checking if each is the owner. if(llDetectedKey(--nd) == llGetOwner()) llSetStatus(STATUS_PHANTOM, TRUE); // Become un-solid } Your newest group uses a loop but it should be looping forever since you are not using a counter: while(nd) { if(llDetectedGroup(0)) llSetStatus(STATUS_PHANTOM, TRUE); // Become un-solid } Have you consider adding debug statements ("llSay()") to your script? Did you make sure to set the Object the script is in to the Group? See https://wiki.secondlife.com/wiki/LlDetectedGroup. Have you made sure anyone testing it is "wearing the group tag" - meaning, the group is ACTIVE? If you want to test it with just one person, with a debug statements, you wouldn't need a loop. Here's an example: collision_start(integer nd) { // Just check the first collision detected for this test if(llDetectedGroup(0)) { // 0 is the first collision detected llSay(0, "Detected someone of the same group!"); llSetStatus(STATUS_PHANTOM, TRUE); // Become un-solid } else { llSay(0, "Detected someone of a different group!"); } } Edited February 13, 2023 by Love Zhaoying 1 Link to comment Share on other sites More sharing options...
Dotty Darkheart Posted February 13, 2023 Author Share Posted February 13, 2023 (edited) Thank you so much, @Love Zhaoying! I used your formatting, it is probably unlikely for many persons to want to pass at exact same time through it.... maybe is sufficient and no loops required? at least for one person, with all the right setting, this works! default { collision_start(integer nd) { // Just check the first collision detected for this test if(llDetectedGroup(0)) { // 0 is the first collision detected llSay(0, "Detected someone of the same group! WELCOME!"); llSetStatus(STATUS_PHANTOM, TRUE); // Become un-solid } else { llSay(0, "You shall not pass without our group active :) ! "); } } collision_end(integer nd) { if(llGetStatus(STATUS_PHANTOM)) // If the object is un-solid llSetStatus(STATUS_PHANTOM, FALSE); // Set the object solid. } } do you believe i will encounter troubles if i leave it just like that? maybe the integer nd should be something else? i do not know these things x.x Thankies so much ❤️ Edited February 13, 2023 by Dotty Darkheart wondering about "nd" Link to comment Share on other sites More sharing options...
Love Zhaoying Posted February 13, 2023 Share Posted February 13, 2023 (edited) 3 minutes ago, Dotty Darkheart said: Thank you so much, @Love Zhaoying! I used your formatting, it is probably unlikely for many persons to want to pass at exact same time through it.... maybe is sufficient and no loops required? at least for one person, with all the right setting, this works! default { collision_start(integer nd) { // Just check the first collision detected for this test if(llDetectedGroup(0)) { // 0 is the first collision detected llSay(0, "Detected someone of the same group! WELCOME!"); llSetStatus(STATUS_PHANTOM, TRUE); // Become un-solid } else { llSay(0, "You shall not pass without our group active :) ! "); } } collision_end(integer nd) { if(llGetStatus(STATUS_PHANTOM)) // If the object is un-solid llSetStatus(STATUS_PHANTOM, FALSE); // Set the object solid. } } do you believe i will encounter troubles if i leave it just like that? Thankies so much ❤️ You're welcome! I has a happy! Edited to add: Since that worked, your original issue could have been the loop running forever (forever = not giving the prim time to actually update). Edited February 13, 2023 by Love Zhaoying 1 Link to comment Share on other sites More sharing options...
Dotty Darkheart Posted February 13, 2023 Author Share Posted February 13, 2023 yea, was wondering about that nd thingy,,,, 1 Link to comment Share on other sites More sharing options...
Quistess Alpha Posted February 13, 2023 Share Posted February 13, 2023 1 hour ago, Dotty Darkheart said: was wondering about that nd thingy,,,, nd == "Number detected" or, how many people started/stopped colliding with the thing in that instant, which not especially useful to you unless you try and use the information to try and fix annoying edge-cases: a group-member and a non-group-member try to go through at the exact same time. someone TP's away while inside. #2 is especially annoying. Last time I tried something kinda like this, the best work-around seemed to be only using collisions as a hint to start llSensorRepeat(). -- Don't fix what isn't broken, but FWIW, llSetStatus(STATUS_PHANTOM, ONOFF); and llVolumeDetect(ONOFF); serve similar purposes. I'd use volume detect unless I had a reason not to, but it shouldn't make much difference in this case. also, I don't think there's a need to check the phantomness of the object before turning it one way or the other, default { collision_start(integer nd) { if(llDetectedGroup(0)) { // 0 is the first collision detected llSay(0, "Detected someone of the same group! WELCOME!"); llVolumeDetect(TRUE); // Become un-solid } else { llSay(0, "You shall not pass without our group active :) ! "); llVolumeDetect(FALSE); } } collision_end(integer nd) { llVolumeDetect(FALSE); } } 1 Link to comment Share on other sites More sharing options...
Love Zhaoying Posted February 13, 2023 Share Posted February 13, 2023 10 minutes ago, Quistess Alpha said: 1 hour ago, Dotty Darkheart said: was wondering about that nd thingy,,,, nd == "Number detected" or, how many people started/stopped colliding with the thing in that instant, which not especially useful to you unless you try and use the information to try and fix annoying edge-cases: a group-member and a non-group-member try to go through at the exact same time. someone TP's away while inside. I was wondering about the "as intended" way it was written. Is there a possibility that the status could "flicker" phantom / non-phantom if 2 "allowed" avatars touched it at around the same time, possibly "pushing" one away? Would there be a benefit to using llSetPrimitiveParamsFast()? Link to comment Share on other sites More sharing options...
Quistess Alpha Posted February 13, 2023 Share Posted February 13, 2023 (edited) 14 minutes ago, Love Zhaoying said: Is there a possibility that the status could "flicker" phantom / non-phantom if 2 "allowed" avatars touched it at around the same time No, I don't think so. (Trying to explain logic is hard, or I'd be more verbose.) If they don't ~leave at about the same time , that could cause a minor "issue". If this were a widely used thing and that were a common complaint, the easy hack fix would be to llSleep(0.5); at the beginning of the collision_end() event. 14 minutes ago, Love Zhaoying said: Would there be a benefit to using llSetPrimitiveParamsFast()? llSetStatus() has no forced delay, and llVolumeDetect() has no llSLPPF equivalent. If anything, llSetStatus is better than llSet.. because it doesn't have a list argument. (list instantiation is a bit slow) Edited February 13, 2023 by Quistess Alpha 1 Link to comment Share on other sites More sharing options...
Coffee Pancake Posted February 13, 2023 Share Posted February 13, 2023 I've played with making doors and force fields that would let some people pass and not others for RP purposes. If you design is based around a door or an opening people walk though ... don't for one second think you can make it secure .. even a day old newbie can move their cam past and sit on something, or sit on the barrier and get deposited on the other side when they stand. You can create a smoother experience by making the door larger than it looks, enclose the visible door in a bigger bounding box prim and use that to check and enable or disable access before the user actually gets to the visible door. The avatar starts at 1 and approaches the green wall (2), the collide with a phantom part(3) first which causes the wall to become phantom too should they meet requirements, they don't then bump the door. Be sure to keep checking everyone in the red zone meets requirements or one person can hold the door open for others. For a one way option The green(2), red(3) and blue(4) parts are one object. 2 & 4 are doors - 2 Starts open. 4 starts closed. 3 is a phantom and invisible. Yellow arrows show direction of travel Avatar enters here. This door is normally open and allows the avatar to pass. Once inside this volume the script pauses for a moment then checks if all the people in this area meet the entry requirement. If they all do, the green door is closed and the blue door is opened. Everyone drops though .. reset the trap. In my case the entry requirements were group tag & specific worn attachment and active RLV, because .. um .. reasons 😊 1 1 Link to comment Share on other sites More sharing options...
Fenix Eldritch Posted February 13, 2023 Share Posted February 13, 2023 (edited) 2 hours ago, Coffee Pancake said: or sit on the barrier and get deposited on the other side when they stand. This exploit in particular can be mitigated by setting PRIM_SCRIPTED_SIT_ONLY on all relevant objects. Edited February 13, 2023 by Fenix Eldritch Oh hey, my 666'th post. Hail satan or whatever 1 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