Guest User

vwrsearch workaround

a guest
Apr 12th, 2013
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. string sUrl = "http://anonymouse.org/cgi-bin/anon-www.cgi/http://search.secondlife.com/client_search.php?s=people&session=00000000-0000-0000-0000-000000000000&mat=7&q=";
  2. string sSearchString = "http://world.secondlife.com/resident/";
  3. integer iKeyLength = 36;
  4. string sMessage = "Please say the name in chat!";
  5. string sMessageSearching = "Searching for: ";
  6. string sMessageResult = "Result: ";
  7. float fTime = 20;
  8. integer iListen;
  9. default
  10. {
  11.     touch_start(integer total_number)
  12.     {
  13.         llSetTimerEvent(fTime);
  14.         iListen = llListen(PUBLIC_CHANNEL, "", llDetectedKey(0), "");
  15.         llSay(PUBLIC_CHANNEL, sMessage);
  16.     }
  17.     timer()
  18.     {
  19.         llListenRemove(iListen);
  20.         llSetTimerEvent(0);
  21.     }
  22.     listen(integer channel, string name, key id, string message)
  23.     {
  24.         if(llToLower(llGetSubString(message,-8,-1)) == "resident")
  25.         {
  26.             message = llGetSubString(message,0,-9);
  27.         }
  28.         llListenRemove(iListen);
  29.         llSay(PUBLIC_CHANNEL, sMessageSearching + message);
  30.         llSetTimerEvent(0);
  31.         llHTTPRequest(sUrl + llEscapeURL(message), [HTTP_BODY_MAXLENGTH,16384], "");
  32.     }
  33.     http_response(key request_id, integer status, list metadata, string body)
  34.     {
  35.         string sResultKey = "";
  36.         integer iResultPos = llSubStringIndex(body, sSearchString);
  37.         if (iResultPos != -1)
  38.         {
  39.             iResultPos = iResultPos + llStringLength(sSearchString);
  40.             sResultKey = llGetSubString(body, iResultPos, iResultPos + iKeyLength-1);
  41.         }
  42.         llSay(PUBLIC_CHANNEL, sMessageResult + sResultKey);
  43.     }
  44. }
Add Comment
Please, Sign In to add comment