This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Ein Schiebetürscript - schließt sich selbstständig nach einigen Sekunden
#1
Ein Schiebetürscript - schließt die Tür selbstständig nach einigen Sekunden
Code:
//When touched the prim is retracted towards one end and when touched again stretched back out.
//
//Prim moves/changes size along the local coordinate specified in the offset vector below.
//
//To change the overall size, edit the prim when stretched out and reset the script when done.
//
//The script works both in unlinked and linked prims.
//
// Copyright (C) 2008 Zilla Larsson
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License version 3, as
//    published by the Free Software Foundation.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>


vector offset = <0,0,1>; //Prim moves/changes size along this local coordinate
integer auf=FALSE;
float hi_end_fixed = FALSE; //Which end of the prim should remain in place when size changes?         
                            //The one with the higher (local) coordinate?
float min = 0.1; //The minimum size of the prim relative to its maximum size
integer ns = 10; //Number of distinct steps for move/size change


default {
    state_entry() {
        auf=FALSE;
        offset *= ((1.0 - min) / ns) * (offset * llGetScale());
        hi_end_fixed -= 0.5;
    }

    touch_start(integer detected)
       {
        if (auf) return;
        integer i;
        do  llSetPrimitiveParams([PRIM_SIZE, llGetScale() - offset,
                PRIM_POSITION, llGetLocalPos() + ((hi_end_fixed * offset) * llGetLocalRot())]);
        while ((++i) < ns);          
        offset = - offset;
        auf=!auf;
       llOwnerSay((string) auf);
        if (auf) llSetTimerEvent(10); else llSetTimerEvent(0);
   
   
}
timer()
{
   integer i;
        do  llSetPrimitiveParams([PRIM_SIZE, llGetScale() - offset,
                PRIM_POSITION, llGetLocalPos() + ((hi_end_fixed * offset) * llGetLocalRot())]);
        while ((++i) < ns);          
        offset = - offset;
        auf=!auf;
        llSetTimerEvent(0);
         }

}


Dieses Script dehnt einen Prim auf eine gewisse Länge und fährt selbstständig in die Ausgangsposition.

Ideal für Garagentore, Vorhänge und Schiebetore. Das Script funktioniert fehlerfrei in einem Prim.

Beim Anklicken vom Prim wird die Funktion 'AUF' und automatisch 'ZU' gestartet.

Coffee
Zitieren


Nachrichten in diesem Thema
Ein Schiebetürscript - schließt sich selbstständig nach einigen Sekunden - von Coffeetime - 25.09.2021, 17:22

Gehe zu:


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