Grid Status Script for Inworldz.com

A place to exchange knowledge and air views on scripting (LSL, VRML, 3D Javascript, etc), programming, and related topics. Not strictly limited to SL.

Grid Status Script for Inworldz.com

Postby Excalibur Steamlander » Thu Sep 04, 2014 8:11 am

After years of loading the servers here to provide in-world grid status info (the number of avatars in world), I finally buckled down and wrote an LSL script version. In the process I'm breaking it into a SecondLife® and an Inworldz™ version. This is the IW version. Place the following script in an object to see the current grid status in hovertext:

Code: Select all
// Inworldz.com Grid Status
// by Excalibur Steamlander

// Copyright (c) 2014 Steampunk Island Inc.
// Free to use courtesy of steamlands.com

key request;
integer offset1;
integer offset2;

mystartup()
{
   vector objectPosition = llGetPos();
       
   request = llHTTPRequest("http://inworldz.com/loginscreen.php",
            [HTTP_METHOD,"GET", HTTP_BODY_MAXLENGTH, "8096"], "");
           
}

default
{
   
     on_rez(integer whatever)
    {
        mystartup();
    }
   
    state_entry()
    {
        mystartup();
    }
   
    timer()
    {
        vector objectPosition = llGetPos();
       
        request = llHTTPRequest("http://inworldz.com/loginscreen.php",
            [HTTP_METHOD,"GET", HTTP_BODY_MAXLENGTH, "8096"], "");
    }

    http_response(key request_id, integer status, list metadata, string body)
    {
        if (request_id == request)
        {
            if ((offset1 = llSubStringIndex(body, "<b>Users Online:")) > 0)
            {
                offset1 += 49;
                body = llDeleteSubString(body, 0, offset1);
                offset2 = llSubStringIndex(body, "</div>");
                body = llGetSubString(body, 0, offset2-1);
            }
           
            llSetText("Inworldz.com Grid Status\n \nCurrent Users: " +
                body +
                "\n \n(courtesy of steamlands.com)\n \n", <0.0, 1.0, 0.0>, 1.0);
           
            llSetTimerEvent(180);
        }

   }
   
}
Your servant,

Excalibur Steamlander/Publisher
(Excalibur Longstaff in SL) http://facebook.ExcaliburSteamlander.com
User Portrait
Excalibur Steamlander
The Publisher
 
Posts: 1726
Joined: Wed Jan 17, 2007 12:26 pm
 
Citizen of: Steampunk Island (League of Avatars™)
Home Map:

Location In-world: Steamlander Castle on Steampunk Island, and Caledon SouthEnd in SL
 
Twitter: steamlander

Return to Scripting Wizardry



Who is currently on Steamlander™

Users browsing this forum: No registered users and 1 guest

cron