Change font size
It is currently Tue Sep 18, 2018 7:55 pm

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 1   [ 6 posts ]
Author Message
 Post subject: Door Problem
PostPosted: Thu Nov 08, 2012 4:34 pm 
Furious Typer
User avatar

Joined: Tue Oct 16, 2012 8:46 pm
Posts: 103
Location: Orlando, Florida
I have a script that I use in SL for a door, but it doesn't work in the new grid. Not sure what I am missing here. It saves just fine, but doesn't move.

{L_CODE}:
vector openScale = <0.05, 0.10000, 3.575>;
vector closedScale = <4, 0.10000, 3.575>;

integer open=FALSE;


openDoors()
{
    llSetScale(openScale);
    open=TRUE;
}

closeDoors()
{
    llSetScale(closedScale);
    open=FALSE;
}




default
{
    state_entry()
    {
        closeDoors();
    }

   
    link_message(integer lin_num, integer num, string m, key id)
    {
        if(m=="open doors" && !open)
            openDoors();
           
        else if(m=="close doors")
            closeDoors();
    }   
}


Top
 Profile  
 
 Post subject: Re: Door Problem
PostPosted: Thu Nov 08, 2012 9:58 pm 
Site Admin

Joined: Sun Nov 28, 2010 5:09 pm
Posts: 399
It looks like your script is lacking any action functions, usually:

touch_start(integer num_detected)

and/or

collision(integer num_detected)

Here is a script that is a little more complicated, but you can have security with it and by changing the variables in the center change the type of door. You will need to add a note card with your avatar name and anyone else you want to use it listed, call the notecard "access list".

{L_CODE}:
//    Door Script 1.0 by Melchoir Tokhes
//    Copyright (C) 2007  Accountholder of Melchoir Tokhes(02/02/2007)
//
//    This program is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License version 2 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, write to the Free Software Foundation, Inc.,
//    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
//    The full text of the GPL2 can be found at http://www.gnu.org/licenses/gpl.txt

//      If you find this script useful and you can spare it, please consider donating
//  a tad bit of money to me -- whatever you think is fair.  Depending on my availability
//  I will support this door.  If you have any questions drop me a line.

string  ACCESS_LIST     = "access list";    //name of notecard containing access list
integer DOOR_TYPE       = 1;                //1 for swinging, 2 for sliding #IMPORTANT NOTE AT BOTTOM#
integer OPEN_METHOD     = 1;                //1 for touch, 2 for collision
float   OPEN_DEGREES    = 90.0;             //degrees to swing open for swinging doors
integer NEED_ACCESS     = 1;                //use whitelist, 0 for no, non-0 for yes
float   OPEN_TIME       = 4.5;              //time(in seconds) to stay open
integer DIRECTION       = 1;                //which way the door moves (-1 or 1)*
float   EXPOSED_TIP     = 0.1;              //how much the open sliding door hangs out**
integer COM_CHAN        = 16777;            //channel used to communicate with synched doors***
integer TWO_PART_DOOR   = 0;                //set this to non-0 if the door communicates with
                                            //another door to open in synch****
                                            //See more notes at the bottom of this file
list accessList;
integer listCounter;

vector startingPosition;
rotation startingRotation;
vector doorScale;

key queryIDCheck;


close()
{
    llSetRot(startingRotation);
    llSetPos(startingPosition);
    llSetTimerEvent(0);
}

open()
{
    if(DOOR_TYPE == 1){//This is for the swinging door type
        llSetRot(startingRotation * llEuler2Rot(<0, 0, DIRECTION * OPEN_DEGREES * DEG_TO_RAD> ));
        llSetTimerEvent(OPEN_TIME);
    }
   
    if(DOOR_TYPE == 2){//This is for the sliding door type
        llSetPos(startingPosition + <0, doorScale.y * DIRECTION - (doorScale.y * DIRECTION * EXPOSED_TIP), 0>);//**
        llSetTimerEvent(OPEN_TIME);
    }
}


default
{
    state_entry()
    {       
        integer numberOfCards;
        integer foundCard;

        startingPosition = llGetPos();
        startingRotation = llGetRot();
        doorScale = llGetScale();
        if(TWO_PART_DOOR) llListen(COM_CHAN, "", NULL_KEY, ".");
       
        for(numberOfCards = llGetInventoryNumber(INVENTORY_NOTECARD); numberOfCards > 0; --numberOfCards)
            if(llGetInventoryName(INVENTORY_NOTECARD, numberOfCards - 1) == ACCESS_LIST) foundCard = 1;
        if(NEED_ACCESS){
            if(foundCard){queryIDCheck = llGetNotecardLine(ACCESS_LIST, listCounter++);}
            else llOwnerSay("Could not find access list");
        }
    }

    touch_start(integer num_detected)
    {
        if(OPEN_METHOD == 1){
            string accesseeCandidate = llToLower(llDetectedName(0));
            if(NEED_ACCESS){
                if(TWO_PART_DOOR) llWhisper(COM_CHAN, ".");
                if(llListFindList(accessList, [accesseeCandidate]) != -1) open();
                else llWhisper(0, "Locked.");
            }
        }
    }
   
    collision(integer num_detected)
    {
        if(OPEN_METHOD == 2){
            string accesseeCandidate = llToLower(llDetectedName(0));
            if(NEED_ACCESS){
                if(TWO_PART_DOOR) llWhisper(COM_CHAN, ".");
                if(llListFindList(accessList, [accesseeCandidate]) != -1) open();
                else llWhisper(0, "Locked.");
            }
        }
    }

    listen(integer channel, string name, key id, string message)
    {
        open();
    }
   
    timer()
    {
        close();
    }
       
    dataserver(key queryID, string data)
    {
        if(queryIDCheck == queryID){
            if(data != EOF){
                accessList += llToLower(data);
                queryIDCheck = llGetNotecardLine(ACCESS_LIST, listCounter++);
            }
            else llOwnerSay("Access list loading complete.");
        }
    }
   
}

