Jump to content

Script - Limit (Adult) Furniture to Group


Nika Talaj
 Share

You are about to reply to a thread that has been inactive for 761 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I noticed a short discussion about buying PG furniture in another thread.  If you have adult furniture that you wish to use outside, you can use this little script to make it so non-group members cannot sit on it.  Perhaps not ideal, but anyway you can use the furniture at your LH and others can at least see it.   The script will always let the owner of the object sit, regardless of what group they have active.

You can pick up the script at http://maps.secondlife.com/secondlife/Coral Cottage/199/18/23 .  To use the script, just put it in whatever furniture you want to restrict use of. 

It is in a big orange-ish piece of coral on the stairs, just touch and it will give the script to you.  While you're there, feel free to hang out - there's yoga mats on the beach, a gently spinning floatie, a push-merry-go-round (that is a HOOT), a cushion on the back porch that will let you fish, a soaking tub under the house, etc..  But you won't be able to use the shower under the house, because it has this script in it!

The script is nomod so that no bozo can replace the contents with some griefer script and distribute it.  But if you want to make a mod for yourself, here's the very simple code.

// GroupOnly Simple
// Script to ensure that a piece of furniture can only be used by group members.  If someone sits
// who is not in group NOR the object owner,
// the sitter will be unsat and a polite message will be said to him/her.
// 
// ---- Globals ------------------------------

integer original_prims;

// ---- SUBROUTINES ------------------------------
// -----------------------------------------------

init()                 
{
    original_prims = llGetObjectPrimCount(llGetKey());            // object prim count not including sitters
    
}  // end init

// -----------------------------------------------
// ---- STATE PROCESSING -------------------------
// -----------------------------------------------

default {
    ///////////////////////////////////////////////////////////////////////////////
    state_entry () {
        init();
    }
    ///////////////////////////////////////////////////////////////////////////////
    changed(integer change)
    {
    key sitter;
    integer num_prims;
    integer i;
        
    if (change & CHANGED_LINK) {
        // starting at the most recent sitter, count down and check each one to see if in group.
        // Note that if multiple sitters, this will find any unauthorized sitters, but may result
        // in checking previous sitters multiple times, as will get event for each new sitter
        
        num_prims = llGetNumberOfPrims();            // get it before avie moves!
        if (num_prims > original_prims) {            // someone is sitting on object
            for (i= num_prims; i > original_prims; i--) {
                sitter = llGetLinkKey(i);
//                llOwnerSay(" i = " + (string)i + ", sitter = " + (string)sitter);        // ???debug
                if (sitter != NULL_KEY) {   //maybe somebody got up
                    // if sitter is not in group or always approved lis
                    if (!llSameGroup(sitter) && (sitter != llGetOwner())) {
                        llRegionSayTo(sitter, 0, "Apologies, this item can only be used by group members.");
                        llSleep(0.5);        // delay to avoid flying on unsit
                        llUnSit(sitter);
                    }
                } //end someone sitting
            } //endfor
        } // endif someone sitting
     } // endif changed link   
  } // end changed event

    ///////////////////////////////////////////////////////////////////////////////
    on_rez(integer start)
    {
        init();

    }  // end onrez
}


 

  

Edited by Nika Talaj
  • Like 3
  • Thanks 9
Link to comment
Share on other sites

  • Nika Talaj changed the title to Script - Limit (Adult) Furniture to Group

Thought I'd bump this once, won't do so again.  This can be useful in situations where:

> You want to use your furniture's full set of poses, but you don't want visitors to use them

> and/or Your furniture does not have an 'access list' feature

> and/or Your furniture's avPos notecard is nomod

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 761 days.

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
 Share

×
×
  • Create New...