Jump to content
  • 0

Vehicle door script


cdf114 Zenfold
 Share

You are about to reply to a thread that has been inactive for 4412 days.

Please take a moment to consider if this thread is worth bumping.

Question

hello again another script problem trying to mod this free script i have to be linkable and a 1 prim door and for a boat i am building i have tried putting i  new lines for it but still no luck if anyone could help that would be great

// If door is locked, the name of the avatar who locked it.
// If door is not locked, the empty string ("").
string gLockedBy = "";

// This number must match the channel number of the lock
// and unlock objects you want to use. If multiple doors
// have the same channel, then a single lock can lock all of
// them at once.
integer gLockChannel = 243;

default
{
state_entry()
{
llSay(0, "Door 1.0");
llListen(gLockChannel, "", NULL_KEY, "");
state closed;
}
}

state closed
{
listen(integer channel, string name, key id, string message)
{
if (channel == gLockChannel)
{
if (message == "")
{
gLockedBy = "";
//llTriggerSound("door unlock", 10.0);
llSay(0, "unlocked");
}
else
{
gLockedBy = message;
//llTriggerSound("door lock", 10.0);
llSay(0, "locked");
}
}
}

touch_start(integer total_number)
{
string name = llDetectedName(0);
if (name == gLockedBy || gLockedBy == "")
{
llTriggerSound("Door open", 0.3);

rotation rot = llGetRot();
rotation delta = llEuler2Rot(<0,0,PI/4>);
rot = delta * rot;
llSetRot(rot);
llSleep(0.25);
rot = delta * rot;
llSetRot(rot);
state open;
}
else
{
llTriggerSound("Door knock", 0.3);
}
}
}

state open
{
touch_start(integer num)
{
llTriggerSound("Door close", 0.3);

rotation rot = llGetRot();
rotation delta = llEuler2Rot(<0,0,-PI/4>);
rot = delta * rot;
llSetRot(rot);

llSleep(0.25);
rot = delta * rot;
llSetRot(rot);

state closed;
}
}

thank you for reading 

C. Zenfold

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

A question like this really belongs in the LSL Scripting forum, which is set up for exactly this purpose.  This particular script is probably not the best one for what you want, though.  If you want a simple linkable door, take a look in the LSL Scripting library at this free script >>> http://community.secondlife.com/t5/LSL-Library/Simple-Hinge-Action/td-p/875331 It's about as simple as they come.  It's well suited for a one-prim door, linked or not.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4412 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...