Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Suche Garagentor script
#1
Question 
Guten Tag zusammen ich suche ein Schwingtür oder Garagentor Skript.
Ich habe zwar diverse Türscripte allerdings schließen die Türen nach einer
gewissen Zeit wieder automatisch, das möchte ich nicht. Das Script welches ich benötige soll die Schwingtür/tor aber erst nach einem nochmaligen Klick schließen. Es wäre schön wenn jemand sowas hat.

LG
Kalk
Zitieren
#2
Ich hab da was aus unserer Feuerwache in Westend:

Code:
/*
* Smooth Rotating Linked Door With Hinge
*
* By: Lyn Mimistrobell
* Version: 1.1
* License: Do whatever you like with it, just don't blame me if you break it :)
*/

/*
* 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      = <2.75, 1.9, 0.0>;

/*
* Define how fast the door opens, in seconds
*/
float       SECONDS_TO_ROTATE   = 1.0;

/*
* Define after how much time the door should close automatically, in seconds;
* set to 0.0 to disable automatic closing
*/
float       AUTO_CLOSE_TIME     = 10.0;

/*
* Define a sound that plays when the door starts to open; set to NULL_KEY
* for no sound.
*/
key         SOUND_ON_OPEN       = "e5e01091-9c1f-4f8c-8486-46d560ff664f";

/*
* Define a sound that plays when the door has closed; set to NULL_KEY
* for no sound.
*/
key         SOUND_ON_CLOSE      = "88d13f1f-85a8-49da-99f7-6fa2781b2229";

/*
* Define the volume of the opening and closing sounds
*/
float       SOUND_VOLUME        = 1.0;

/*
* 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();
    }
    collision_start(integer Dummy)
    {
        if (gClosed)
        {
            doOpenOrClose();
        }
    }
    timer() {
        llSetTimerEvent(0.0);

        /*
         * Close the door if it isn't already closed
         */
        if (! gClosed)
            doOpenOrClose();
    }
}

Musst du die Parameter ein bischen anpassen - evtl. nach dem Motto "Probieren geht über studieren." Wink )
Ich fürchte die Sounds werden so wie sie hier drinstehen erstmal nicht funzen - einfach entsprechend eigene Sounds einsetzen.
Wer nicht weiss wohin er will, der kommt leicht woanders hin.
[-] The following 2 users say Thank You to Anachron for this post:
  • Dorena Verne, Kalkofe
Zitieren
#3
Danke Anachron! Bei dem Skript passiert bei mir garnichts, mit scripten kenne ich mich nur wenig aus um das anzupassen.

Habe dieses jetzt bei Outworldz gefunden, macht genau das was ich brauche

Code:
// :CATEGORY:Door
// :NAME:Simple_door_swinger_works_at_any_an
// :AUTHOR:Void SInger
// :CREATED:2012-03-24 22:09:02.320
// :EDITED:2013-09-18 15:39:02
// :ID:759
// :NUM:1046
// :REV:1.0
// :WORLD:Second Life
// :DESCRIPTION:
// Simple_door_swinger_works_at_any_an
// :CODE:
/*//( v7-D Simple Hinge Action )--//*/

/*//-- Works At ANY Angle --//*/



/*//-- NOTES:

works in ANY single prim door, linked or un-linked

works in multi-prim doors NOT linked to a larger structure

Never needs reset (even after rotating)

//*/



/*//-- REQUIREMENTS:

Root must either be a cylinder (to represent a hinge) or

cut prim; I suggest cube, pathcut start=.125, end=.625

//*/



/*//-- CAVEAT:

Single prim doors are limited to 5m width

Treats current position as closed when reset

//*/



/*//-- USERS MODIFY HERE v --//*/

integer gIntSwing = 90;

/*//-- use -# to reverse the direction of swing, eg. -90; --//*/

rotation gRotSwing;



default{

    state_entry(){

        gRotSwing = llEuler2Rot( <0.0, 0.0, (float)gIntSwing * DEG_TO_RAD> );

    }

    

    touch_end( integer vIntNul ){

         llSetLocalRot( (gRotSwing = (ZERO_ROTATION / gRotSwing)) * llGetLocalRot() );

    }

}



/*//-- IF Redistributing as-is:

Please leave script full permissions & include all comments so that others may learn and use

//*/



/*//--                       Anti-License Text                         --//*/

/*//     Contributed Freely to the Public Domain without limitation.     //*/

/*//   2009 (CC0)    //*/