//  *   For pairs of doors, typically one would need to invert the direction for the other
//  door that corresponds.  If the door is sliding on the wrong axis, move the expression
//  that determines the movement to the other axis, either X or W, and set the other to 0

//  **  This number represents how much(in factor of door width) of the door is left showing
//  in its opened position.  If the door is built using the technique of setting the cut
//  to 0.375 - 0.875 as is done for a swinging door then be sure to add " / 2 " immediately
//  after "doorScale.y" in the expression that determines its new position.  Depending on how
//  the door is built, you might have to use "doorScale.x" in the expression instead.
// 
//  It's feasable, using trickery of this number and the synched doors functionality to
//  make multi-section telescoping doors :)

//  *** This number represents the channel the door whispers on to activate the other door
//  in a synched pair of doors.  If you are using another pair of doors within this range
//  and one pair is interfering with the other, be sure to make this channel unique to
//  each pair of doors.

//  ****This number is either 1 or -1, which reverses the direction the door moves when
//  opened.  If you are using a synched pair of doors, first get one door to open the way
//  you want, then reverse it on the other one.

//  #   If you want to use the swinging door type, the door must be build as a block
//  with a cut from 0.375 - 0.875 such that the palpable portion of the door is only
//  half of it's true dimensions, and the true center of the door is at one edge of
//  the palpable portion.  Position the door so that this center location is at the
//  position from which you would like the door to pivot.
//      You may also be interested in setting the texture for the facial surfaces of
//  the door as 2 repeats per face and 0.5 offset on the X axis.


Top
 Profile  
 
 Post subject: Re: Door Problem
PostPosted: Fri Nov 09, 2012 12:50 am 
Furious Typer
User avatar

Joined: Sat May 26, 2012 8:56 pm
Posts: 280
Looks like your script is waiting for a link message from another prim to open it. And the open and closing doesn't involve any movement, it just scales the size door to appear to be open or closed. So that door needs to be linked to another prim (like a doorbell or something) and the doorbell when touched will send the open doors or close doors message. I am not in world at the moment, but it would be very simple to knock the doorbell script.. and link it to your door.. let me know if you are still having problems.


Top
 Profile  
 
 Post subject: Re: Door Problem
PostPosted: Fri Nov 09, 2012 1:18 pm 
Furious Typer
User avatar

Joined: Mon Oct 25, 2010 7:42 pm
Posts: 234
Location: Canada
I always try to mostly use scripts I find in this forum. I had an SL door script that I like but it never worked here. Every now and then SL doesn't seem to translate to OpenSim.


Top
 Profile  
 
 Post subject: Re: Door Problem
PostPosted: Fri Nov 09, 2012 2:44 pm 
User avatar

Joined: Sun Sep 30, 2012 10:28 am
Posts: 40
Sometimes it won't compile at all because lsl in opensim and lsl in sl don't use exactly the same syntax. And some functions don't do the same things in opensim as they do in sl. And some others are not implemented at all.


Top
 Profile  
 
 Post subject: Re: Door Problem
PostPosted: Fri Nov 09, 2012 3:50 pm 
OSG Elite

Joined: Tue Dec 21, 2010 8:01 pm
Posts: 370
I hear this alot, and I don't know what Opensimulator everyone is using, but we are script heavy all over our regions and don't see this at all. I think we may have 1 out of the 1000 scripts we've brought over that "don't" function in Opensimulator (and usually, it's something physics related). Well make that 2, because they recently broke llGiveInventory, so that doesn't work as it should (let me be clear.. it doesn't work LIKE SL) anymore. But there are generally 2 things that consistently will trash our scripts when brought directly from SL, and both are very easy to fix. One is this

When there's a variable declared then used again to declare a variable it blows up ex:

ITSSTUPIDTHEYDOTHIS = "itsstupidtheydothis"
integer = ITSSTUPIDTHEYDOTHIS

if you get some syntax error that tells you "blah, blah, blah not the same LS to OSSL" or some other cryptic nonsense, just put what is after the equals in the variable after the integer section rather than the integer name ex:

ITSSTUPIDTHEYDOTHIS = "itsstupidtheydothis"
integer = itsstupidtheydothis

Why people name a variable the same name as the defining variable (except using smallcaps or something similar) is beyond me but they do, and they do it ALOT. If your going to do that, then just put the integer name in and forget the variable. Your typing it anyway since it's the same name, what's the savings doing that?

That solves about 80% of every issue we see bringing a script over.

The other 20% is related to the LSL "let's see if we can't save some memory" code that was in place prior to MONO installation. This is also easily corrected, but it escapes me at the moment how, if you contact Dirk Mathers in world he can elaborate on both issues. But this I can assure you of, we have tons of scripts here. Timers, RLV scripts, etc, etc, etc.. And 99% of them work fine with the adjustments made above. As for door scripts... I have 40 different ones that all work perfectly in world. You can find them all over the place. Sliders, hinge types, double doors, collision, locking, voice controlled... and every single one of them came here from SL with either no modification, or the mods above. Contact me in world or contact Dirk Mathers in world and we'll be happy to give you a whole box full of door scripts.

_________________
Walter Balazic
Littlefield Systems
http://www.lfgrid.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 6 posts ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net