PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Linkbare slinding Door


Kubwa
07.05.2010, 17:31
Uraltes Script von mir.
Ein Script für eine Schiebetür. Diese kann in jeder beleibigen Rotation, gelinkt oder ungelinkt arbeiten.

Sie hat ne Zugangsliste etc.


integer Open = FALSE;
list Access;
vector MyPosition;
integer Close;
integer Closer;
integer Public = FALSE;
integer MyChannel;
integer Line = 0;
default
{
on_rez(integer r)
{
llListenRemove(MyChannel);
MyChannel = llListen(2, "", llGetOwner(), "");
}
state_entry()
{
MyChannel = llListen(2, "", llGetOwner(), "");
llSetTimerEvent(1);
}
timer()
{
Closer = Closer - 1;
if (Closer < 0)
{
Closer = Close;
if (Close > 0)
{
Open = FALSE;
llSetPrimitiveParams([PRIM_POSITION, MyPosition]);
}
}
}
changed(integer was)
{
if (!(was & CHANGED_INVENTORY))
{return;}
Line = 0;
llWhisper(0, "Loading new data...");
llGetNotecardLine("_Config", Line);
}
dataserver(key dummy, string data)
{
if (data != EOF)
{
list Temp = llParseString2List(data, ["="], []);
if (llList2String(Temp, 0) == "Channel")
{
llListenRemove(MyChannel);
MyChannel = llListen(llList2Integer(Temp, 1), "", llGetOwner(), "");
llWhisper(0, "I will listen to channel " + llList2String(Temp, 1) + ".");
}
Line = Line + 1;
llGetNotecardLine("_Config", Line);
}
else
{llWhisper(0, "Done");}

}
touch_start(integer total_number)
{
if (((llListFindList(Access, [llToLower(llDetectedName(0))]) != -1 ||
llDetectedKey(0) == llGetOwner()) && Public == FALSE) || Public == TRUE)
{
Open = !Open;
if (Open)
{
Closer = Close;
MyPosition = llGetLocalPos();
vector MySize = llGetScale();
llSetPrimitiveParams([PRIM_POSITION,
MyPosition + (<0, MySize.y * 0.9, 0> * llGetLocalRot())]);
}
else
{llSetPrimitiveParams([PRIM_POSITION, MyPosition]);}
}
}
listen(integer sender, string name, key id, string str)
{
list Pars = llParseString2List(str, [" "], []);
string name = llDumpList2String(llList2List(Pars, 1, -1), " ");
if (llToLower(llList2String(Pars, 0)) == "timer")
{
Close = (integer)name;
name = name + " seconds";
if (Close < 1){Close = 0; name = "off";}
llWhisper(0, "Automatic close timer is set to " + name + " .");
}
if (llToLower(llList2String(Pars, 0)) == "public")
{
if (llToLower(name) == "on")
{
llWhisper(0, "Public access is on.");
Public = TRUE;
}
if (llToLower(name) == "off")
{
llWhisper(0, "Public access is off.");
Public = FALSE;
}
}
if (llToLower(llList2String(Pars, 0)) == "add")
{
if (llListFindList(Access, [llToLower(name)]) == -1)
{
Access = (Access=[]) + Access + [llToLower(name)];
llWhisper(0, name + " is in the door accesslist now.");
}
else
{llWhisper(0, name + " is allready in the door accesslist.");}
}
if (llToLower(llList2String(Pars, 0)) == "del")
{
if (llListFindList(Access, [llToLower(name)]) != -1)
{
Access = llDeleteSubList(Access,
llListFindList(Access, [llToLower(name)]),
llListFindList(Access, [llToLower(name)]));
llWhisper(0, name + " is removed from the door accesslist.");
}
else
{llWhisper(0, name + " is not in the door accesslist.");}
}
if (llToLower(llList2String(Pars, 0)) == "list")
{
llWhisper(0, "Names in the door accesslist:");
integer i;
for (i = 0; i < llGetListLength(Access); ++i)
{llWhisper(0, llList2String(Access, i));}
}
}
}


NOTECARD "_Config":

//Sliding door configuration Notecard

//Please change the values behind the =


//The channel to which the door has to hear
//You have to enter your commands into thjs channel
Channel=2


Befehle:
/2 timer [zeit] -> Stellt den Timer ein, nachdem die Tür automatisch schließt (in Sekunden) (Beispiel: /2 timer 2) - 0 sekunden für aus
/2 public [on|off] -> Erlaubt Zugriff für alle (ja/nein)
/2 add [name] -> Fügt einen Namen der Zugangsliste hinzu
/2 del [name] -> löscht einen Namen aus der Zugangsliste
/2 list -> listet die Zugangsliste auf