<lsl code>

// 2007 Droid X Tricks By Simon Sugita user editable portion of code. Based on tricks from Skippy Tor for Sparky in 2006

// Enjoy!

// Don't bother setting up your own chat handler

// X passes any unhandles messages through link

// messages

// X tricks script contains OS scripts that are made by others like:

//llAirPressure(vector v) Script; Created by: Cid Jacobs, Original by: Cid Jacobs, Last Updated: 11-17-05 Notes: Speak with Cid Jacobs about any concerns.

//--------------------Globals

float temperatureF; //floats you use when in need of decimal numbers; float temperatureF is gonna be the number for our calculated temperature in Farhenheit.

float trickStartTime;//float trickStartTime; is gonna be a decimal used for trickstarttime whatever that is ??

float llAirPressure(vector Offset)//float llAirPressure(vector Offset) is gonna be used to get a decimal number thats representing our

// calculated airpressure in KiloPascal.

{//starting script calculation code block of airpressure in KiloPascal.

    vector pos = llGetPos(); //Extrapolate Task's Local Coordinates.

    float Base_Reading = llLog10(5-(((pos.z-llWater(ZERO_VECTOR))+Offset.z)/15500)); //float Base_Reading is the result as an decimal number representing

// the calculated & Calibrated Air Pressure.

    float KiloPascal = (101.32500 + Base_Reading); //Total Sum Air Pressure

    return KiloPascal;// gives the result of this lil code for airpressure in KiloPascal as an decimal number and make sure to go on again in this script.

}//closing script calculation code block for airpressure in KiloPascal as an decimal number

vector sun; //array of a floating point value that gonna represent position of the sun.

vector pos; //array of a floating point value that gonna represent position of the robot.

vector Offset = <0,0,10>; //array of a floating point value for user definable vector Offset (default value=<0,0,10>) used in calculations for pressure & temp.

string smin;//a string is text data, string smin; is for defining minutes.

string sseconds;//this string, string sseconds; is for definding seconds.

commandBus (integer num, string verb, key id)//this linkmessage(=read: commandBus.. ) is used to communicate between 2 (or more) prims/scripts in X's parts

{//start listener/linkedcode for spoken commands by owner

    if (verb=="sleep" || verb == "reset" || verb =="stop")//listens if owner of X, said "sleep", "reset", or "stop" by owner of X

    {//if so open code block

    llResetScript();//and reset this script

    }//work done closing code block to go on...

   

    if (verb=="time")//listens if owner of X said "time"

    {//if so open code block

    state time;//and goto state time: code block see state time>

    }//work done for now closing code block to go on...

   

    if (verb=="avinfo")

    {

    state avinfo;  

    }

   

    if (verb=="showroom")

    {

    state showRoom;

    }

   

    if (verb=="touchedby")

    {

        if (llDetectedKey(0)==llGetOwner())

        {

        llMessageLinked(LINK_SET,0,"reset",llGetOwner());

        llResetScript();

        }

            else        

            llSay(0,"***Purs***");

    }

   

    if (verb == "speak")

    {

    llSay(0,"Now is the time for all humans to...um... **chirp**");  

    return;

    }

   

    if (verb == "simstat")

    {

    reportSimStat();

    return;

    }

   

    if (verb == "weather")

    {

    reportWeather();

    return;

    }

   

    if (verb == "airpressure")

    {

    reportAirPressure ();

    return;

    }  

   

    if (verb=="rofl")

    {

    trickROFL();  

    }   

   

    if (verb=="playdead")

    {

    state playDead;  

    }     

   

    if (verb=="woot")

    {

    llSay(0,"Raise the Roof");

    return;

    }      

}

reportSimStat ()

{

llSay(0,"Regionname: "+(string)llGetRegionName());

llSleep(1);

llSay(0,"Position: "+(string)llGetPos());

llSleep(1);

llSay(0,"Time Dilation: "+(string)llGetRegionTimeDilation());

llSleep(1);

llSay(0,"Frame Rate: "+(string)llGetRegionFPS());

llSay(0,"Hostname: "+(string)llGetSimulatorHostname());

}

reportAirPressure ()

{//Say Current Total Air Pressure at Task + V

llSay(0,"Current air pressure is: "

        +

        (string)llAirPressure(Offset)

        +

        " KiloPascal."

     );

}

   

reportWeather ()

{

sun=llGetSunDirection();

temperatureF=((((llAirPressure(Offset)*(2*llPow(10,22)))/(1.8311*llPow(10,20))/ 8.314472)/19.85553747)+(sun.z*10));

llSay(0,"Current Temperature is "+ (string)temperatureF +" Degrees Fahrenheit");

llSleep(1);

llSay(0,"Current Temperature is "+ (string)((temperatureF + 459.67) * 5/9) +" Degrees Kelvin");

llSleep(1);

llSay(0,"Current Temperature is "+ (string)((temperatureF - 32) * 5/9) +" Degrees Celsius");

llSleep(1);

vector wind = llWind(<0,0,0>);

llSay(0,"Wind speed: " + (string)llVecMag(wind));

llSleep(1);

//Say Current Total Air Pressure at Task + V

llSay(0,"Current air pressure is: "

        +

        (string)llAirPressure(Offset)

        +

        " KiloPascal."

     );

}

