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

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

Recommended Posts

  • Replies 64
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

You are learning how to debug your own scripts.  It's part of the fun of being a scripter.  We all do it.  Every once in a while someone else can peek into your scripts and spot whatever is wrong with

else if (request_id == gHttpRequestId2) { if (status == 200 && llSubStringIndex(body, "<item>") != -1){ //do something } }  

There is a quotation mark missing in that line.  

Posted Images

You were almost there you just needed to copy some lines from your previous post:

 

 //This program is an example of how Xyzzytext can work!
//XyzzyChat - Local Chat to Text Board v1.0 by Traven Sachs
//Free to use as you wish!  (Credit would be nice... ;-> )

integer DISPLAY_STRING      = 204000;
integer DISPLAY_EXTENDED    = 204001;
integer REMAP_INDICES       = 204002;
integer RESET_INDICES       = 204003;
integer SET_FADE_OPTIONS    = 204004;
integer SET_FONT_TEXTURE    = 204005;
integer SET_LINE_COLOR      = 204006;
integer SET_COLOR           = 204007;
integer RESCAN_LINKSET      = 204008;

key gHttpRequestId1;
key gHttpRequestId2;
string gBuildText;

checkData()
{
    gBuildText = "";
    gHttpRequestId1 = llHTTPRequest("http://secondlife.com/xmlhttp/secondlife.php", [HTTP_BODY_MAXLENGTH, 4096], "");
}

string cutString(string theData, string theTag)
{
    integer cutStart = llSubStringIndex(theData, "<" + theTag + ">") + llStringLength("<" + theTag + ">");
    integer cutEnd = llSubStringIndex(theData, "</" + theTag + ">") - 1;
    return llGetSubString(theData, cutStart, cutEnd);
}

default
{

    state_entry ()
    {
        llSetTimerEvent(3600);
        checkData();
    }

    on_rez(integer sp)
    {
        llResetScript();
    }

    timer()
    {
        checkData();
    }

    touch_start(integer sp)
    {
        key targetAvatar = llDetectedKey(0);
        if (llGetAgentSize(targetAvatar) != ZERO_VECTOR)
        {
            llRegionSayTo(targetAvatar, 0, gBuildText);
        }
        else
        {
            llInstantMessage(targetAvatar, gBuildText);
        }
    }

    http_response(key request_id, integer status, list metadata, string body)
    {
        if (request_id == gHttpRequestId1)
        {
            gBuildText += "Updated: " + llGetTimestamp();
            if (status == 200 && llSubStringIndex(body, "<status>") != -1)
            {
                gBuildText += "\nGrid: " + cutString(body, "status");
                gBuildText += " | Inworld: " + cutString(body, "inworld");
                gBuildText += "\nSignups: " + 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 += "\n---\n" + cutString(commitData, "title");
                gBuildText += "\n" + cutString(commitData, "link");
                gBuildText += "\n" + cutString(commitData, "pubDate");
            }
            llSetText(gBuildText, <1,1,1>, 1);
        }
    

    }
} 

 

  • Like 2
Link to post
Share on other sites
1 hour ago, Sabrina Tamerlane said:

//This program is an example of how Xyzzytext can work! //XyzzyChat - Local Chat to Text Board v1.0 by Traven Sachs //Free to use as you wish! (Credit would be nice... ;-> ) integer DISPLAY_STRING = 204000; integer DISPLAY_EXTENDED = 204001; integer REMAP_INDICES = 204002; integer RESET_INDICES = 204003; integer SET_FADE_OPTIONS = 204004; integer SET_FONT_TEXTURE = 204005; integer SET_LINE_COLOR = 204006; integer SET_COLOR = 204007; integer RESCAN_LINKSET = 204008; key gHttpRequestId1; key gHttpRequestId2; string gBuildText; checkData() { gBuildText = ""; gHttpRequestId1 = llHTTPRequest("http://secondlife.com/xmlhttp/secondlife.php", [HTTP_BODY_MAXLENGTH, 4096], ""); } string cutString(string theData, string theTag) { integer cutStart = llSubStringIndex(theData, "<" + theTag + ">") + llStringLength("<" + theTag + ">"); integer cutEnd = llSubStringIndex(theData, "</" + theTag + ">") - 1; return llGetSubString(theData, cutStart, cutEnd); } default { state_entry () { llSetTimerEvent(3600); checkData(); } on_rez(integer sp) { llResetScript(); } timer() { checkData(); } touch_start(integer sp) { key targetAvatar = llDetectedKey(0); if (llGetAgentSize(targetAvatar) != ZERO_VECTOR) { llRegionSayTo(targetAvatar, 0, gBuildText); } else { llInstantMessage(targetAvatar, gBuildText); } } http_response(key request_id, integer status, list metadata, string body) { if (request_id == gHttpRequestId1) { gBuildText += "Updated: " + llGetTimestamp(); if (status == 200 && llSubStringIndex(body, "<status>") != -1) { gBuildText += "\nGrid: " + cutString(body, "status"); gBuildText += " | Inworld: " + cutString(body, "inworld"); gBuildText += "\nSignups: " + 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 += "\n---\n" + cutString(commitData, "title"); gBuildText += "\n" + cutString(commitData, "link"); gBuildText += "\n" + cutString(commitData, "pubDate"); } llSetText(gBuildText, <1,1,1>, 1); } } }

thankyou that did work but I dont want it to be read off the hover text I would like it to be read by the board

forum.png

Link to post
Share on other sites
47 minutes ago, Sabrina Tamerlane said:

For that you will need to add 2 scripts (master and slave) as explained here: http://wiki.secondlife.com/wiki/XyzzyText

And then you will use link messages to display the text as shown on the top of the page.

 

ETA: if you already have the board ready then you only need the link message.

 

that makes sense in my head but doing it on paper is a little hard lol this is the slave script also attached is the a photo of what scripts the board came with

 

////////////////////////////////////////////
// XyzzyText v2.1m (16-Char MESH) by Traven Sachs 29-November-2012
// XyzzyText v2.1(10-Char) by Thraxis Epsilon
// XyText v2.0 SLAVE Script (5 Face, Single Texture)
//
// Heavily Modified by Thraxis Epsilon, Gigs Taggart 5/2007 and Strife Onizuka 8/2007
// Rewrite to allow one-script-per-object operation w/ optional slaves
// Enable prim-label functionality
// Enabled Banking
// Enabled 10-char per prim
// Enabled 16-Char on an 8 Face Mesh Plane Prim
//
// Modified by Kermitt Quirk 19/01/2006
// To add support for 5 face prim instead of 3
//
// Originally Written by Xylor Baysklef
//
//
////////////////////////////////////////////


integer REMAP_INDICES       = 204002;
integer RESET_INDICES       = 204003;

//internal API
integer REGISTER_SLAVE      = 205000;
integer SLAVE_RECOGNIZED    = 205001;
integer SLAVE_DISPLAY       = 205003;
integer SET_FONT_TEXTURE    = 204005;

integer SLAVE_DISPLAY_EXTENDED = 205004;
integer SLAVE_RESET = 205005;

// This is an extended character escape sequence.
string  ESCAPE_SEQUENCE = "\\e";

// This is used to get an index for the extended character.
string  EXTENDED_INDEX  = "123456789abcdef";

// Face numbers.
integer FACE_1          = 0;
integer FACE_2          = 1;
integer FACE_3          = 2;
integer FACE_4          = 3;
integer FACE_5          = 4;
integer FACE_6          = 5;
integer FACE_7          = 6;
integer FACE_8          = 7;

// This is a list of textures for all 2-character combinations.
list    CHARACTER_GRID  = [
        "00e9f9f7-0669-181c-c192-7f8e67678c8d",
        "347a5cb6-0031-7ec0-2fcf-f298eebf3c0e",
        "4e7e689e-37f1-9eca-8596-a958bbd23963",
        "19ea9c21-67ba-8f6f-99db-573b1b877eb1",
        "dde7b412-cda1-652f-6fc2-73f4641f96e1",
        "af6fa3bb-3a6c-9c4f-4bf5-d1c126c830da",
        "a201d3a2-364b-43b6-8686-5881c0f82a94",
        "b674dec8-fead-99e5-c28d-2db8e4c51540",
        "366e05f3-be6b-e5cf-c33b-731dff649caa",
        "75c4925c-0427-dc0c-c71c-e28674ff4d27",
        "dcbe166b-6a97-efb2-fc8e-e5bc6a8b1be6",
        "0dca2feb-fc66-a762-db85-89026a4ecd68",
        "a0fca76f-503a-946b-9336-0a918e886f7a",
        "67fb375d-89a1-5a4f-8c7a-0cd1c066ffc4",
        "300470b2-da34-5470-074c-1b8464ca050c",
        "d1f8e91c-ce2b-d85e-2120-930d3b630946",
        "2a190e44-7b29-dadb-0bff-c31adaf5a170",
        "75d55e71-f6f8-9835-e746-a45f189f30a1",
        "300fac33-2b30-3da3-26bc-e2d70428ec19",
        "0747c776-011a-53ce-13ee-8b5bb9e87c1e",
        "85a855c3-a94f-01ca-33e0-7dde92e727e2",
        "cbc1dab2-2d61-2986-1949-7a5235c954e1",
        "f7aef047-f266-9596-16df-641010edd8e1",
        "4c34ebf7-e5e1-2e1a-579f-e224d9d5e71b",
        "4a69e98c-26a5-ad05-e92e-b5b906ad9ef9",
        "462a9226-2a97-91ac-2d89-57ab33334b78",
        "20b24b3a-8c57-82ee-c6ed-555003f5dbcd",
        "9b481daa-9ea8-a9fa-1ee4-ab9a0d38e217",
        "c231dbdc-c842-15b0-7aa6-6da14745cfdc",
        "c97e3cbb-c9a3-45df-a0ae-955c1f4bf9cf",
        "f1e7d030-ff80-a242-cb69-f6951d4eae3b",
        "ed32d6c4-d733-c0f1-f242-6df1d222220d",
        "88f96a30-dccf-9b20-31ef-da0dfeb23c72",
        "252f2595-58b8-4bcc-6515-fa274d0cfb65",
        "f2838c4f-de80-cced-dff8-195dfdf36b2c",
        "cc2594fe-add2-a3df-cdb3-a61711badf53",
        "e0ce2972-da00-955c-129e-3289b3676776",
        "3e0d336d-321f-ddfa-5c1b-e26131766f6a",
        "d43b1dc4-6b51-76a7-8b90-38865b82bf06",
        "06d16cbb-1868-fd1d-5c93-eae42164a37d",
        "dd5d98cf-273e-3fd0-f030-48be58ee3a0b",
        "0e47c89e-de4a-6233-a2da-cb852aad1b00",
        "fb9c4a55-0e13-495b-25c4-f0b459dc06de",
        "e3ce8def-312c-735b-0e48-018b6799c883",
        "2f713216-4e71-d123-03ed-9c8554710c6b",
        "4a417d8a-1f4f-404b-9783-6672f8527911",
        "ca5e21ec-5b20-5909-4c31-3f90d7316b33",
        "06a4fcc3-e1c4-296d-8817-01f88fbd7367",
        "130ac084-6f3c-95de-b5b6-d25c80703474",
        "59d540a0-ae9d-3606-5ae0-4f2842b64cfa",
        "8612ae9a-f53c-5bf4-2899-8174d7abc4fd",
        "12467401-e979-2c49-34e0-6ac761542797",
        "d53c3eaa-0404-3860-0675-3e375596c3e3",
        "9f5b26bd-81d3-b25e-62fe-5b671d1e3e79",
        "f57f0b64-a050-d617-ee00-c8e9e3adc9cb",
        "beff166a-f5f3-f05e-e020-98f2b00e27ed",
        "02278a65-94ba-6d5e-0d2b-93f2e4f4bf70",
        "a707197d-449e-5b58-846c-0c850c61f9d6",
        "021d4b1a-9503-a44f-ee2b-976eb5d80e68",
        "0ae2ffae-7265-524d-cb76-c2b691992706",
        "f6e41cf2-1104-bd0b-0190-dffad1bac813",
        "2b4bb15e-956d-56ae-69f5-d26a20de0ce7",
        "f816da2c-51f1-612a-2029-a542db7db882",
        "345fea05-c7be-465c-409f-9dcb3bd2aa07"];
list    CHARACTER_GRID2  = [         
        "b3017e02-c063-5185-acd5-1ef5f9d79b89",
        "4dcff365-1971-3c2b-d73c-77e1dc54242a"
          ];

///////////// END CONSTANTS ////////////////
string gCharIndex;

integer gActive; //if we are recognized, this is true
/////////// END GLOBAL VARIABLES ////////////
ResetCharIndex() {
    gCharIndex  = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`";
    // \" <-- Fixes LSL syntax highlighting bug.
    gCharIndex += "abcdefghijklmnopqrstuvwxyz{|}~";
    gCharIndex += "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
}

vector GetGridPos(integer index1, integer index2) {
    // There are two ways to use the lookup table...
    integer Col;
    integer Row;
    if (index1 >= index2) {
        // In this case, the row is the index of the first character:
        Row = index1;
        // And the col is the index of the second character (x2)
        Col = index2 * 2;
    }
    else { // Index1 < Index2
        // In this case, the row is the index of the second character:
        Row = index2;
        // And the col is the index of the first character, x2, offset by 1.
        Col = index1 * 2 + 1;
    }
    return <Col, Row, 0>;
}

string GetGridTexture(vector grid_pos) {
    // Calculate the texture in the grid to use.
    integer GridCol = llRound(grid_pos.x) / 20;
    integer GridRow = llRound(grid_pos.y) / 10;

    // Lookup the texture.
    key Texture = llList2Key(CHARACTER_GRID, GridRow * (GridRow + 1) / 2 + GridCol);
    return Texture;
}

vector GetGridOffset(vector grid_pos) {
    // Zoom in on the texture showing our character pair.
    integer Col = llRound(grid_pos.x) % 20;
    integer Row = llRound(grid_pos.y) % 10;

    // Return the offset in the texture.
    return <-0.45 + 0.05 * Col, 0.45 - 0.1 * Row, 0.0>;
}

ShowChars(integer link,vector grid_pos1, vector grid_pos2, vector grid_pos3, vector grid_pos4, vector grid_pos5, vector grid_pos6, vector grid_pos7, vector grid_pos8) {
   // Set the primitive textures directly.
     
               
   llSetLinkPrimitiveParamsFast( link , [
        PRIM_TEXTURE, FACE_1, GetGridTexture(grid_pos1), <0.1, 0.1, 0>, GetGridOffset(grid_pos1), 0.0,
        PRIM_TEXTURE, FACE_2, GetGridTexture(grid_pos2), <0.1, 0.1, 0>, GetGridOffset(grid_pos2), 0.0,
        PRIM_TEXTURE, FACE_3, GetGridTexture(grid_pos3), <0.1, 0.1, 0>, GetGridOffset(grid_pos3), 0.0,
        PRIM_TEXTURE, FACE_4, GetGridTexture(grid_pos4), <0.1, 0.1, 0>, GetGridOffset(grid_pos4), 0.0,
        PRIM_TEXTURE, FACE_5, GetGridTexture(grid_pos5), <0.1, 0.1, 0>, GetGridOffset(grid_pos5), 0.0,
        PRIM_TEXTURE, FACE_6, GetGridTexture(grid_pos6), <0.1, 0.1, 0>, GetGridOffset(grid_pos6), 0.0,
        PRIM_TEXTURE, FACE_7, GetGridTexture(grid_pos7), <0.1, 0.1, 0>, GetGridOffset(grid_pos7), 0.0,
        PRIM_TEXTURE, FACE_8, GetGridTexture(grid_pos8), <0.1, 0.1, 0>, GetGridOffset(grid_pos8), 0.0
        ]);
}

RenderString(integer link, string str) {
    // Get the grid positions for each pair of characters.
    vector GridPos1 = GetGridPos( llSubStringIndex(gCharIndex, llGetSubString(str, 0, 0)),
                                  llSubStringIndex(gCharIndex, llGetSubString(str, 1, 1)) );
    vector GridPos2 = GetGridPos( llSubStringIndex(gCharIndex, llGetSubString(str, 2, 2)),
                                  llSubStringIndex(gCharIndex, llGetSubString(str, 3, 3)) );
    vector GridPos3 = GetGridPos( llSubStringIndex(gCharIndex, llGetSubString(str, 4, 4)),
                                  llSubStringIndex(gCharIndex, llGetSubString(str, 5, 5)) );
    vector GridPos4 = GetGridPos( llSubStringIndex(gCharIndex, llGetSubString(str, 6, 6)),
                                  llSubStringIndex(gCharIndex, llGetSubString(str, 7, 7)) );
    vector GridPos5 = GetGridPos( llSubStringIndex(gCharIndex, llGetSubString(str, 8, 8)),
                                  llSubStringIndex(gCharIndex, llGetSubString(str, 9, 9)) );
    vector GridPos6 = GetGridPos( llSubStringIndex(gCharIndex, llGetSubString(str, 10, 10)),
                                  llSubStringIndex(gCharIndex, llGetSubString(str, 11, 11)) );
    vector GridPos7 = GetGridPos( llSubStringIndex(gCharIndex, llGetSubString(str, 12, 12)),
                                  llSubStringIndex(gCharIndex, llGetSubString(str, 13, 13)) );
    vector GridPos8 = GetGridPos( llSubStringIndex(gCharIndex, llGetSubString(str, 14, 14)),
                                  llSubStringIndex(gCharIndex, llGetSubString(str, 15, 15)) );                                   

    // Use these grid positions to display the correct textures/offsets.
    ShowChars(link,GridPos1, GridPos2, GridPos3, GridPos4, GridPos5, GridPos6, GridPos7, GridPos8);
}

RenderExtended(integer link, string str) {
    // Look for escape sequences.
    list Parsed       = llParseString2List(str, [], (list)ESCAPE_SEQUENCE);
    integer ParsedLen = llGetListLength(Parsed);

    // Create a list of index values to work with.
    list Indices;
    // We start with room for 16 indices.
    integer IndicesLeft = 16;

    string Token;
    integer Clipped;
    integer LastWasEscapeSequence = FALSE;
    // Work from left to right.
    integer i=0;
    for (; i < ParsedLen && IndicesLeft > 0; ++i) {
        Token = llList2String(Parsed, i);

        // If this is an escape sequence, just set the flag and move on.
        if (Token == ESCAPE_SEQUENCE) {
            LastWasEscapeSequence = TRUE;
        }
        else { // Token != ESCAPE_SEQUENCE
            // Otherwise this is a normal token.  Check its length.
            Clipped = FALSE;
            integer TokenLength = llStringLength(Token);
            // Clip if necessary.
            if (TokenLength > IndicesLeft) {
                TokenLength = llStringLength(Token = llGetSubString(Token, 0, IndicesLeft - 1));
                IndicesLeft = 0;
                Clipped = TRUE;
            }
            else
                IndicesLeft -= TokenLength;

            // Was the previous token an escape sequence?
            if (LastWasEscapeSequence) {
                // Yes, the first character is an escape character, the rest are normal.
                // This is the extended character.
                Indices += [llSubStringIndex(EXTENDED_INDEX, llGetSubString(Token, 0, 0)) + 95];
                
                // These are the normal characters.
                integer j=1;
                for (; j < TokenLength; ++j)
                {
                    Indices += [llSubStringIndex(gCharIndex, llGetSubString(Token, j, j))];
                }
            }
            else { // Normal string.
                // Just add the characters normally.
                integer j=0;
                for (; j < TokenLength; ++j)
                {
                    Indices += [llSubStringIndex(gCharIndex, llGetSubString(Token, j, j))];
                }
            }

            // Unset this flag, since this was not an escape sequence.
            LastWasEscapeSequence = FALSE;
        }
    }

    // Use the indices to create grid positions.
    vector GridPos1 = GetGridPos( llList2Integer(Indices, 0), llList2Integer(Indices, 1) );
    vector GridPos2 = GetGridPos( llList2Integer(Indices, 2), llList2Integer(Indices, 3) );
    vector GridPos3 = GetGridPos( llList2Integer(Indices, 4), llList2Integer(Indices, 5) );
    vector GridPos4 = GetGridPos( llList2Integer(Indices, 6), llList2Integer(Indices, 7) );
    vector GridPos5 = GetGridPos( llList2Integer(Indices, 8), llList2Integer(Indices, 9) );
    vector GridPos6 = GetGridPos( llList2Integer(Indices, 10), llList2Integer(Indices, 11) );
    vector GridPos7 = GetGridPos( llList2Integer(Indices, 12), llList2Integer(Indices, 13) );
    vector GridPos8 = GetGridPos( llList2Integer(Indices, 14), llList2Integer(Indices, 15) );
    
    // Use these grid positions to display the correct textures/offsets.
    ShowChars(link,GridPos1, GridPos2, GridPos3, GridPos4, GridPos5, GridPos6, GridPos7, GridPos8);
}

integer ConvertIndex(integer index) {
    // This converts from an ASCII based index to our indexing scheme.
    if (index >= 32) // ' ' or higher
        index -= 32;
    else { // index < 32
        // Quick bounds check.
        if (index > 15)
            index = 15;

        index += 94; // extended characters
    }

    return index;
}


default {
    state_entry()
    {
        // Initialize the character index.
        ResetCharIndex();
        llMessageLinked(LINK_THIS, REGISTER_SLAVE, llGetScriptName() , NULL_KEY);  
    }

   on_rez(integer num)
   {
      llResetScript();       
   }
   
    link_message(integer sender, integer channel, string data, key id) {
        if (channel == SLAVE_RECOGNIZED)
        {
            if (data == llGetScriptName())
            {
                gActive=TRUE;
            }
            return;
        }
    
        else if (channel == SLAVE_DISPLAY)
        {
            if (!gActive)  
                return;
                
            list params=llCSV2List((string)id);
            if (llList2String(params, 1) != llGetScriptName())
                return;
            
            
            RenderString(llList2Integer(params, 0),data);
            return;
        }
    
       else if (channel == SLAVE_DISPLAY_EXTENDED)
       {
            if (!gActive)  
                return;
                
            list params=llCSV2List((string)id);
            if (llList2String(params, 1) != llGetScriptName())
                return;
                
            RenderExtended(llList2Integer(params, 0),data);
    }
        else if (channel == REMAP_INDICES) {
            // Parse the message, splitting it up into index values.
            list Parsed = llCSV2List(data);
            integer i;
            // Go through the list and swap each pair of indices.
            for (i = 0; i < llGetListLength(Parsed); i += 2) {
                integer Index1 = ConvertIndex( llList2Integer(Parsed, i) );
                integer Index2 = ConvertIndex( llList2Integer(Parsed, i + 1) );

                // Swap these index values.
                string Value1 = llGetSubString(gCharIndex, Index1, Index1);
                string Value2 = llGetSubString(gCharIndex, Index2, Index2);

                gCharIndex = llDeleteSubString(gCharIndex, Index1, Index1);
                gCharIndex = llInsertString(gCharIndex, Index1, Value2);

                gCharIndex = llDeleteSubString(gCharIndex, Index2, Index2);
                gCharIndex = llInsertString(gCharIndex, Index2, Value1);
            }
            return;
        }
        else if (channel == RESET_INDICES) {
            // Restore the character index back to default settings.
            ResetCharIndex();
            return;
        }                 
       else if (channel == SLAVE_RESET)
        {
            ResetCharIndex();
            gActive=FALSE;
            llMessageLinked(LINK_THIS, REGISTER_SLAVE, llGetScriptName() , NULL_KEY);
        }
    }    
}

 

 

 

forum.png

Link to post
Share on other sites
30 minutes ago, Sabrina Tamerlane said:

Okay, then under:


llSetText(gBuildText, <1,1,1>, 1);

add this line:


llMessageLinked(LINK_THIS,DISPLAY_STRING, gBuildText,"0");

in the master or slave scriptI looked thought slave script and could not find it

 

Link to post
Share on other sites
1 hour ago, Sabrina Tamerlane said:

Don't edit those master and slave scripts, just make sure you have them. Do that in your own script.

ok that is done now getting this error

forum.png

Link to post
Share on other sites
Posted (edited)
1 hour ago, Sabrina Tamerlane said:

Why would you add a closing brace at the end of the line?

that was an error even without the closing line i still get the error

forum.png

Edited by meady212
forgot to add a picture
Link to post
Share on other sites

Oh, that was the closing brace from the next line! You need that one. I suggest you do it again. Take back the script that was working and add the line again. Because the error displayed says (75, 132) where 75 is the line number of the error, and 132 is the column number. So, there must be some garbage after that brace. I didn't think much of it when you have shown that error but now I realize that it was not caused by the brace, but by something else after it. You could double click on the error to see what it was but the simplest is to restart from where it was working and add the line another time.

Edited by Sabrina Tamerlane
typo
Link to post
Share on other sites
1 hour ago, Sabrina Tamerlane said:

Oh, that was the closing brace from the next line! You need that one. I suggest you do it again. Take back the script that was working and add the line again. Because the error displayed says (75, 132) where 75 is the line number of the error, and 132 is the column number. So, there must be some garbage after that brace. I didn't think much of it when you have shown that error but now I realize that it was not caused by the brace, but by something else after it. You could double click on the error to see what it was but the simplest is to restart from where it was working and add the line another time.

now it says name define within scope I take it i need to enter link this display string and what do I link it too?

Link to post
Share on other sites
20 minutes ago, Sabrina Tamerlane said:

DISPLAY_NAME is defined at the top of your file, it should be ok. Maybe someone else can figure what is going wrong?

thankyou so much for helping me

Link to post
Share on other sites

You are learning how to debug your own scripts.  It's part of the fun of being a scripter.  We all do it.  Every once in a while someone else can peek into your scripts and spot whatever is wrong with it, but that's a long shot.  Nobody knows your scripts better than you do.  Nobody else has followed the logic that you wove together as you created them.  No matter how frustrated you may feel, you are the best person to fix your own script errors.  Here are some things that can help:

1. Make a habit of adding comment statements that will remind you what key variables do or how a loop is meant to function.

2. Develop a system for labeling variables so that you know what type they are (integer, float, vector, string ...) and whether they are defined globally or locally.

3. Develop a healthy OCD about the picky little things (matching brackets, closing lines with a semicolon, ...) that commonly keep a script from compiling.

4. Know exactly how each scope (each state, event, and block of code within them) is defined. Know which brackets open and close them and which variables are defined in them. 

5. Be very careful about reusing variable names in different parts of the script.

6. Write scripts incrementally, testing individual parts as you add them, so that you can build upon success as you go. Don't change several things at once.

7. Be very careful about counters ... variable that keep track of which list element you are using at the moment or how many times you have run around a loop.  Be sure that you reset them properly and that they don't get reset accidentally in other parts of the script.

8. Insert llOwnerSay statements or other diagnostic messages to tell you exactly what's happening as your script executes.

9. Keep a file of "tricks" that have worked for you in previous scripts, so that you don't have to reinvent them each time.

10. Keep copies of your work as you go along, and assign version numbers to them so that you can step back in inventory to pull out a previous version and start over when necessary.

11. Take a deep breath from time to time.  Walk around the block. Play with the dog.  Come back to look at your script with fresh eyes.

12. Create your own checklist of things that you typically do wrong.  We all make our own unique mistakes.  (Mine is improper typecasting. ;) )

  • Like 4
Link to post
Share on other sites

ok I was able to fix my problem I messed up the script somehow now it works but the problem is the board is not showing the full text only the end of the text is there a type of script that will fix this?

forum.png

  • Like 1
Link to post
Share on other sites

Oh, I knew that problem would arise but I didn't tell you because that would have been too much to handle.

llMessageLinked(LINK_THIS,DISPLAY_STRING, gBuildText,"0");

This prints the text on the first line of the board. If you wanted to print on the second life then you need to replace the "0" with a "1", because lines are numbered "0", "1", "2" and so on...

So you have got some homework to do before it works.

One way is to find how many characters are actually printed on the first line. You can do that manually by counting them or by looking at the documentation or the source code.

Once you know how long is a line then you need to split your string in shorter strings so that it would fit on the board.

But there is a simpler way, by using this function: http://wiki.secondlife.com/wiki/LlParseString2List

It should be a good idea to use "\n" as separator.

Once you have your list then you just need to loop over it and print each line on the board.

So, first things first, you should use llParseString2List()

Then you will need to count how many elements are in the list.

And third you will need to use a for loop to display each element in the list line by line

 

 

Edited by Sabrina Tamerlane
added two steps
  • Like 2
Link to post
Share on other sites
4 hours ago, Sabrina Tamerlane said:

Oh, I knew that problem would arise but I didn't tell you because that would have been too much to handle.


llMessageLinked(LINK_THIS,DISPLAY_STRING, gBuildText,"0");

This prints the text on the first line of the board. If you wanted to print on the second life then you need to replace the "0" with a "1", because lines are numbered "0", "1", "2" and so on...

So you have got some homework to do before it works.

One way is to find how many characters are actually printed on the first line. You can do that manually by counting them or by looking at the documentation or the source code.

Once you know how long is a line then you need to split your string in shorter strings so that it would fit on the board.

But there is a simpler way, by using this function: http://wiki.secondlife.com/wiki/LlParseString2List

It should be a good idea to use "\n" as separator.

Once you have your list then you just need to loop over it and print each line on the board.

So, first things first, you should use llParseString2List()

Then you will need to count how many elements are in the list.

And third you will need to use a for loop to display each element in the list line by line

 

 

thjanks for helping me so much I donno what I would do :)

Link to post
Share on other sites

You are almost there but it's not finished. Replace this line:

            llMessageLinked(LINK_THIS,DISPLAY_STRING, gBuildText,"0");

with these 2 lines:

            list lines = llParseString2List(gBuildText, ["\n"], []) ;
            llMessageLinked(LINK_THIS,DISPLAY_STRING, llList2String(lines, 0),"0");

As you can see we use llParseString2List to break the text in multiple lines. This should display the first line.

  • Like 3
Link to post
Share on other sites
2 hours ago, Sabrina Tamerlane said:

You are almost there but it's not finished. Replace this line:


            llMessageLinked(LINK_THIS,DISPLAY_STRING, gBuildText,"0");

with these 2 lines:


            list lines = llParseString2List(gBuildText, ["\n"], []) ;
            llMessageLinked(LINK_THIS,DISPLAY_STRING, llList2String(lines, 0),"0");

As you can see we use llParseString2List to break the text in multiple lines. This should display the first line.

i know I am using this forum alot but this just looks strange I hate asking a stupid qestions but its the only way for me to learn I really wish that there was a scripting class in second life I am not sure why this bracket is showing an error

forum.png

Link to post
Share on other sites
1 hour ago, Sabrina Tamerlane said:

You should check that you have as many opening brackets  '{' than closing ones '}'.

do you mean something like this or am i doing it wrong?

forum.png

Link to post
Share on other sites

When it was working, your script was finishing like this:

 

        else if (request_id == gHttpRequestId2)
        {
            if (status == 200 && llSubStringIndex(body, "<item>") != -1)
            {
                string commitData = cutString(body, "item");
                gBuildText += "\n---\n" + cutString(commitData, "title");
                gBuildText += "\n" + cutString(commitData, "link");
                gBuildText += "\n" + cutString(commitData, "pubDate");
            }
            llSetText(gBuildText, <1,1,1>, 1);
        }
    

    }
} 

At the end you had 3 '}'. Where are they now?

When you write a script you put lines into blocks. A line is ended by ';' and a block begins with '{' and finishes with '}'. If the compiler complains, it is because it can neither recognize a line or a block. The 3 '}' at the end mean that 3 blocks are finishing. One of them comes is the else block, one other is the http_response block and the last one is the state default. When a block starts it begins with a '{' and finishes with a '}'.

Link to post
Share on other sites
Posted (edited)
42 minutes ago, Sabrina Tamerlane said:

When it was working, your script was finishing like this:

 


        else if (request_id == gHttpRequestId2)
        {
            if (status == 200 && llSubStringIndex(body, "<item>") != -1)
            {
                string commitData = cutString(body, "item");
                gBuildText += "\n---\n" + cutString(commitData, "title");
                gBuildText += "\n" + cutString(commitData, "link");
                gBuildText += "\n" + cutString(commitData, "pubDate");
            }
            llSetText(gBuildText, <1,1,1>, 1);
        }
    

    }
} 

At the end you had 3 '}'. Where are they now?

When you write a script you put lines into blocks. A line is ended by ';' and a block begins with '{' and finishes with '}'. If the compiler complains, it is because it can neither recognize a line or a block. The 3 '}' at the end mean that 3 blocks are finishing. One of them comes is the else block, one other is the http_response block and the last one is the state default. When a block starts it begins with a '{' and finishes with a '}'.

I got that correct but now nothing comes up on the board when i clicked save that is what happened

 

forum.png

Edited by meady212
Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 124 days.

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...