Leo Cloud Posted June 17, 2020 Share Posted June 17, 2020 can anyone help me with a HTTP request to take information from a website to display the grid status into a prim? Link to comment Share on other sites More sharing options...
Rolig Loon Posted June 17, 2020 Share Posted June 17, 2020 The URL for the grid status page is https://status.secondlifegrid.net/ . To display any URL on a prim, 1 Link to comment Share on other sites More sharing options...
Leo Cloud Posted June 17, 2020 Author Share Posted June 17, 2020 34 minutes ago, Rolig Loon said: The URL for the grid status page is https://status.secondlifegrid.net/ . To display any URL on a prim, this does not work what so ever Link to comment Share on other sites More sharing options...
Leo Cloud Posted June 17, 2020 Author Share Posted June 17, 2020 not sure how it is going to display the grid status Link to comment Share on other sites More sharing options...
Nova Convair Posted June 17, 2020 Share Posted June 17, 2020 What do you use to display a web-url? A Browser. llSetText is no browser. Shared media is a browser and Rolig already posted a link about that. You probably want to look at this, maybe you find something for you: http://wiki.secondlife.com/wiki/World_API Link to comment Share on other sites More sharing options...
Wulfie Reanimator Posted June 17, 2020 Share Posted June 17, 2020 (edited) To answer the question directly, you need to parse the contents of body down to the parts you want. You may need a bigger HTTP_BODY_MAXLENGTH. To actually do that, you should first inspect what the exact response is. (Manually, so you know what to expect.) From there, you need llGetSubString and llSubStringIndex to find what exactly to use from the response. Edited June 17, 2020 by Wulfie Reanimator 1 Link to comment Share on other sites More sharing options...
Leo Cloud Posted June 17, 2020 Author Share Posted June 17, 2020 1 hour ago, Wulfie Reanimator said: To answer the question directly, you need to parse the contents of body down to the parts you want. You may need a bigger HTTP_BODY_MAXLENGTH. To actually do that, you should first inspect what the exact response is. (Manually, so you know what to expect.) From there, you need llGetSubString and llSubStringIndex to find what exactly to use from the response. 2 hours ago, Nova Convair said: What do you use to display a web-url? A Browser. llSetText is no browser. Shared media is a browser and Rolig already posted a link about that. You probably want to look at this, maybe you find something for you: http://wiki.secondlife.com/wiki/World_API Hi guys thanks for the reply what I want to do is create a prim that I can put a grid status info into via a script and it shows up as a digital clock and it gives me information with the grid status every hour is there a type of script that I need to do this i may need help with creating the script hopeless at a script making Link to comment Share on other sites More sharing options...
Rolig Loon Posted June 17, 2020 Share Posted June 17, 2020 I think you may be imagining something very different from what you described in your OP. Grid Status is a report created by Linden Lab and displayed at the URL I provided above. If you want to display that web page on the face of a prim, use Shared Media. I also gave you a link to the Knowledge Base article that tells you how to do that. You don't need any special LSL script at all. I have no idea why you are trying to extract information from the Grid Status Report and put it into hover text, but I am beginning to suspect that you are not really asking about Grid Status at all. Perhaps you simply want to know whether a specific region is on line at the moment? If so, you can use llRequestSimulatorData. There's a very simple example at http://wiki.secondlife.com/wiki/LlRequestSimulatorData#Examples that you can modify to look for DATA_SIM_STATUS instead of DATA_SIM_RATING. Just request the information with a timer-triggered call to the function and display the output in hover text if that's what you are after. Link to comment Share on other sites More sharing options...
Xiija Posted June 17, 2020 Share Posted June 17, 2020 If it is for the Grid status, you can also look at RSS feeds or mebbe use the twitter api? https://twitter.com/SLGridStatus Link to comment Share on other sites More sharing options...
panterapolnocy Posted June 17, 2020 Share Posted June 17, 2020 (edited) If by "grid status" you understand users online and for example last report posted on https://status.secondlifegrid.net/ then this thingy may help you to get started with your "digital clock" project. That is also a crude example of parsing contents of the response body @Wulfie Reanimator was talking about few messages above. 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); } } } Edited June 17, 2020 by panterapolnocy 2 Link to comment Share on other sites More sharing options...
Leo Cloud Posted June 18, 2020 Author Share Posted June 18, 2020 (edited) 19 hours ago, panterapolnocy said: If by "grid status" you understand users online and for example last report posted on https://status.secondlifegrid.net/ then this thingy may help you to get started with your "digital clock" project. That is also a crude example of parsing contents of the response body @Wulfie Reanimator was talking about few messages above. 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); } } } this is what I am after but I would like it on the prim like this is this possible? I do like how you added the signups as well as the how many users are inworld as well Edited June 18, 2020 by meady212 Link to comment Share on other sites More sharing options...
Xiija Posted June 18, 2020 Share Posted June 18, 2020 you can display text with an Xyzzy text board.. they are 1 $L .... https://marketplace.secondlife.com/p/Mesh-Xyzzytext-Display-Board-960-Char-96-x-10/4244711 1 Link to comment Share on other sites More sharing options...
Leo Cloud Posted June 18, 2020 Author Share Posted June 18, 2020 58 minutes ago, Xiija said: you can display text with an Xyzzy text board.. they are 1 $L .... https://marketplace.secondlife.com/p/Mesh-Xyzzytext-Display-Board-960-Char-96-x-10/4244711 thankyou that makes it easy now looking for a new script to make it all work Link to comment Share on other sites More sharing options...
Leo Cloud Posted June 21, 2020 Author Share Posted June 21, 2020 hey guys just an update i have been at this for hours and i keep getting an error when entering the text into the Xyzzy text board (81,4) error:syntax error I am trying to finish off the script with no luck can someone please look over this for me and finish this off thank you in short I am trying to close the script bellow is the script //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) } } Link to comment Share on other sites More sharing options...
Rolig Loon Posted June 21, 2020 Share Posted June 21, 2020 (edited) You're missing a curly bracket to close your last else if test (plus whatever that test was meant to trigger). Add them and things should work. BTW, I know that Xyzzy text has been around for a long time in various versions, but I think you'll probably find Furware Text easier to use. Edited June 21, 2020 by Rolig Loon Cleaner wording Link to comment Share on other sites More sharing options...
Leo Cloud Posted June 22, 2020 Author Share Posted June 22, 2020 9 hours ago, Rolig Loon said: You're missing a curly bracket to close your last else if test (plus whatever that test was meant to trigger). Add them and things should work. BTW, I know that Xyzzy text has been around for a long time in various versions, but I think you'll probably find Furware Text easier to use. thanks again for the reply from where do I put the curly bracket when i do this i get another error Link to comment Share on other sites More sharing options...
Rolig Loon Posted June 22, 2020 Share Posted June 22, 2020 Take a good look at the code you posted. 19 hours ago, meady212 said: else if (request_id == gHttpRequestId2) { if (status == 200 && llSubStringIndex(body, "<item>") != -1) There's nothing following that second if test and the first one opens with a curly bracket that is never closed. You obviously meant to finish writing the code, but never did. Nearly everyone I know forgets to match brackets or parentheses occasionally. It's a pretty common mistake. That's where an editor like Sublime Text, which highlights matching brackets for you, can help. It won't help you with missing a whole block of code, though. Link to comment Share on other sites More sharing options...
Leo Cloud Posted June 22, 2020 Author Share Posted June 22, 2020 1 hour ago, Rolig Loon said: Take a good look at the code you posted. There's nothing following that second if test and the first one opens with a curly bracket that is never closed. You obviously meant to finish writing the code, but never did. Nearly everyone I know forgets to match brackets or parentheses occasionally. It's a pretty common mistake. That's where an editor like Sublime Text, which highlights matching brackets for you, can help. It won't help you with missing a whole block of code, though. that is fixed but now I get an error with this code gBuildText += \nGrid: " + cutString(body,"status") I dont see anything wrong with this line do you? Link to comment Share on other sites More sharing options...
Moles Dyna Mole Posted June 22, 2020 Moles Share Posted June 22, 2020 (edited) There is a quotation mark missing in that line. Edited June 22, 2020 by Dyna Mole 3 Link to comment Share on other sites More sharing options...
Rolig Loon Posted June 22, 2020 Share Posted June 22, 2020 (edited) Look for a missing quotation mark..... 😏 Edit: What she said ^^ Edited June 22, 2020 by Rolig Loon Link to comment Share on other sites More sharing options...
Sabrina Tamerlane Posted June 22, 2020 Share Posted June 22, 2020 Make sure that you have well closed the if block as Rolig said. If you are in doubt check if you have the same number of '{' and '}'. Link to comment Share on other sites More sharing options...
Leo Cloud Posted June 22, 2020 Author Share Posted June 22, 2020 I added the quotation mark and I am getting the same error 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) } } Link to comment Share on other sites More sharing options...
Rolig Loon Posted June 22, 2020 Share Posted June 22, 2020 Frustrating, isn't it? Chasing brackets and parentheses and quotation marks is like playing Whack-A-Mole. Yours keep moving around, so now you have them where they don't belong and you're missing them where they do. 1 Link to comment Share on other sites More sharing options...
Innula Zenovka Posted June 22, 2020 Share Posted June 22, 2020 else if (request_id == gHttpRequestId2) { if (status == 200 && llSubStringIndex(body, "<item>") != -1){ //do something } } 3 Link to comment Share on other sites More sharing options...
Sabrina Tamerlane Posted June 22, 2020 Share Posted June 22, 2020 You have the solution in your own posts, because you forgot to copy part of the code you had. Link to comment Share on other sites More sharing options...
Recommended Posts
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