|
|
Line 1: |
Line 1: |
| == Dans open source scripts ==
| | {{LSL Header}} |
| {{LSL Header|[http://terminalproxy.com/]}} | |
|
| |
|
| Hello there! I'm Dantia Gothly | | Hello, I am Dantia Gothly |
| | |
| Scripter,Sculpter,Texture artist.
| |
| | |
| creater of TopHat Viewer link->(http://terminalproxy.com/)
| |
| | |
| I believe you can do just about everything in 1 script
| |
| | |
| but that also depends on what it is your doing. For the most part it can be.
| |
| | |
| | |
| quote:"dose it work? Yes it do."
| |
| | |
| ..........................................................................................................................
| |
| | |
| Pulsing alpha on a face.
| |
| <lsl>
| |
| // Here I use a single function for llSetTimerEvent(); for toggling on/off in the timer event
| |
| integer Alpha;
| |
| integer Q;
| |
| integer Time;
| |
| integer Speed = 500;
| |
| //~~~~~~~~~~~~~
| |
| DatAction()
| |
| {
| |
| llSetLinkAlpha(LINK_THIS,(float)Alpha*.01,2);
| |
| }
| |
| //~~~~~~~~~~~~~
| |
| default
| |
| {
| |
| touch_start(integer face)
| |
| {
| |
| Time=!Time;// 1.0 <<>> 0.0
| |
| llSetTimerEvent((float)(Time*.01));
| |
| }
| |
| timer()
| |
| {
| |
| for(Q=0;Q<Speed;Q++)
| |
| {
| |
| Alpha++;
| |
| DatAction();
| |
| }
| |
| for(Q=0;Q<Speed;Q++)
| |
| {
| |
| Alpha--;
| |
| DatAction();
| |
| }
| |
| }
| |
| }
| |
| </lsl>
| |
| Here is a nonphysical train script
| |
| <lsl>
| |
| //Dantia Gothly 12/22/2010
| |
| //This Script is for Open Source use.
| |
| //Bug:
| |
| //Too many sound requests. Throttled until average falls.
| |
| | |
| ////////////////////////////////////////////////////////////////////////////////////////
| |
| // (Globle 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.
| |
| | |
| //Reset or fix:
| |
| float R_B = 14;// link number of the reset botton.
| |
| vector D_L = <68.000,124.100,34.109>;//Default location.
| |
| vector D_R = <0.00,0.00,90.00>;//Default rotation.
| |
| | |
| ////////////////////////////////////////////////////////////////////////////////////////
| |
| //User defind functions are wonderful
| |
| SetLinkPosLocal2Root(integer linknum,vector offset)
| |
| {
| |
| llSetLinkPrimitiveParamsFast(linknum, [PRIM_POSITION, ((llList2Vector(
| |
| llGetLinkPrimitiveParams(linknum, [PRIM_POSITION]),0) - llGetPos())/llGetRot())+offset]);
| |
| }
| |
| DatRotPos()
| |
| {
| |
| integer t;
| |
| rotation rot=llGetRot();
| |
| 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);
| |
| }
| |
| }
| |
| /////////////////////////////////////////////////////////////////////////////////////////
| |
| 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)
| |
| {
| |
| DatRotPos();
| |
| }
| |
| else if (num == M_2)
| |
| {
| |
| DatRotPos();
| |
| }
| |
| else if (num == M_3)
| |
| {
| |
| DatRotPos();
| |
| }
| |
| else if (num == M_4)
| |
| {
| |
| DatRotPos();
| |
| }
| |
| else if(num == W_S)
| |
| {
| |
| num = 0;
| |
| llTriggerSound(Stops,Vol3);
| |
| llLoopSound(movment,Vol0);
| |
| llLoopSound(Eng,Vol1);
| |
| llSetTimerEvent(0.0);
| |
| state two;
| |
| }
| |
| else if(num == E_S)
| |
| {
| |
| llTriggerSound(Stops,Vol3);
| |
| llLoopSound(movment,Vol0);
| |
| llLoopSound(Eng,Vol1);
| |
| llSetTimerEvent(0.0);
| |
| state two;
| |
| }
| |
| llSetText("",<1,1,1>,1.0);//Display math.
| |
| }
| |
| ///////////////////////////////////////////////////////////////////////////////////////
| |
| // In case the train brakes touch Reset botton.
| |
| touch_start(integer face)
| |
| {
| |
| if(llDetectedLinkNumber(0) == R_B)
| |
| {
| |
| num = 0;
| |
| state fix;
| |
| }
| |
| }
| |
| }
| |
| ///////////////////////////////////////////////////////////////////////////////////////
| |
| 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;
| |
| }
| |
| }
| |
| | |
| state fix
| |
| {
| |
| state_entry()
| |
| {
| |
| llSetTimerEvent(0.01);
| |
| llOwnerSay("Reseting train...");
| |
| }
| |
| timer()
| |
| {
| |
| llSetLinkPrimitiveParamsFast(LINK_THIS,
| |
| [PRIM_POSITION,D_L,
| |
| PRIM_ROTATION,(llEuler2Rot(D_R*DEG_TO_RAD))]);
| |
|
| |
| if(llGetPos() == D_L)
| |
| {
| |
| llOwnerSay("Restarting train...");
| |
| llSleep(2.0);
| |
| state default;
| |
| }
| |
| }
| |
| }
| |
| </lsl>
| |
| | |
| This is a good way to do Random llRezObject.
| |
| | |
| <lsl>
| |
| integer i;
| |
| | |
| DGRandomRez(float number)
| |
| {
| |
| for(i=(integer)llFrand(number);i>0;i--)
| |
| {
| |
| llRezObject("Object", llGetPos() + <0.0,0.0,1.0>, <llFrand(3.0),llFrand(3.0),llFrand(3.0)>, <0.0,0.0,llFrand(360),1.0>, 0);
| |
| }
| |
| }
| |
| | |
| default
| |
| {
| |
| state_entry()
| |
| {
| |
| DGRandomRez(5);//This will rez an object at random 1-5.
| |
| }
| |
| }
| |
| | |
| </lsl>
| |
| Sound looper for when your walking.
| |
| <lsl>
| |
| float Timer = 1;
| |
| integer Sound = 1;//what sound to play.
| |
| float Vol = 0.8;
| |
| integer GLL;
| |
| list Sounds = ["","","","",""];//List of sounds.
| |
| default
| |
| {
| |
| state_entry()
| |
| {
| |
| GLL = llGetListLength(Sounds);
| |
| llSetTimerEvent(Timer);
| |
| integer Q;
| |
|
| |
| for(Q=0;Q<GLL;Q++)//Preload sounds!
| |
| {
| |
| llPreloadSound((string)llList2Key(Sounds,Q));
| |
| }
| |
| }
| |
| timer()
| |
| {
| |
| if((llGetAgentInfo(llGetOwner()) & AGENT_WALKING))
| |
| {
| |
| llLoopSound((string)llList2Key(Sounds,Sound),Vol);//single sound;
| |
| //or you can use this for random sounds.
| |
| llLoopSound((string)llList2Key(Sounds,(integer)llFrand(GLL)),Vol);//Random sound.
| |
| }
| |
| else
| |
| {
| |
| llStopSound();
| |
| }
| |
| }
| |
| }
| |
| </lsl>
| |
| Notes:
| |
| <lsl>
| |
| list in;
| |
| integer len_in = llGetListLength(in);
| |
| integer flen_in = (in != []);
| |
| //flen_in and len_in will be the same
| |
|
| |
| integer neg_len_in = -llGetListLength(in);
| |
| integer fneg_len_in = ([] != in);
| |
| //fneg_len_in and neg_len_in will be the same
| |
| </lsl>
| |
|
| |
|
| | I am a content creator and owner of Purgatory. |
|
| |
|
|
| |
|
Line 329: |
Line 11: |
| |Builder=* | | |Builder=* |
| |Scripter=* | | |Scripter=* |
| |Terraformer= | | |Terraformer=* |
| |}} | | |}} |
| {{ISO 639-3/cat-speaking|eng}} | | {{ISO 639-3/cat-speaking|eng}} |