Difference between revisions of "User:Gordon Wendt/testbed"

From Second Life Wiki
Jump to navigation Jump to search
(forcing TOC)
m (→‎01: adding <lsl> and </lsl> tags to format properly)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>{{#vardefine:gr_text|<nowiki>{{#var:gr_text}}</nowiki>}}</noinclude>{{#if:
{{#vardefine:func_id|Warning}}
{{#vardefine:header|
{{{!}} style="background-color:#AAAAAA; margin-bottom:10px;" cellpadding="3" cellspacing="1"
{{!}} valign="top" rowspan="2" style="background:#F9F9F9;" {{!}} [[Image:Emblem-important-yellow.png]]
{{!}} style="color:white;background:#990000; border-width:1px;" width="100%" {{!}} '''Warning'''
{{!}}-
{{!}} style="background:#F9F9F9;" {{!}} ''The scripts or code snippets on this page are non functional at best and can be extremely harmful at worst, use at your own risk and only if you understand their coding and/or function''
{{#var:header}}}}
}}
<noinclude>{{#var:header}}</noinclude>
__TOC__
__TOC__


== Online/offline watcher ==
 
== 01 ==
<lsl>
 
float range = 32;
string zombieName = "Zombie";
 
default {
state_entry() {
llSensorRepeat(zombieName,"",SCRIPTED,range,PI,15);
}
 
 
// Sensor for anything matching 'zombie'
sensor (int number) {
  integer i;
  for(i=0; i < number; i++) {
    vector angle = llVecNorm(llDetectedPos(i) - llGetPos() + llDetectedVel(i));
    llRezObject("largebullet",llGetPos() + (angle*3),angle*64,zero_rotation,0);
  }
}
}
 
</lsl>
 
== 10 ==
 
 
<lsl>
<lsl>
// key entries prefixed with "k" denote keys of target avatars
// key entries prefixed with "k" denote keys of target avatars
// string entries prefixed with "i" denote status of the avatar in numerical format
// string entries prefixed with "i" denote status of the avatar in numerical format
Line 43: Line 83:
string e4;
string e4;
string e5;
string e5;
integer time = 10; // update time


default
default
Line 68: Line 110:
         llSetText("",<1,0,0>,1.0);
         llSetText("",<1,0,0>,1.0);
          
          
        llSetTimerEvent(time);
    }
       
    timer()
    {
         q1 = llRequestAgentData(k1,DATA_ONLINE);
         q1 = llRequestAgentData(k1,DATA_ONLINE);
         q2 = llRequestAgentData(k2,DATA_ONLINE);
         q2 = llRequestAgentData(k2,DATA_ONLINE);
Line 83: Line 130:
             if (i1 == "0")
             if (i1 == "0")
             {
             {
                llOwnerSay("offline");
                 s1 = "Offline";   
                 s1 = "Offline";   
             }
             }
Line 92: Line 140:
         }
         }
          
          
                if ( q2 == queryid)
        if ( q2 == queryid)
         {
         {
             i2 = data;
             i2 = data;
Line 107: Line 155:
         }
         }
          
          
                if ( q3 == queryid)
        if ( q3 == queryid)
         {
         {
             i3 = data;
             i3 = data;
              
              
             if (i3 = "0")
             if (i3 == "0")
             {
             {
                 s3 == "Offline";   
                 s3 == "Offline";   
Line 122: Line 170:
         }
         }
          
          
                if ( q4 == queryid)
        if ( q4 == queryid)
         {
         {
             i4 = data;
             i4 = data;
Line 137: Line 185:
         }
         }
          
          
                if ( q5 == queryid)
        if ( q5 == queryid)
         {
         {
             i5 = data;
             i5 = data;
Line 178: Line 226:
}
}
</lsl>
</lsl>
== 11 ==
== 100 ==
== 101 ==
== 110 ==
== 111 ==
== 1000 ==
== 1001 ==
== 1010 ==

Latest revision as of 21:32, 16 June 2009


Emblem-important-yellow.png Warning
The scripts or code snippets on this page are non functional at best and can be extremely harmful at worst, use at your own risk and only if you understand their coding and/or function


01

<lsl>

float range = 32; string zombieName = "Zombie";

default { state_entry() {

llSensorRepeat(zombieName,"",SCRIPTED,range,PI,15);

}


// Sensor for anything matching 'zombie' sensor (int number) {

 integer i;
 for(i=0; i < number; i++) {
    vector angle = llVecNorm(llDetectedPos(i) - llGetPos() + llDetectedVel(i));
    llRezObject("largebullet",llGetPos() + (angle*3),angle*64,zero_rotation,0);
  }

} }

</lsl>

10

<lsl>

// key entries prefixed with "k" denote keys of target avatars // string entries prefixed with "i" denote status of the avatar in numerical format // string entries prefixed with "s" denote status of the avatar in online/offline format // key entries prefixed with "q" denote query ids

// string entried prefexed with "e" denote display entries // string entries prefixed with "kn" denote names of target avs

key k1; string kn1; string i1; string s1; key k2; string kn2; string i2; string s2; key k3; string kn3; string i3; string s3; key k4; string kn4; string i4; string s4; key k5; string kn5; string i5; string s5;

key q1; key q2; key q3; key q4; key q5;

string e1; string e2; string e3; string e4; string e5;

integer time = 10; // update time

default {

   state_entry()
   {
       // for each k key entery the kn entry needs to be filled out with ther person's name
       
       k1 = "329c7663-df5d-40b7-ba60-ba396b9bac8b"; // Gordon Wendt
       kn1 = "Gordon Wendt";
       k2 = "4275d408-da94-4f68-8353-090fb2dfc020"; // Strife Onizuka
       kn2 = "Strife Onizuka";
       k3 = "02da98ac-3e2e-4e8f-bedc-d0e2a1c670b4"; // Prokofy Neva
       kn3 = "Prokofy Neva";
       k4 = "244195d6-c9b7-4fd6-9229-c3a8b2e60e81"; // M Linden         -- Can hide status
       kn4 = "M Linden";
       k5 = "a98f2541-04e3-46b2-b038-f82d8cf86f3f"; // Torley Linden    -- Can hide status
       kn4 = "Torley Linden";
       
       
       llSetText("",<1,0,0>,1.0);
       
       llSetTimerEvent(time);
   }
       
   timer()
   {
       q1 = llRequestAgentData(k1,DATA_ONLINE);
       q2 = llRequestAgentData(k2,DATA_ONLINE);
       q3 = llRequestAgentData(k3,DATA_ONLINE);
       q4 = llRequestAgentData(k4,DATA_ONLINE);
       q5 = llRequestAgentData(k5,DATA_ONLINE);
   }
   dataserver(key queryid, string data)
   {
       if ( q1 == queryid)
       {
           i1 = data;
           
           if (i1 == "0")
           {
               llOwnerSay("offline");
               s1 = "Offline";   
           }
           
           if (i1 == "1");
           {
               s1 = "Online";   
           }
       }
       
       if ( q2 == queryid)
       {
           i2 = data;
           
           if (i2 == "0")
           {
               s2 = "Offline";   
           }
           
           if (i2 == "1");
           {
               s2 = "Online";   
           }
       }
       
       if ( q3 == queryid)
       {
           i3 = data;
           
           if (i3 == "0")
           {
               s3 == "Offline";   
           }
           
           if (i3 == "1");
           {
               s3 = "Online";   
           }
       }
       
       if ( q4 == queryid)
       {
           i4 = data;
           
           if (i4 == "0")
           {
               s4 = "Offline";   
           }
           
           if (i4 == "1");
           {
               s4 = "Online";   
           }
       }
       
       if ( q5 == queryid)
       {
           i5 = data;
           
           if (i5 == "0")
           {
               s5 = "Offline";   
           }
           
           if (i5 == "1");
           {
               s5 = "Online";   
           }
       }
       
       e1 = kn1 + " is " + s1 ;
       e2 = kn2 + " is " + s2 ;
       e3 = kn3 + " is " + s3 ;
       e4 = kn4 + " is " + s4 ;
       e5 = kn5 + " is " + s5 ;
   
       if (i1 != "")
       {
           if (i2 != "")
           {
                       if (i3 != "")
                       {
                                   if (i4 != "")
                                   {
                                       if (i5 != "")
                                       {
                                           llSetText(e1 + "\n" + e2 + "\n" + e3 + "\n" + e4 + "\n" + e5,<1,0,0>,1.0);
                                       }
                                   }
                       }
           }
       }
   
   }

} </lsl>


11

100

101

110

111

1000

1001

1010