Jump to content
You are about to reply to a thread that has been inactive for 1395 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

1 hour ago, Sabrina Tamerlane said:

Your script is not running. Check the Running and Mono boxes.

with now playing with the script I now have this but I have three qestions for you

am I able to enter the text down and center it?

and at the top of updated I wanted to have text that would say second life grid status? what is the script for this?

just after the 06- 24T13:40:11.126192Z am i able to remove this?

I am slow but surely understanding scripting :D

forum.png

  • Like 1
Link to comment
Share on other sites

Okay, have you figured out how long is a line on the board? And how many lines do you have? You will need to know this if you want to center that text.

For the rest you can decide what is going on each line with a simple function. Since you already have a list you can choose to either modify it or you can just use it when you need it.

The first step is to create a function displayBoard() at the top of your file, before the default state.

So you will have to change your code like that:

            list lines = llParseString2List(gBuildText, ["\n"], []) ;
            displayBoard(lines) ;

You can use this function as a starter:

displayBoard(list l)
{
    llMessageLinked(LINK_THIS,DISPLAY_STRING, "Let's display that board", "0");
}

You can also move the code you had to display the lines in the displayBoard function or start from scratch, it does not matter.

Edited by Sabrina Tamerlane
added code
Link to comment
Share on other sites

your board prolly has 6 .... 8-faced prims per line (96 chars of text per line)

you could check each line length, subtract that from 96 and divide that in half to get how

many spaces to pad each line with. .. or just add padding spaces manually in your text.

for your http & time stuff, it would prolly be something close to this?

 

 http_response(key request_id, integer status, list metadata, string body)
    {
        if (request_id == gHttpRequestId1)        
        {   list my_list =   llParseString2List( llGetTimestamp(), [ "T", "."], [] );
            string date = llList2String(my_list,0);
            string time = llList2String(my_list,1);
            
            gBuildText += "Second Life Grid Status";
            gBuildText += " ";
            gBuildText += "Updated: " + date + ", " + time;
            if (status == 200 && llSubStringIndex(body, "<status>") != -1)
            {
                gBuildText += "Grid: " + cutString(body, "status");
                gBuildText += "Inworld: " + cutString(body, "inworld");
                gBuildText += "Signups: " + cutString(body, "signups");
                gBuildText += "Logged in past 60 days: " + cutString(body, "logged_in_last_60");
            }
            gHttpRequestId2 = llHTTPRequest("http://status.secondlifegrid.net/history.rss", [HTTP_BODY_MAXLENGTH, 4096], "");
        }
        else if (request_id == gHttpRequestId2)
        {
            if (status == 200 && llSubStringIndex(body, "<item>") != -1)
            {
                string commitData = cutString(body, "item");
                gBuildText +=  cutString(commitData, "title");
                gBuildText +=  cutString(commitData, "link");
                gBuildText +=  cutString(commitData, "pubDate");
            }
           display();
        }
    } // end http

in this example, gBuildText is a list, not a string, (  list gBuildText = []; ) and the display function i used is something like this...

display()
{   integer x = 0;
    do
    { llMessageLinked(-1,DISPLAY_STRING, llList2String( gBuildText ,x),(string)x );
        x = x + 1;
    } while (x < 10);   
}

 

Edited by Xiija
  • Like 2
Link to comment
Share on other sites

not sure how to mark a spoiler, but here is the centering bit for adding spaces...

Quote

string pad(string txt)
{  string pdn;
   integer len = llStringLength( txt );
   integer paddn = (96 - len)/2;
    integer x = 0;
    do
    { pdn += " ";
        ++x;
    } while (x < paddn); 
    return pdn + txt;  
}

 

then you could just do ...

  string title = pad("Second Life Grid Status");

to center that text?

Edited by Xiija
  • Like 3
Link to comment
Share on other sites

9 minutes ago, Xiija said:

not sure how to mark a spoiler, but here is the centering bit for adding spaces...

then you could just do ...

  string title = pad("Second Life Grid Status");

to center that text?

I would like to center everything in the middle and move the date up under the word of scheduled server maintenance the loading..... at the end of logged in past 60 days am i able to get rid of that I did change it from 60 to 30 days

 

Link to comment
Share on other sites

7 minutes ago, Sabrina Tamerlane said:

You can do that with this function: http://wiki.secondlife.com/wiki/LlListInsertList

Do I just copy this code here into my script or?

list numbers = [3, "three", 2, "two", 1, "one"];
default
{
    state_entry()
    {
        llOwnerSay(llDumpList2String(numbers, ","));
        // Object: 3,three,2,two,1,one
        integer index = llListFindList(numbers, [2]);
        if (index != -1)
        {
            numbers = llListInsertList(numbers, [2.5, "two and a half"], index);
            llOwnerSay(llDumpList2String(numbers, ","));
            // Object: 3,three,2.500000,two and a half,2,two,1,one
        }
    }
}
Edited by meady212
Link to comment
Share on other sites

if you are using the pad function i showed, you can pad each line by ... using it?

 gBuildText += pad(   "Grid: " + cutString(body, "status")    );
 gBuildText +=  pad(  "Inworld: " + cutString(body, "inworld")     );

 

