Ver Fonte

Counterpart script for registering avatar names & keys

Gwyneth Llewelyn há 6 anos atrás
pai
commit
67d5096f15
1 ficheiros alterados com 37 adições e 0 exclusões
  1. 37 0
      touch.lsl

+ 37 - 0
touch.lsl

@@ -0,0 +1,37 @@
+string touchURL = "[Insert your full URL here]/touch/";
+key http_request_id;
+
+default
+{
+    state_entry()
+    {
+        llSetText("Touch to register your avatar name and UUID", <1,1,1>, 1);
+    }
+    
+    touch_start(integer howmany)
+    {
+        integer i;
+        llSetText("Sending...", <1,0,0>, 1);
+        for (i = 0; i < howmany; i++) {
+            http_request_id = llHTTPRequest(touchURL + "?name=" + llEscapeURL(llDetectedName(i)) +
+                "&amp;key=" + llEscapeURL(llDetectedKey(i)), [], "");    
+        }
+        state default;
+    }
+    
+    timer()
+    {
+        llResetScript();
+    }
+
+    http_response(key request_id, integer status, list metadata, string body)
+    {
+        if (request_id == http_request_id)
+        {
+            if (status == 200)
+                llWhisper(0, body);
+            else
+                llWhisper(0, "Error " + (string)status + ": " + body);
+        }
+    }
+}