Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Website Online Script (Please help)

Jacob Shaftoe
Registered User
Join date: 20 Apr 2005
Posts: 22
09-01-2006 11:53
I don't get how this is possible or maybe I'm just going about it wrong. I'm writing a Site is Online / Offline script that checks for a value on my server and if it can't find it, it displays that the site is offline.
CODE

default
{
state_entry()
{
llHTTPRequest("http://70.36.118.166:8080/sl/status.php", [HTTP_METHOD, "GET"], "");
llSetTimerEvent(10);
}
http_response(key a, integer b, list c, string d)
{
string pre = "Site is is ";
if(d == "1") {
llSetText(pre + "Online",<255,0,0>,1.0);
} else {
llSetText(pre + "Offline",<255,0,0>,1.0);
}
}

timer()
{
// Somehow recheck every 10 seconds
}
}

Anyways, it runs the first time thru but I can't figure out how to get the timer to work with it here. Also, how do you do multiple http requests if you have to use http_response? I don't get that either. Somebody please explain how I can get this script to function...
Harris Hare
Second Life Resident
Join date: 5 Nov 2004
Posts: 301
09-01-2006 12:52
Using a timer is the correct way to do it. Just copy the llHTTPRequst to the timer event also.

CODE

timer()
{
llHTTPRequest("http://70.36.118.166:8080/sl/status.php", [HTTP_METHOD, "GET"], "");
}
Jacob Shaftoe
Registered User
Join date: 20 Apr 2005
Posts: 22
09-02-2006 02:15
From: Harris Hare
Using a timer is the correct way to do it. Just copy the llHTTPRequst to the timer event also.

CODE

timer()
{
llHTTPRequest("http://70.36.118.166:8080/sl/status.php", [HTTP_METHOD, "GET"], "");
}

Awesome... :) Thank you...