to move something up, just change the order it is added to the list...

so from


 gBuildText +=  cutString(commitData, "title");
gBuildText +=  cutString(commitData, "link");
gBuildText +=  cutString(commitData, "pubDate");

 

change to

 gBuildText +=  cutString(commitData, "title");
gBuildText +=  cutString(commitData, "pubDate"); // this was moved up
 gBuildText +=  cutString(commitData, "link");

 

to remove something, just don't add it in...

delete the  ...  gBuildText += ... line you don't want.

 

hope this helps

27e4c6237cb007fe256e725488b5ea0a.png

 

Edited by Xiija
  • Like 2
Link to comment
Share on other sites

You don't need to do that it is much simpler. First you need to create that function displayBoard and use the code provided by Xiija.

 

displayBoard(list l)
{
  integer x = 0;
    do
    { llMessageLinked(-1,DISPLAY_STRING, llList2String( l ,x),(string)x );
        x = x + 1;
    } while (x < 10); 
}

However that will cause 3 problems. The first is that you don't have 10 lines in that list. The second is that it won't be centered. And the third is that your title is missing.

So, you need to modify the function to solve the 3 problems. To add your header you will use llListInsertList() and to center your text you will use Xiija's pad function.

To solve the last issue you will need to find the size of the list with llGetListLength().

So, to add the title you need to do this:

displayBoard(list l)
{
  integer x = 0;
  l = llListInsertList(l, pad("Second Life Status"), 0); 
  integer listSize = llGetListLength(l) ;

    do
    { 
       if (x<listSize)
       {                
            llMessageLinked(-1,DISPLAY_STRING, pad(llList2String( l ,x)),(string)x );
       }
       else {
            llMessageLinked(-1,DISPLAY_STRING, "",(string)x );
       }
        x = x + 1;
    } while (x < 10); 
}

 

 

Link to comment
Share on other sites

Building on the unsolicited advice that I posted yesterday...

13. If you use a script that someone else wrote, dissect it and study it very carefully until you understand how it works. Perhaps add your own comment statements as you figure out what the scripter is doing.  This is for self-protection as much as for building your skill set.  Other scripters can make mistakes or have blind spots too, so you should be alert to avoid accepting their work blindly. Who knows?  You might actually improve on it. ;)

  • Like 1
Link to comment
Share on other sites

18 hours ago, Xiija said:

if you are using the pad function i showed, you can pad each line by ... using it?

 gBuildText += pad(   "Grid: " + cutString(body, "status")    );
 gBuildText +=  pad(  "Inworld: " + cutString(body, "inworld")     );

 

to move something up, just change the order it is added to the list...

so from


 gBuildText +=  cutString(commitData, "title");
gBuildText +=  cutString(commitData, "link");
gBuildText +=  cutString(commitData, "pubDate");

 

change to

 gBuildText +=  cutString(commitData, "title");
gBuildText +=  cutString(commitData, "pubDate"); // this was moved up
 gBuildText +=  cutString(commitData, "link");

 

to remove something, just don't add it in...

delete the  ...  gBuildText += ... line you don't want.

 

hope this helps

27e4c6237cb007fe256e725488b5ea0a.png

 

yes this helped alot but when I remove a line this is what happened is there something I am missing?

forum.png

Edited by meady212
Link to comment
Share on other sites

Well, if you want to remove a line, you need to actually remove a line. Whole line. Along with the gBuildText += and not only the text after it. Currently you're trying to add new data AND old data to the old data (gBuildText += gBuildText += new), where you should only be adding new data to the old data (gBuildText += new).

Edited by panterapolnocy
Link to comment
Share on other sites

@meady212 here is what the code looks like for the pic i posted ...

 http_response(key request_id, integer status, list metadata, string body)
    {
        if (request_id == gHttpRequestId1)        
        {   list my_list =   llParseString2List( llGetTimestamp(), [ "T", "."], [] );
            string date = llList2String(my_list,0);
            string time = llList2String(my_list,1);
            
            string title = pad("Second Life Grid Status");
            gBuildText += title;
            gBuildText += " "; // add a space under the title
            gBuildText += pad( "Updated: " + date + ", " + time );
            if (status == 200 && llSubStringIndex(body, "<status>") != -1)
            {
                gBuildText += pad( "Grid: " + cutString(body, "status") );
                gBuildText += pad( "Inworld: " + cutString(body, "inworld") );
                gBuildText += pad( "Signups: " + cutString(body, "signups") );
                gBuildText += ""; // add a space under the signups
                //  gBuildText += pad( "Logged in past 60 days: " + cutString(body, "logged_in_last_60") );
            }
            gHttpRequestId2 = llHTTPRequest("http://status.secondlifegrid.net/history.rss", [HTTP_BODY_MAXLENGTH, 4096], "");
        }
        else if (request_id == gHttpRequestId2)
        {
            if (status == 200 && llSubStringIndex(body, "<item>") != -1)
            {
                string commitData = cutString(body, "item");
                gBuildText +=  pad( cutString(commitData, "title") );               
                gBuildText += pad( cutString(commitData, "pubDate") );
            }
           display();
        }
    } // end http

 

Edited by Xiija
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1395 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...