Difference between revisions of "User:Pete Olihenge"

From Second Life Wiki
Jump to navigation Jump to search
(Blanked the page)
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Random negative chat channel ==
 
This LSL function should, according to my calculations, return a random negative integer in the range -2,000,000,000 to -1,000,000, suitable for use as a dialog chat channel.
<lsl>
integer GetDialogChannel ()
{
    return (integer) llFrand (-1999000001.0) - 1000000;
}
</lsl>
== Ordinal suffix ==
This LSL function takes an integer and returns a string that is the integer with its ordinal suffix ("st", "nd", "rd" or "th") appended.
<lsl>
string OrdinalSuffix (integer number)
{
    string result = "th"; //for all except 1s, 2s and 3s, but including 11, 12 and 13
    number = number % 100; //just the 10s
    if (number < 4 || number > 20) //exclude the teens (and their neighbours)
    {
        number = number % 10; //just the units
        if (number == 1) result = "st"; //*1st
        else if (number == 2) result = "nd"; //*2nd
        else if (number == 3) result = "rd"; //*3rd
    }
    return (string) number + result;
}
</lsl>

Latest revision as of 16:21, 1 April 2010