Difference between revisions of "User:Dantia Gothly"

From Second Life Wiki
Jump to: navigation, search
(Dans open source scripts)
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{LSL Header|[[http://terminalproxy.com/]]}}
+
== Dans open source scripts ==
 +
{{LSL Header|[http://terminalproxy.com/]}}
  
 
Hello there! I'm Dantia Gothly
 
Hello there! I'm Dantia Gothly
 +
 
Scripter,Sculpter,Texture artist.
 
Scripter,Sculpter,Texture artist.
 +
 
creater of TopHat Viewer link->(http://terminalproxy.com/)
 
creater of TopHat Viewer link->(http://terminalproxy.com/)
  
 
I believe you can do just about everything in 1 script
 
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.
 
but that also depends on what it is your doing. For the most part it can be.
 +
  
 
quote:"dose it work? Yes it do."
 
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
 
Here is a nonphysical train script
 
<lsl>
 
<lsl>
//Copyright (C) 2011 Dantia Gothly
+
//Dantia Gothly 12/22/2010
//This program is free software; you can redistribute it and/or
+
//This Script is for Open Source use.
//modify it under the terms of the GNU General Public License
+
//Bug:
//as published by the Free Software Foundation; either version 2
+
//Too many sound requestsThrottled until average falls.
//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 PURPOSESee the
+
//GNU General Public License for more details.
+
 
////////////////////////////////////////////////////////////////////////////////////////
 
////////////////////////////////////////////////////////////////////////////////////////
//                                    (Global Settings)
+
//                                    (Globle Settings)
  
 
// Door movment:
 
// Door movment:
Line 74: Line 112:
 
float Vol0 = 0.0;// Volume mute.
 
float Vol0 = 0.0;// Volume mute.
  
// default location = <67.797,124.500,33.107>
+
//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
 
//User defind functions are wonderful
Line 81: Line 123:
 
     llSetLinkPrimitiveParamsFast(linknum, [PRIM_POSITION, ((llList2Vector(
 
     llSetLinkPrimitiveParamsFast(linknum, [PRIM_POSITION, ((llList2Vector(
 
     llGetLinkPrimitiveParams(linknum, [PRIM_POSITION]),0) - llGetPos())/llGetRot())+offset]);
 
     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);
 +
    }
 
}
 
}
 
/////////////////////////////////////////////////////////////////////////////////////////
 
/////////////////////////////////////////////////////////////////////////////////////////
Line 104: Line 158:
 
         if(num == M_1)
 
         if(num == M_1)
 
         {
 
         {
            llSay(0,"in check M_2");
+
           DatRotPos();
           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)
 
         else if (num == M_2)
 
         {
 
         {
            llSay(0,"in check M_3");
+
           DatRotPos();
            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)
 
         else if (num == M_3)
 
         {
 
         {
            llSay(0,"in check M_4");
+
           DatRotPos();
           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)
 
         else if (num == M_4)
 
         {
 
         {
           llSay(0,"in check M_1");
+
           DatRotPos();
          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)
 
         else if(num == W_S)
Line 153: Line 179:
 
             llLoopSound(Eng,Vol1);
 
             llLoopSound(Eng,Vol1);
 
             llSetTimerEvent(0.0);
 
             llSetTimerEvent(0.0);
            llSay(0,"At West station");
 
 
             state two;
 
             state two;
 
         }
 
         }
Line 162: Line 187:
 
             llLoopSound(Eng,Vol1);
 
             llLoopSound(Eng,Vol1);
 
             llSetTimerEvent(0.0);
 
             llSetTimerEvent(0.0);
            llSay(0,"At East station");
 
 
             state two;
 
             state two;
 
         }           
 
         }           
         llSetText((string)num,<1,1,1>,1.0);
+
         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;
 +
        }
 
     }
 
     }
 
}
 
}
Line 195: Line 229:
 
     }
 
     }
 
}
 
}
 +
 +
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>
 
</lsl>
  
things
+
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>
 +
 
 +
 
 +
 
  
 
{{skills
 
{{skills
 
|Architect=*
 
|Architect=*
 
|Builder=*
 
|Builder=*
|Machinima=
 
|Scenographer=
 
 
|Scripter=*
 
|Scripter=*
|SLogistician=*
 
 
|Terraformer=
 
|Terraformer=
 
|}}
 
|}}
{{Tweeter}}
 
 
{{ISO 639-3/cat-speaking|eng}}
 
{{ISO 639-3/cat-speaking|eng}}

Latest revision as of 13:04, 12 April 2011

Dans open source scripts

Hello there! I'm 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>