trickROFL()

{

         llOwnerSay("Rolling on Floor");

        llMessageLinked(LINK_SET,AGENT,"follow",NULL_KEY);  

        llMessageLinked(LINK_SET,TRUE,"physicsMode",NULL_KEY);                

        //llMessageLinked(LINK_SET,AGENT,"follow",NULL_KEY);   

        //Do these stops in this order or your droid WILL fall through the ground

        llSetBuoyancy(0.0); 

        // so this trick 10 seconds

        llApplyImpulse(<1,0,0>,1);

        llSleep(10.0);

         llSetBuoyancy(1.0);

        llMessageLinked(LINK_SET,FALSE,"physicsMode",NULL_KEY);                  

        llMessageLinked(LINK_SET,AGENT,"heel",llGetOwner());    

}

default

{

    link_message(integer sender_num, integer num, string verb, key id)

    {

    commandBus(num,verb,id);

    }  

}

state time

{state_entry()

{llSetTimerEvent(2.0);}timer()

{integer seconds =  llFloor(llGetWallclock());

integer min = llFloor(seconds/60);

seconds = seconds - (min*60);

integer hour = llFloor(min/60);

min = min - (hour*60);

if(hour > 12) {hour = hour - 12;}

string shour = (string)hour;

if(min < 10) {smin = "0"+(string)min;}

else { smin = (string)min;}

if(seconds < 10) { sseconds = "0"+(string)seconds;}

else {sseconds = (string)seconds;}

string time = shour + ":" + smin + ":" + sseconds;

llSay(0,"The time is now: "+time);

llResetScript();

state default;

}}

state avinfo

{

state_entry()

    {

        llSetStatus(STATUS_PHANTOM, TRUE);

        llSetText( "Touch to find out your info", < 1,1,1>, 1 );

        llSay(0,"Touch to find out your info");

    }

touch_start(integer total_number)

    {

        key avKey = llDetectedKey(0);

        vector size = llGetAgentSize(avKey);

        float meters = size.z;

        integer inches = llRound(meters / 0.0254);

        integer feet = inches / 12;

        inches = inches % 12;

        llSay(0, "Avatar: " + llDetectedName(0));

        llSay(0, "Height: " + llGetSubString((string)meters, 0, 5) + "m");

        llSay(0, "Height: " + (string)feet + "\'" + (string)inches + "\"");

        llInstantMessage(avKey, "Key: " + (string)avKey);

    llResetScript();

state default;}

}

state playDead

{

    state_entry()

    {

        llMessageLinked(LINK_SET,AGENT,"stay",NULL_KEY);        

        llMessageLinked(LINK_SET,AGENT,"follow",NULL_KEY);   

        llSetStatus(STATUS_PHANTOM,FALSE);         

        llSetStatus(STATUS_PHYSICS,TRUE);

        llSetBuoyancy(0.0); 

        llSetTimerEvent(10.0); 

    }

   

    timer()

    {

        llSetTimerEvent(0);

        state default;  

    }

   

    state_exit()

    {

        llSetStatus(STATUS_PHANTOM,TRUE);         

        llSetStatus(STATUS_PHYSICS,FALSE);

        llSetBuoyancy(1.0); 

    }

   

    link_message(integer sender_num, integer num, string verb, key id)

    {

        if ( verb != "stop")

        commandBus(num,verb,id);

    }        

}

state showRoom

{

    state_entry()

    {

        llSay(0,"x Display Model");

        llMessageLinked(LINK_SET,0,"dock",NULL_KEY);         

        llSetText(llGetObjectDesc() + "\nL$ 777",<1,1,1>,5.0);

        llSensorRepeat("",NULL_KEY,AGENT,5,PI/2.0,1);

    }  

   

    on_rez(integer parm)

    {

        string theemail;

        theemail="New x Registration for " + llKey2Name(llGetOwner()) + "\n" + (string) llGetOwner();

        llSetText("Welcome",<1,1,1>,0.0);      

        llGiveInventory(llGetOwner(),"Thanks");

        llGiveInventory(llGetOwner(),"Help");      

        llMessageLinked(LINK_SET,AGENT,"reset",NULL_KEY);    

        llEmail("mariahartog@home.nl","New x",theemail);

        llResetScript();

        state default;   

    }

   

    link_message(integer sender_num, integer num, string verb, key id)

    {

        commandBus(num,verb,id);

    }

    

    sensor(integer total)

    {

        vector lookat=llDetectedPos(0);

        lookat.z=lookat.z+1;

        llSetText(llGetObjectDesc() + "\nL$ 777",<1,1,1>,1.0);        

        llLookAt(lookat,1,0.25);   

    }      

}

</lsl code>


Page Information

  • 1 year ago [history]
  • View page source
  • You're not logged in
  • No tags yet learn more

Wiki Information

Recent PBwiki Blog Posts