Programs that access and use off-world resources
default { state_entry() { llSay(0,"You can say thanks to Hector on channel 1"); llSay(0,"Just type /1 at the beginning of your message"); llSetTimerEvent(60); //Give them 60 seconds to say it. llListen(1,"","",""); } on_rez(integer start_param) { llResetScript(); } listen(integer channel, string name, key id, string message) { llSay(0,"Thanks I'll tell Hector"); llEmail("Hector.Something@gmail.com","thanks",message); llOwnerSay("OK message sent..."); } timer() { llOwnerSay("bye"); llDie(); } }
For experts that want to send SL messages to non-SL processes on other computers... this sends a message offworld
key requestid; // just to 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) { string message = llEscapeURL("from Virtual EdBoost"); // escapes to handle spaces etc requestid = llHTTPRequest("http://wintermute.linguistics.ucla.edu/hmsg2.php", [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"], "parameter1=hello&parameter2=" + message); } http_response(key request_id, integer status, list metadata, string body) { if (request_id == requestid) llWhisper(0, "Wintermute reports getting this message from SL:\n " + body); } } This php script catches the message at the other end
<? // From http://www.lslwiki.com/lslwiki/wakka.php?wakka=ExamplellHTTPRequest // Only works with PHP compiled as an Apache module $headers = apache_request_headers(); $objectName = $headers["X-SecondLife-Object-Name"]; $objectKey = $headers["X-SecondLife-Object-Key"]; $ownerKey = $headers["X-SecondLife-Owner-Key"]; $ownerName = $headers["X-SecondLife-Owner-Name"]; $region = $headers["X-SecondLife-Region"]; // and so on for getting all the other variables ... // get things from $_POST[] // Naturally enough, if this is empty, you won't get anything $parameter1 = $_POST["parameter1"]; $parameter2 = $_POST["parameter2"]; syslog(LOG_INFO, "edboost: " . $objectName . " in " . $region . " owned by " . $ownerName . " touched by " . $parameter1 . "\n"); echo $objectName . " in " . $region . " and owned by " . $ownerName . " was touched by " . $parameter1 . " " . $parameter2 . "\n"; ?>