Difference between revisions of "User talk:Ugleh Ulrik"

From Second Life Wiki
Jump to: navigation, search
m
(Added notes and previously forgotten signature.)
Line 1: Line 1:
 +
= Suggestions =
 +
 
== Vector2List ==
 
== Vector2List ==
  
<lsl>list Vector2List(vector v){  
+
<lsl>// Created by Strife Onizuka
     return [v.x, v.y, v.z]; // *Tips a wink to Strife*
+
 
 +
// Posted on this page by Fred Gandt
 +
 
 +
list Vector2List(vector v){  
 +
     return [v.x, v.y, v.z];
 
}</lsl>
 
}</lsl>
  
== FirstName & LastName==
+
== FirstName & LastName ==
  
 +
<lsl>// Created by Fred Gandt
  
<lsl>key name_q; // Used to referrence dataserver requests.
+
key name_q; // Used to referrence dataserver requests.
  
 
string FirstName(string name) // Deliver the name.
 
string FirstName(string name) // Deliver the name.
Line 51: Line 58:
 
== TrimString ==
 
== TrimString ==
  
<lsl>string TrimStringToLength(string text, integer length) // Deliver text and desired length of output.
+
<lsl>// Created by Fred Gandt
 +
 
 +
string TrimStringToLength(string text, integer length) // Deliver text and desired length of output.
 
{
 
{
 
     if(length >= llStringLength(text)) // If text is shorter than or the same length as desired...
 
     if(length >= llStringLength(text)) // If text is shorter than or the same length as desired...
Line 64: Line 73:
 
         llOwnerSay(TrimStringToLength("I like toitles!! - http://www.youtube.com/watch?v=CMNry4PE93Y", 19));
 
         llOwnerSay(TrimStringToLength("I like toitles!! - http://www.youtube.com/watch?v=CMNry4PE93Y", 19));
 
     }
 
     }
}</lsl>
+
}</lsl>-- '''[[User:Fred_Gandt|Fred Gandt]]''' <sup><small>([[User talk:Fred_Gandt|talk]]|[[Special:Contributions/Fred_Gandt|contribs]])</small></sup> 03:32, 24 April 2010 (UTC)

Revision as of 19:32, 23 April 2010

Suggestions

Vector2List

<lsl>// Created by Strife Onizuka

// Posted on this page by Fred Gandt

list Vector2List(vector v){

   return [v.x, v.y, v.z];

}</lsl>

FirstName & LastName

<lsl>// Created by Fred Gandt

key name_q; // Used to referrence dataserver requests.

string FirstName(string name) // Deliver the name. {

   return llDeleteSubString(name, llSubStringIndex(name, " "), -1);

} // Return name with all removed from the separating space to the end.

string LastName(string name) // Deliver the name. {

   return llGetSubString(name, (llSubStringIndex(name, " ") + 1), -1);

} // Return name from the separating space to the end.

string FirstOrLastName(string name, integer FoL) // TRUE for first name, FALSE for last name. {

   if(FoL) // If FoL == TRUE...
   return llDeleteSubString(name, llSubStringIndex(name, " "), -1); // Return first name.
   return llGetSubString(name, (llSubStringIndex(name, " ") + 1), -1); // If FoL != TRUE return last name.

}

default {

   state_entry()
   {
       key owner = llGetOwner(); // We need a key...wherever it may come from.
       name_q = llRequestAgentData(owner, DATA_NAME); // Request the name that belongs to that key.
   }
   dataserver(key q, string data) // Triggered by a return of data requested.
   {
       if(q == name_q) // Check which request is being answered.
       {
           llOwnerSay("First name - " + FirstName(data)); // Say the data.
           
           llOwnerSay("Last name - " + LastName(data)); // Say the data.
           
           llOwnerSay("First name - " + FirstOrLastName(data, TRUE)); // Say the data.
           
           llOwnerSay("Last name - " + FirstOrLastName(data, FALSE)); // Say the data.
       }
   }

}</lsl>

TrimString

<lsl>// Created by Fred Gandt

string TrimStringToLength(string text, integer length) // Deliver text and desired length of output. {

   if(length >= llStringLength(text)) // If text is shorter than or the same length as desired...
   return text; // Send text back.
   return (llGetSubString(text, 0, (length - 4)) + "..."); // Else, get string from text and add continuum dots.

}

default {

   state_entry()
   {
       llOwnerSay(TrimStringToLength("I like toitles!! - http://www.youtube.com/watch?v=CMNry4PE93Y", 19));
   }

}</lsl>-- Fred Gandt (talk|contribs) 03:32, 24 April 2010 (UTC)