User:Criz Collins/Scripts

From Second Life Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Here is the code that Criz Collins has submitted to the wiki - he likes to keep it all together so he can find it when he loses it in his inventory. ;D


Give InvItem every n hours

This script will give an inventory item on touch only every n hours, even if somebody touches the object more than once.

<lsl> // Idea and written by Criz Collins // Don't sell this FREE script!!!

string giveitem = "name of item in objects inventory"; float giveevery = 24; // hours!

/////////////////////////////////////////////

list visitors; list lastsent; integer n;

default {

   on_rez( integer param )
   {
       llResetScript();
   }
   changed(integer change) 
   {
       if (change & CHANGED_INVENTORY) 
       {
           llResetScript();
       }
   }
   
   touch_start(integer total_number)
   {
       for (n=0; n<total_number; n++)
       {
           integer giveallowed = 0;
           integer index = llListFindList( visitors, [ llDetectedKey(n) ] );
           if (index == -1)
           {
               visitors = visitors + [ llDetectedKey(n) ];
               lastsent = lastsent + [(integer)llGetUnixTime()];
               giveallowed = 1;
           }
           else
           {
               if (llList2Integer(lastsent, index) <= ((integer)llGetUnixTime() - (giveevery * 60 * 60)))
               {
                   list replacer = [(integer)llGetUnixTime()];
                   list newlastsent = llListReplaceList(lastsent, replacer, index, index);
                   lastsent = [];
                   lastsent = newlastsent;
                   giveallowed = 1;
               }
               else
               {
                   giveallowed = 0;
               }
           }
           if (giveallowed == 1)
           {
               llGiveInventory(llDetectedKey(n), giveitem);
           }
       }
   }

} </lsl>

XyyyyzText

This is a variation of XyText allowing up to 10 characters on a prim.
It supports different text in each line, instead of one single text which will be broken into the next lines.
Here's a picture on how it looks like: http://screencast.com/t/1wMLujLcEO
It shows the text in reversed order as the prims were linked together.

Because this is way to much for one single page which holds more than one script, here's the link to the script: XyyyyzText