User:Dantia Gothly: Difference between revisions
No edit summary |
No edit summary |
||
| Line 187: | Line 187: | ||
} | } | ||
</lsl> | </lsl> | ||
things | |||
{{skills | |||
|Architect=* | |||
|Builder=* | |||
|Machinima= | |||
|Scenographer= | |||
|Scripter=* | |||
|SLogistician=* | |||
|Terraformer= | |||
|}} | |||
{{Tweeter}} | |||
{{ISO 639-3/cat-speaking|eng}} | |||
Revision as of 20:40, 11 January 2011
| LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials | [[1]] |
This is for nonphysical train. <lsl> //Copyright (C) 2011 Dantia Gothly //This program is free software; you can redistribute it and/or //modify it under the terms of the GNU General Public License //as published by the Free Software Foundation; either version 2 //of the License, or (at your option) any later version. //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. //////////////////////////////////////////////////////////////////////////////////////// // (Global Settings)
// Door movment: float T_S2 = 2.0;//timer stoped before opening door. float Train_leave = 0.8;//how long the train sits after closing the doors and takes off float Door_open = 10.0;//How long the doors are Open. integer door1 = 2;//find the link number for the door you want to move. integer door2 = 3; float Door_Slid_dist = 3.3;//sets the slide forword distance of the door on the X axis
//Math: integer num = 1;//do math 1+1=__ integer num2 = 1;
//Predefined integers etc: integer i; integer t;
//Train turn timming: float M_1 = 255;// first turn float M_2 = 735;//second turn float M_3 = 1215;//therd turn float M_4 = 1695;//forth turn
//Station stop timming: float W_S = 1920;//start train at west station. float E_S = 985;//stop at east station.
//Speed:(note:If this number changes the turn timming and stops must be changed) float speed = .20;// Speed controls the PRIM_POSITION
//Timers: float T_S1 = 0.001;//Timer controls the default timer float Horn_timing = 1.0;//horn sound then door opens/closes. float door_Open_timing = 1.7; float door_Close_timing = 2.6;
//Sounds: string Eng = "d0dc3135-d00a-a3ed-88b0-412a9d867734";//freezer-s string movment = "8737851f-17e3-bb15-b71e-f4235ad64f65";//train-going string Stops = "51a96f42-80ff-db3f-d44f-01002c921946";//train-breaks string Horn = "4e7218f7-6983-64d6-7d0b-bca5b19dfec8";//train-stand-clear string DoorOpen = "26dc4084-9380-e0d2-8810-f624277b6e66";//train-door-open string DoorClose = "fffcde68-ad75-4c7b-17ff-7cfecf65cd4a";//train-door-close
//Volume:
float Vol3 = 1.0;// Volume high.
float Vol2 = 0.5;// Volume mid.
float Vol1 = 0.2;// Volume low.
float Vol0 = 0.0;// Volume mute.
// default location = <67.797,124.500,33.107> //////////////////////////////////////////////////////////////////////////////////////// //User defind functions are wonderful SetLinkPosLocal2Root(integer linknum,vector offset) {
llSetLinkPrimitiveParamsFast(linknum, [PRIM_POSITION, ((llList2Vector( llGetLinkPrimitiveParams(linknum, [PRIM_POSITION]),0) - llGetPos())/llGetRot())+offset]);
} ///////////////////////////////////////////////////////////////////////////////////////// default { ////////////////////////////////////////////////////////////////////////////////////////
state_entry()
{
llSetTimerEvent(T_S1);
llLoopSound(Eng,Vol3);
llLoopSound(movment,Vol3);
}
/////////////////////////////////////////////////////////////////////////////////////////
timer()
{
integer t;
rotation rot=llGetRot();
num += num2;
llSetLinkPrimitiveParamsFast(LINK_THIS,
[PRIM_POSITION, llGetPos()+(< speed,0.0,0.0>*llGetRot())]);
if(num == M_1)
{
llSay(0,"in check M_2");
for(t=0;t<=90;t++)
{
llSetLinkPrimitiveParamsFast(LINK_THIS,
[PRIM_POSITION, llGetPos()+(< speed,0.0,0.0>*llGetRot()),
PRIM_ROTATION,(rot/llEuler2Rot(<0,0,t>*DEG_TO_RAD))]);
llSleep(0.04);
}
}
else if (num == M_2)
{
llSay(0,"in check M_3");
for(t=0;t<=90;t++)
{
llSetLinkPrimitiveParamsFast(LINK_THIS,
[PRIM_POSITION, llGetPos()+(< speed,0.0,0.0>*llGetRot()),
PRIM_ROTATION,(rot/llEuler2Rot(<0,0,t>*DEG_TO_RAD))]);
llSleep(0.04);
}
}
else if (num == M_3)
{
llSay(0,"in check M_4");
for(t=0;t<=90;t++)
{
llSetLinkPrimitiveParamsFast(LINK_THIS,
[PRIM_POSITION, llGetPos()+(< speed,0.0,0.0>*llGetRot()),
PRIM_ROTATION,(rot/llEuler2Rot(<0,0,t>*DEG_TO_RAD))]);
llSleep(0.04);
}
}
else if (num == M_4)
{
llSay(0,"in check M_1");
for(t=0;t<=90;t++)
{
llSetLinkPrimitiveParamsFast(LINK_THIS,
[PRIM_POSITION, llGetPos()+(< speed,0.0,0.0>*llGetRot()),
PRIM_ROTATION,(rot/llEuler2Rot(<0,0,t>*DEG_TO_RAD))]);
llSleep(0.04);
}
}
else if(num == W_S)
{
num = 0;
llTriggerSound(Stops,Vol3);
llLoopSound(movment,Vol0);
llLoopSound(Eng,Vol1);
llSetTimerEvent(0.0);
llSay(0,"At West station");
state two;
}
else if(num == E_S)
{
llTriggerSound(Stops,Vol3);
llLoopSound(movment,Vol0);
llLoopSound(Eng,Vol1);
llSetTimerEvent(0.0);
llSay(0,"At East station");
state two;
}
llSetText((string)num,<1,1,1>,1.0);
}
} /////////////////////////////////////////////////////////////////////////////////////// state two {
state_entry()
{
llSetTimerEvent(T_S2);
}
timer()
{
llTriggerSound(Horn,Vol3);
llSleep(Horn_timing);
llTriggerSound(DoorOpen,Vol3);
llSleep(door_Open_timing);
SetLinkPosLocal2Root(door1,<Door_Slid_dist,0.0,0.0>);
SetLinkPosLocal2Root(door2,<Door_Slid_dist,0.0,0.0>);
llSleep(Door_open);
llTriggerSound(Horn,Vol3);
llSleep(Horn_timing);
llTriggerSound(DoorClose,Vol3);
llSleep(door_Close_timing);
SetLinkPosLocal2Root(door1,<-Door_Slid_dist,0.0,0.0>);
SetLinkPosLocal2Root(door2,<-Door_Slid_dist,0.0,0.0>);
llSleep(Train_leave);
state default; }
} </lsl>
things