Essentially you want to use llHTTPRequest within Second Life to read something from a web server.
The most elegant solution would be to create a web interface with PHP and MySQL. A nice script is here: https://github.com/jgpippin/sldb
Even simpler option without any database:
- Create a text file called color.txt with just one line like green
- Upload text file to your server using FTP, I recommend FileZilla
- Create a PHP file (code below)
- Create an object in Second Life to read your PHP file
- Do something with the result
Thanks to http://lslwiki.net/lslwiki/wakka.php?wakka=ExamplellHTTPRequest for the concept and basis for this code:
PHP File sl.php
<?php
$color = file_get_contents('http://yourdomain.com/color.txt');
echo "Your color selection is " . $color . ".\n";
?>
Script in Object
key requestid; // check if we're getting the result we've asked for
// all scripts in the same object get the same replies
default
{
touch_start(integer number)
{
requestid = llHTTPRequest("http://yourdomain.com/sl.php",
[HTTP_METHOD, "POST",
HTTP_MIMETYPE, "application/x-www-form-urlencoded"],
"");
}
http_response(key request_id, integer status, list metadata, string body)
{
if (request_id == requestid)
llWhisper(0, body);
}
}
Of course instead of just whispering the output you would want to do something with that value, for example convert a list of common color names to a HEX value or other color format, and then use that to change the color of the object in question. But you get the idea -- it's possible to read something from a text document into LSL.
Also, if you want to use Dropbox instead of FTP to get a file onto the web easier, you just have to get the public link and then add ?dl=1 to the end to force the file to open, rather than to display in the browser as a webpage with extra HTML stuff attached. So for example, you'd use:
$color = file_get_contents('https://www.dropbox.com/s/i0wpav054k5uept/color.txt?dl=1');
Hope this helps!