/*//  Void Singer   //*/
Zitieren
#4
Wenn das Script bei dir nichts tut, kann es daran liegen, dass du übersehen hast, dass dieses Script für eine "Linked Door" geschrieben ist? Packst du es in eine einfaches Root-Prim dann klappt das nicht.
Dein Script ist ein sehr einfaches Türscript und dass es für dein Problem als Lösung funktioniert, lässt mich darauf schliessen, dass deine Tür ein rotiertes und geschnittenes Prim ist, denn sonst würde dieses Script über die Z-Achse rotieren - wie eine normale Tür eben - und nicht, wie du wolltest, um eine horizontale Achse wie ein Garagentor.
Wer nicht weiss wohin er will, der kommt leicht woanders hin.
[-] The following 1 user says Thank You to Anachron for this post:
  • Dorena Verne
Zitieren
#5
ChatGPT erstelle ein lsl script das ein Garagentor mit Mausklick nach oben innen auf und zu schieben kann

Hier ist ein LSL-Skript, das ein Garagentor mit einem Mausklick nach oben innen öffnen und schließen kann:

Code:
/*
* Garagentor-Skript
*
* Dieses Skript ermöglicht es, ein Garagentor durch Mausklick nach oben innen zu öffnen und zu schließen.
*/

/* Initiale Position und Rotation des Garagentors */
vector      INITIAL_POSITION;
rotation    INITIAL_ROTATION;

/* Zielposition und -rotation des Garagentors im geöffneten Zustand */
vector      OPEN_POSITION        = <0.0, 2.0, 0.5>;  // Beispielwert, anpassen je nach Türgröße und -position
rotation    OPEN_ROTATION        = llEuler2Rot(<90.0, 0.0, 0.0> * DEG_TO_RAD);  // Beispielwert, Tür rotiert um 90 Grad nach innen

/* Zeit, die das Öffnen/Schließen dauert, in Sekunden */
float       SECONDS_TO_MOVE      = 2.0;

/* Türzustand: TRUE = geschlossen, FALSE = geöffnet */
integer     gClosed              = TRUE;

default {
    state_entry() {
        /* Initiale Position und Rotation speichern */
        INITIAL_POSITION = llGetPos();
        INITIAL_ROTATION = llGetRot();
    }

    touch_start(integer total_number) {
        /* Öffnen oder Schließen der Tür basierend auf dem aktuellen Zustand */
        if (gClosed) {
            /* Tür öffnen */
            llSetPrimitiveParams([PRIM_POSITION, OPEN_POSITION, PRIM_ROTATION, OPEN_ROTATION]);
            gClosed = FALSE;
        } else {
            /* Tür schließen */
            llSetPrimitiveParams([PRIM_POSITION, INITIAL_POSITION, PRIM_ROTATION, INITIAL_ROTATION]);
            gClosed = TRUE;
        }
    }
}

### Anpassungen:

1. **Position und Rotation:** Die Werte in `OPEN_POSITION` und `OPEN_ROTATION` sind Beispielwerte und müssen an die spezifische Position und Rotation deines Garagentors angepasst werden.
2. **Bewegungszeit:** Die Zeit in `SECONDS_TO_MOVE` kann angepasst werden, um die Geschwindigkeit des Öffnens und Schließens zu ändern.

Dieses Skript setzt voraus, dass das Garagentor ein einzelnes Prim ist. Wenn das Garagentor aus mehreren Prims besteht, müssen zusätzliche Anpassungen vorgenommen werden, um die Position und Rotation jedes Prim zu handhaben.
Ein Metaversum sind viele kleine Räume, die nahtlos aneinander passen,
sowie direkt sichtbar und begehbar sind, als wäre es aus einem Guss.



Zitieren


Möglicherweise verwandte Themen…
Thema Verfasser Antworten Ansichten Letzter Beitrag
  Suche Lichtscript LadyContessa Barbosa 8 8.986 21.03.2024, 16:22
Letzter Beitrag: Manfred Aabye
Question Tür script gesucht, Tür soll bei Eintritt ein paar meter vorher öffnen Kalkofe 9 1.430 11.10.2023, 05:37
Letzter Beitrag: Christoph Balhaus
  Rufknopf Script für Aufzug gesucht Xenos Yifu 4 2.249 03.04.2022, 19:09
Letzter Beitrag: Mareta Dagostino
  Geber/ Rezz Script Xenos Yifu 10 5.295 28.11.2020, 14:28
Letzter Beitrag: Kubwa
  Suche Script Gruppe Titoss 4 7.004 27.11.2020, 14:52
Letzter Beitrag: Dorena Verne

Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste