Page 8 of 9

Scripts Library

Posted: Fri Feb 26, 2016 11:52 pm
by Constance Peregrine
https://plus.google.com/+FredBeckhusen/ ... aKDnW68u69

Interesting scripting tho I have no clues what he is saying-)) (ok, some clues)

Linked Swing Door

Posted: Sat Apr 16, 2016 2:18 pm
by Ghaelen DLareh
I don't remember where I got this script, but it works great. Put the script in the door and link the door to the building. The building needs to be the root prim.

Code: Select all

/*John Duke offset door hinge (c) 2016 for SL and OS
 * Define the rotation in degrees, using the door prim's local coordinate
 * system
 */
vector      ROTATION            = <0.0,0.0,90.0>;
 
/*
 * Define the position of the virtual hinge; usually this is half the door
 * prim's width and thickness
 */
vector      HINGE_POSITION      = <0.97,-0.28,0.0>;
 
/*
 * Define how fast the door opens, in seconds
 */
float       SECONDS_TO_ROTATE   = 2.0;
 
/*
 * Define after how much time the door should close automatically, in seconds;
 * set to 0.0 to disable autolmatic closing
 */
float       AUTO_CLOSE_TIME     = 05.0;
 
/*
 * Define a sound that plays when the door starts to open; set to NULL_KEY
 * for no sound.
 */
key         SOUND_ON_OPEN       = "";
 
/*
 * Define a sound that plays when the door has closed; set to NULL_KEY
 * for no sound.
 */
key         SOUND_ON_CLOSE      = "";
 
/*
 * Define the volume of the opening and closing sounds
 */
float       SOUND_VOLUME        = 0.8;
 
/*
 * NORMALLY, THERE IS NO NEED TO CHANGE ANYTHING BELOW THIS COMMENT. IF YOU DO
 * YOU RISK BREAKING IT.
 */
 
integer     gClosed;            // Door state: TRUE = closed, FALSE = opened
rotation    gRotationClosed;    // Initial rotation of the door (closed)
vector      gPositionClosed;    // Initial position of the door (closed)
vector      gRotationPerSecond; // The amount to rotate each second
 
doOpenOrClose() {
    /*
     * Only perform the rotation if the door isn't root or unlinked
     */
    integer linkNumber = llGetLinkNumber();
    if (linkNumber < 2)
        return;
 
    if (gClosed) {
        /*
         * Store the initial rotation and position so we can return to it.
         *
         * Rotating back purely by calculations can in the longer term cause the door
         * to be positioned incorrectly because of precision errors
         *
         * We determine this everytime before the door is being opened in case it was
         * moved, assuming the door was closed whilst being manipulated.
         */
        gPositionClosed = llGetLocalPos();
        gRotationClosed = llGetLocalRot();
 
        /*
         * Play the opening sound and preload the closing sound
         */
        if (SOUND_ON_OPEN)
            llPlaySound(SOUND_ON_OPEN, SOUND_VOLUME);
    }
 
    vector hingePosition = gPositionClosed + HINGE_POSITION * gRotationClosed;
 
    /*
     * Reset the timer and start moving
     */
    llResetTime();
    while (llGetTime() < SECONDS_TO_ROTATE) {
        float time = llGetTime();
        if (! gClosed)
            /*
             * Invert the timer for closing direction
             */
            time = SECONDS_TO_ROTATE - time;
 
        rotation rotationThisStep = llEuler2Rot(gRotationPerSecond * time) * gRotationClosed;
        vector positionThisStep = hingePosition - HINGE_POSITION * rotationThisStep;
        llSetLinkPrimitiveParamsFast(linkNumber, [PRIM_ROT_LOCAL, rotationThisStep, PRIM_POS_LOCAL, positionThisStep]);
    }
 
    /*
     * Set the new state
     */
    gClosed = !gClosed;
 
    if (gClosed) {
        /*
         * Finalize the closing movement
         */
        llSetLinkPrimitiveParamsFast(linkNumber, [PRIM_ROT_LOCAL, gRotationClosed, PRIM_POS_LOCAL, gPositionClosed]);
 
        /*
         * Play the closing sound and preload the opening sound
         */
        if (SOUND_ON_CLOSE)
            llPlaySound(SOUND_ON_CLOSE, SOUND_VOLUME);
        if (SOUND_ON_OPEN)
            llPreloadSound(SOUND_ON_OPEN);
    } else {
        /*
         * Finalize the opening movement
         */
        rotation rotationOpened = llEuler2Rot(ROTATION * DEG_TO_RAD) * gRotationClosed;
        vector positionOpened = hingePosition - HINGE_POSITION * rotationOpened;
        llSetLinkPrimitiveParamsFast(linkNumber, [PRIM_ROT_LOCAL, rotationOpened, PRIM_POS_LOCAL, positionOpened]);
 
        /*
         * Preload the closing sound
         */
        if (SOUND_ON_CLOSE)
            llPreloadSound(SOUND_ON_CLOSE);
 
        /*
         * Set a timer to automatically close
         */
        llSetTimerEvent(AUTO_CLOSE_TIME);
    }
}
 
default {
    state_entry() {
        /*
         * Assume the door is closed when the script is reset
         */
        gClosed = TRUE;
 
        /*
         * These doesn't change unless the script is changed, calculate them once
         */
        gRotationPerSecond = (ROTATION * DEG_TO_RAD / SECONDS_TO_ROTATE);
 
        /*
         * Preload the opening sound
         */
        if (SOUND_ON_OPEN)
            llPreloadSound(SOUND_ON_OPEN);
    }
    touch_start(integer agentCount) {
        doOpenOrClose();
    }
    timer() {
        llSetTimerEvent(0.0);
 
           /*
         * Preload the close sound
         */
        if (SOUND_ON_CLOSE)
            llPreloadSound(SOUND_ON_CLOSE);
 
        /*
         * Close the door if it isn't already closed
         */
         
            
        if (! gClosed)
            doOpenOrClose();
        }
    }
The fussy bits are in figuring out what 1/2 the width and 1/2 the depth of the door should be in this line:

Code: Select all

vector      HINGE_POSITION      = <0.5,0.0,0.0>;
I found that simply dividing the sizes in half didn't make the door rotate as if on a hinge. For a 1.6m wide door, the x position had to be .97, and the y position was -0.28 for a .5 depth. Once I configured it that way it worked beautifully. The building can be moved and rotated, and the door still works. Re-sizing is another matter, of course, because the re-sized door needs the script HINGE_POSITION adjusted again.

EDIT: Duh.... if the mesh door has a handle on both sides, the depth of the physics is wider than the visible solid door. /slapforehead

So 1/2 the door width/depth works in a prim door. I'll leave up my erroneous conclusion in case it might benefit someone else who is using mesh doors with handles.

Re: Scripts Library

Posted: Sun Jun 05, 2016 12:20 am
by Don Smith
Hi, New guy here, does anyone have a build rezzing script system? So i can put my homes i intend to build in them and rez a box, click to rez the build from? < i forgot what its called specifically > Or where can i find one? Ty.

UPDATE: as suggested by Anglecat Wingtips. via in game, i opened up a home from a rez box with full perm that works and got the scripts. Made a test rezzing box and some test objects, It works except, my 3 test objects all rez in the same spot. I've tried ressetting the scripts at various stages of the testing and still same results. Does anyone know what to suggest to get this thing to work, I will gladly share it freely amongst kitely builders if we can get it working!

Re: Scripts Library

Posted: Sun Jun 05, 2016 5:16 am
by Graham Mills
Not something I do often but I think some people use Builders Buddy.

search.php?keywords=buddy

Re: Scripts Library

Posted: Sun Jun 05, 2016 6:43 am
by Dot Matrix
Brayla Sana includes a free builder's buddy script among others on her world:

https://www.kitely.com/virtual-world/Br ... na-Gallery

It's one she uses herself for her Kitely Market buildings.

Re: Scripts Library

Posted: Sun Jun 05, 2016 1:59 pm
by Don Smith
Thanks so much for the replies! I just went and got one, and will test it shortly. Seeing that its used here is reassuring! Will update after i comfirm its a working script.


Hello again. After 2 more hours of trying, i still cant get this script to work. I would greatly appreciate if some of you would go and get a copy of it and see if you can get it to work and post here your results. Hopefully we can figure this out and get one working. Thanks again for your time and input.


///// UPDATE /////
Problem Solved! You must be the Owner of the land you use this builder buddy on or it wont work. Even in sandboxes, unless its your own.

Many Thanks to all who assisted with help and Info!

Re: Scripts Library

Posted: Fri Jun 10, 2016 6:25 pm
by Serene Jewell
Giz Ihnen recently found a nice collection of scripts. "It's in french. It has OS/SL scripts for all sorts of games. have only tried the maze generator so far and it worked perfect..."

http://digigrids.free.fr/wiki/index.php ... mples/Jeux

Re: Scripts Library

Posted: Tue Jul 19, 2016 1:52 am
by Freda Frostbite
Anyone have a script for hypergates that actually works? NONE of the gates I have found in OS actually work when I try them in Kitely.

Re: Scripts Library

Posted: Tue Jul 19, 2016 6:31 am
by Graham Mills
Last time I checked there were some differences between viewers. There's a touch-activated script here
viewtopic.php?f=26&t=759&start=60#p18850

Re: Scripts Library

Posted: Tue Jul 19, 2016 12:39 pm
by Freda Frostbite
Yes, I tried that one. No dice and Bel (my partner in, well, not crime, at The U) can't make it go either. Luckily, I realized we can use the Opensimworld beacon for HG teleports along with the old tried and true map method.