Difference between revisions of "User:Morgam Biedermann/MorgamObjects:Computer"

From Second Life Wiki
Jump to navigation Jump to search
Line 78: Line 78:


</lsl>
</lsl>
[http://wiki.secondlife.com/wiki/Category:MorgamScripts Voltar]


== Script das pastas: ==
== Script das pastas: ==

Revision as of 14:56, 28 September 2008

Script do Image Player:

É muito necessário para poder ver suas fotos favoritas...

<lsl>


list MENU1 = []; list MENU2 = []; integer listener; integer MENU_CHANNEL = 1000;

// opens menu channel and displays dialog Dialog(key id, list menu) {

   llListenRemove(listener);
   listener = llListen(MENU_CHANNEL, "", NULL_KEY, "");
   llDialog(id, "Select one object below: ", menu, MENU_CHANNEL);

}

default {

   on_rez(integer num)
   {
       // reset scripts on rez
       llResetScript();
   }

   touch_start(integer total_number)
   {
       integer i = 0;
       MENU1 = [];
       MENU2 = [];
       // count the textures in the prim to see if we need pages
       integer c = llGetInventoryNumber(INVENTORY_TEXTURE);
       if (c <= 12)
       {
           for (; i < c; ++i)
               MENU1 += llGetInventoryName(INVENTORY_TEXTURE, i);
       }
       else
       {        
           for (; i < 11; ++i)
               MENU1 += llGetInventoryName(INVENTORY_TEXTURE, i);
           if(c > 22)
               c = 22;
           for (; i < c; ++i)
               MENU2 += llGetInventoryName(INVENTORY_TEXTURE, i); 
           MENU1 += ">>";
           MENU2 += "<<";                          
       }
       // display the dialog 
       Dialog(llDetectedKey(0), MENU1);
   }

   listen(integer channel, string name, key id, string message) 
   {
       if (channel == MENU_CHANNEL)
       {
           llListenRemove(listener);  
           if (message == ">>")
           {
               Dialog(id, MENU2);
           }
           else if (message == "<<")
           {
               Dialog(id, MENU1);
           }        
           else                    
           {
               // display the texture from menu selection 
               llSetTexture(message, ALL_SIDES);

           }      
       }
   }  

}


</lsl>

Script das pastas:

Para você escolher os ítens que vai descompactar...

<lsl>


list MENU1 = []; list MENU2 = []; integer listener; integer MENU_CHANNEL = 1000;


Dialog(key id, list menu) {

   llListenRemove(listener);
   listener = llListen(MENU_CHANNEL, "", NULL_KEY, "");
   llDialog(id, "Select one object below: ", menu, MENU_CHANNEL);

}

default {

   on_rez(integer num)
   {
       llResetScript();
   }

   touch_start(integer total_number)
   {
       integer i = 0;
       MENU1 = [];
       MENU2 = [];
       integer c = llGetInventoryNumber(INVENTORY_OBJECT);
       if (c <= 12)
       {
           for (; i < c; ++i)
               MENU1 += llGetInventoryName(INVENTORY_OBJECT, i);
       }
       else
       {        
           for (; i < 11; ++i)
               MENU1 += llGetInventoryName(INVENTORY_OBJECT, i);
           if(c > 22)
               c = 22;
           for (; i < c; ++i)
               MENU2 += llGetInventoryName(INVENTORY_OBJECT, i); 
           MENU1 += ">>";
           MENU2 += "<<";                          
       }
       Dialog(llDetectedKey(0), MENU1);
   }

   listen(integer channel, string name, key id, string message) 
   {
       if (channel == MENU_CHANNEL)
       {
           llListenRemove(listener);  
           if (message == ">>")
           {
               Dialog(id, MENU2);
           }
           else if (message == "<<")
           {
               Dialog(id, MENU1);
           }        
           else                    
           {
               // todo add offsets so box sites perfect on rezzer 
               llRezAtRoot(message, llGetPos(), ZERO_VECTOR, llGetRot(), 0);
           }      
       }
   }  

}


</lsl> Ponha cada um desses em cada pasta...


Script do recebedor de e-mail:

Utilizado para pegar os e-mails recebidos... BETA

<lsl>

// Email-to-IM // DoteDote Edison

///////// constants ///////// // how often to check for new email when owner is online (seconds) float FAST = 60.0; // how often to check owner online status when owner is offline (seconds) float SLOW = 300.0; // timezone offset from UTC integer OFFSET = -4;

////////// globals ////////// key request; key owner; integer owner_online;

string GetStamp(string time) {

   list weekdays = ["THU", "FRI", "SAT", "SUN", "MON", "TUE", "WED"];
   integer a = (integer)time + (OFFSET*3600);
   integer hours = a/3600;
   integer mins = a/60;
   string day  = llList2String(weekdays, (hours/24)%7);
   return (string)(hours%24) + ":" + (string)(mins%60) + " " + day;

}

default {

   state_entry() {
       owner = llGetOwner();
       string address = (string)llGetKey() + "@lsl.secondlife.com";
       llSetText("Servidor de e-mail:\nOnline", <0.25, 1.0, 0.25>, 1.0);
       llOwnerSay("ONLINE.  O novo e-mail para " + llKey2Name(owner) + " é:\n" + address);
       llShout("O e-mail de " +llKe2Name (owner) + "é:\n" + address);
       llSetTimerEvent(FAST);
   }
   on_rez(integer start_param) {
       llResetScript();
   }
   touch_start(integer num_detect) {
       if (llDetectedKey(0) == owner) state off;
   }
   email(string time, string sender, string subject, string body, integer num_remain) {
       llInstantMessage(owner, "Email Received from: " + sender + " -- " + GetStamp(time));
       llInstantMessage(owner, body);
       if (num_remain > 0) llGetNextEmail("", "");
   }
   dataserver(key query, string data) {
       if (query == request) {
           request = "";
           if (data == "1") {
               owner_online = TRUE;
               llSetTimerEvent(FAST);
           }
           else {
               owner_online = FALSE;
               llSetTimerEvent(SLOW);
           }
       }
   }
   timer() {
       request = llRequestAgentData(owner, DATA_ONLINE);
       if (owner_online) llGetNextEmail("", "");
   }
   state_exit() {
       llSetTimerEvent(0.0);
       llSetText("Servidor de e-mail:\nOffline", <1.0, 0.25, 0.25>, 1.0);
   }

}

state off {

   touch_start(integer num_detect) {
       if (llDetectedKey(0) == owner) state default;
   }
   on_rez(integer start_param) {
       llResetScript();
   }

}


</lsl>