0% found this document useful (0 votes)
181 views

LSL To PHP SecondLife Script To Web Communications

An example script showing how to get a script from second life to communicate with a php server on the web

Uploaded by

Stuart Rodgers
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
181 views

LSL To PHP SecondLife Script To Web Communications

An example script showing how to get a script from second life to communicate with a php server on the web

Uploaded by

Stuart Rodgers
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

// ********************** // STRINGS // ********************** string gBase = "http://www.phpserver.com/sl/silo/siloappend.

php"; string myKey = "/k39fhs8asisb48nje9/"; string objName = ""; string uniUrl = ""; // ********************** // MAIN ENTRY // ********************** default { state_entry() { objName = llGetObjectName(); llOwnerSay("In object " + objName + " the php_ss script is in default mo de."); // llSetTimerEvent(180.0); llSensorRepeat( "", NULL_KEY, AGENT, 96.0, PI, 180.0 ); uniUrl = gBase + myKey + objName; } sensor(integer numberDetected) { // Do sensing, send message to php script // Get avatar key, name, position, time // Put all this in a string string data = "Time=" + llGetTimestamp() + "; "; integer i = 0; while(numberDetected > i++)//skips the first item which suits this appli cation { string msg = "agent=" + llDetectedName(i) + "; pos=" + (string)llDet ectedPos(i); llHTTPRequest(uniUrl, [ HTTP_METHOD, "PUT" ], data + msg); llSleep(1.0); } } no_sensor() { // Sensing detected nothing // Send little message with time to php script string data = "Time=" + llGetTimestamp() + "; Nothing detected"; llHTTPRequest(uniUrl, [ HTTP_METHOD, "PUT" ], data); } }

You might also like