Difference between revisions of "User:Toady Nakamura/sandbox"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with "string KEYPAD = "76543210"; float COUNT_X = 1; // Number of buttons (horizontal) float COUNT_Y = 8; // Number of buttons (vertical) string av_name; key av_key; def...")
(No difference)

Revision as of 09:02, 24 February 2021

string KEYPAD = "76543210";

float COUNT_X = 1; // Number of buttons (horizontal) float COUNT_Y = 8; // Number of buttons (vertical) string av_name; key av_key;

default {

   state_entry()
   {
       llSetTexture("1ea06fad-1520-15d0-4f6d-c2d422f5a073", ALL_SIDES);
       llSetObjectName(llKey2Name(llGetOwner()) + "'s Fancy Demo Touch!");
   }
   
   touch_start(integer num)
   {
       vector touched_pos = llDetectedTouchST(0);
       integer index = llFloor(touched_pos.x * COUNT_X) + 
           llFloor(touched_pos.y * COUNT_Y) * (integer) COUNT_X;
       string touch_button = llGetSubString(KEYPAD, index, index);

       av_name = llDetectedName(0);
       av_key = llDetectedKey(0);
       llMessageLinked(LINK_SET, 0, touch_button, av_key);
   }
   
   link_message(integer sib, integer n, string msg, key id ) 
   {
       string toucher_name = llKey2Name(id);
       if ( msg == "0" ) { }// do nothing // Title Section 
      
       if ( msg == "1" )
       {  
           string greeting = "Welcome , " + toucher_name + "!";
           llRegionSayTo(id, 0, greeting);
       } 
               
       if ( msg == "2" ) // wiki page
       {         
           string info =  "Visit my SL Wiki Page!";
           string url = "http://wiki.secondlife.com/wiki/User:Toady_Nakamura";
           llLoadURL(id, info, url);
           llRegionSayTo(id, 0, "Push the button on the drop down to go to my SL Wiki Page, http://wiki.secondlife.com/wiki/User:Toady_Nakamura !");
       }
       
       if ( msg == "3" ) //object details
       {   
           list details = llGetObjectDetails(id, ([OBJECT_NAME, OBJECT_POS, OBJECT_ROT]));

 

           llRegionSayTo(id, 0, " Details about you!
           \n Name: "            + llList2String(details, 0) +
           "\n Position: "       + llList2String(details, 1) + 
           "\n Rotation: "       + llList2String(details, 2));
       }
       
       if ( msg == "4" )
       {  
           key groupKey = "adda7cb5-d7ee-3e03-0bea-a27c77bbb2b3";
           string groupName = "Happy Hippsters";
           llRegionSayTo(id, 0, "Click the link to join the group '" + groupName + "'\n"
                            + "secondlife:///app/group/" + (string)groupKey + "/about");
       }
      if ( msg == "5" )
       {  
           key sound_UUID = "71a2b035-8a33-9cb3-e71b-895b515d119f";
           llPlaySound(sound_UUID, 1.0);
       }
       if ( msg == "6" )
       {  
       llRegionSayTo(id, 0,"This may take several seconds to gather the data!");
       llRegionSayTo(id, 0,
               "  Region Name    : "     + llGetRegionName()                 + 
                 "\n Sim Host Name : "     + llGetSimulatorHostname()          + 
                 "\n Region Time   : "     + (string)llGetRegionTimeDilation() +
                 "\n Region FPS    : "     + (string)llGetRegionFPS()          );
       }
       
       if ( msg == "7" )
       { 
       vector homepos = llGetPos(); 
       llSetPos(homepos + < 0,0,0.5 >);
       llRegionSayTo(id, 0, "hopping you understand, <3 Toady!");
       llSleep(5.0);
       llSetPos(homepos);
       }
   }

}