Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sliding doors

mutti Slade
Registered User
Join date: 5 Apr 2007
Posts: 5
04-10-2007 23:53
Sliding doors
I have bought a script for sliding doors, and I can't make it work. They wont slide...? The script is as following:

// Sliding Door Script
// By Lux Zhukovsky

vector size;
float dimx;
rotation rot;
vector angle;
string id;
integer count;
vector offset;
default
{
state_entry()
{
size= llGetScale();
size.x -= 0.1;
dimx = size.x;
rot = llGetLocalRot();
angle = llRot2Fwd(rot);
offset = dimx*angle;
}
touch_start(integer p)
{
integer x;
vector pos = llGetLocalPos();
for (x = 1; x < 2; x++)
{
llSetPos(pos + x*offset);
llSleep(0.1);
}
offset *= -1;
}
}


When I make an object I paste this script into the content folder – is there anything else I can do? I mean - eventhough the doors are standing in the middle of nowhere, I guess they should still work. Do I need to attach them to my house first? And should they be linked?

Please help - I have already spent 3 hours on these doors, and they are driving me crazy!

Mutti Slade
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-11-2007 00:57
Check the obvious, is the script is set to run?
mutti Slade
Registered User
Join date: 5 Apr 2007
Posts: 5
04-11-2007 02:26
yes
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-11-2007 03:05
OK, what actually happens when you touch the door?
You can try adding llOwnerSay messages inside the varius event handlers to see what is going on

CODE

// Sliding Door Script
// By Lux Zhukovsky

vector size;
float dimx;
rotation rot;
vector angle;
vector offset;

default
{
state_entry()
{
size= llGetScale();
size.x -= 0.1;
dimx = size.x;
rot = llGetLocalRot();
angle = llRot2Fwd(rot);
offset = dimx*angle;

llOwnerSay("Door parameters are Rot = " + (string)rot + " angle = " + (string)angle + " offset = " + (string)offset);
}

touch_start(integer p)
{
llOwnerSay("Touched");
integer x;
vector pos = llGetLocalPos();
for (x = 1; x < 2; x++)
{
pos += offset;
llSetPos(pos);
llOwnerSay("moving to " + (string)pos);
llSleep(0.1);
}
offset *= -1;
}
}

ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
04-11-2007 03:07
Sometimes it helps to lay it out with [ php ] and [/ php ] tags
CODE

// Sliding Door Script
// By Lux Zhukovsky

vector size;
float dimx;
rotation rot;
vector angle;
string id;
integer count;
vector offset;

default
{
state_entry()
{
size= llGetScale (); // get door dimensions
size.x -= 0.1;
dimx = size.x;
rot = llGetLocalRot (); //i guess object is linked? defaults to llGetRot ()
angle = llRot2Fwd (rot); // get forward direction
offset = dimx*angle; // new position?
}


touch_start(integer p)
{
integer x;
vector pos = llGetLocalPos(); // = llGetLocalPos () if not linked
for (x = 1; x < 2; x++) // this will only fire once for x = 1
{
llSetPos(pos + x*offset);
llSleep(0.1);
}
offset *= -1;
}
}
mutti Slade
Registered User
Join date: 5 Apr 2007
Posts: 5
None of my scripts are working!!??
04-11-2007 03:16
I just tried to save the preset script that appears when you cick new script. The one with "Hello Avatar". That one doesn't work either????
Is it me? Or is something really really wrong here?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-11-2007 03:17
From: mutti Slade
I just tried to save the preset script that appears when you cick new script. The one with "Hello Avatar". That one doesn't work either????
Is it me? Or is something really really wrong here?



othe robvious thing to check, Are you on script enabled land?
mutti Slade
Registered User
Join date: 5 Apr 2007
Posts: 5
Where do I check that?
04-11-2007 03:23
In about land or somewhere else also?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-11-2007 03:28
From: mutti Slade
In about land or somewhere else also?


Check for a no script icon in the title bar.
Fargis Ewing
Registered User
Join date: 8 Apr 2007
Posts: 1
04-22-2007 01:20
hi, it works for me. remove the last line, theres one too many of these {