Advertisement
Jym_Nova

SimFlatMap

Oct 23rd, 2014
493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Written By: Ĵyм Ѡҩℓƒ (Jym Resident)
  2. /*
  3. LICENCE:
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. any later version.
  8.  
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. GNU General Public License for more details.
  13.  
  14. You should have received a copy of the GNU General Public License
  15. along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16. or you may visit - http://license.idjhost.com/
  17. */
  18. // DESCRIPTION
  19. // Sim flat map image on a prim
  20.  
  21. key requestID;
  22. integer handle;
  23. integer channel;
  24. string currentsim;
  25. string query_string;
  26.  
  27. default
  28. {
  29.     state_entry()
  30.     {
  31.         handle=0;
  32.         channel=87;  
  33.     }
  34.     touch_start(integer total_number)
  35.     {
  36.         if(handle!=0)
  37.         {
  38.             llListenRemove(handle);
  39.             handle=0;
  40.         }  
  41.         llSay(0,"Say name of Region you want on channel " + (string)channel);
  42.         handle=llListen(channel,"","","");
  43.         llSetTimerEvent(10.0);
  44.         }
  45.         listen(integer channel, string name, key id, string message)
  46.         {
  47.             currentsim=message;
  48.             query_string="region=" + llEscapeURL(message) + "&item=objects_uuid";
  49.             requestID = llHTTPRequest("http://api.gridsurvey.com/simquery.php",[HTTP_METHOD, "POST",HTTP_MIMETYPE,"application/x-www-form-urlencoded"], query_string);
  50.             llSetTimerEvent(0.0);
  51.             if(handle!=0)llListenRemove(handle);
  52.             handle=0;
  53.         }
  54.         http_response(key req_id, integer status, list meta, string body)
  55.         {
  56.             if (req_id == requestID)
  57.             {
  58.                 if(llGetSubString(body, 0, 4)=="Error")
  59.                 {
  60.                     llSay(0,body);
  61.                 }
  62.                 else
  63.                 {  
  64.                     llSetTexture(body, ALL_SIDES);
  65.                     llSay(0,"Current Region Map UUID for "+ currentsim + " is "+ body);
  66.                 }
  67.             }
  68.             else
  69.             {
  70.                 llSay(0,"Error: " + (string)status);
  71.             }
  72.         }
  73.         timer()
  74.         {  
  75.             if(handle!=0){
  76.             llSay(0,"Region Map change timed out after 10 seconds. Please touch again to change the Region Map");
  77.             llListenRemove(handle);
  78.             handle=0;
  79.         }    
  80.         llSetTimerEvent(0.0);
  81.     }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement