User:Talia Tokugawa/scripts/MapUrlExample

From Second Life Wiki
< User:Talia Tokugawa‎ | scripts
Revision as of 09:23, 26 June 2008 by Talia Tokugawa (talk | contribs) (New page: Just a quick example for a Map Url Teleport system. Will take the first landmark it finds in inventory and display the location on the map for that landmark. I added in a few things to res...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Just a quick example for a Map Url Teleport system. Will take the first landmark it finds in inventory and display the location on the map for that landmark. I added in a few things to reset the script if things get changed. <lsl> key request; string name; string sim_name; vector pos; integer current=0; default {

   state_entry()
   {
       if(llGetInventoryNumber(INVENTORY_LANDMARK))
       {
           current = 0;
           request = llRequestInventoryData(name = llGetInventoryName(INVENTORY_LANDMARK,0));
       }
   }
   dataserver(key id, string data)
   {
       if(id == request)
       {
           pos = (vector)data;
           sim_name = llGetRegionName();
       }
   }
   
   touch_start(integer a)
   {
           if(name != "") llMapDestination(sim_name, pos, pos);
   }
   
   changed(integer a)
   {
       if(a & (CHANGED_INVENTORY | CHANGED_ALLOWED_DROP))
       {
           if(llGetInventoryNumber(INVENTORY_LANDMARK))
           {
               current = 0;
               request = llRequestInventoryData(name = llGetInventoryName(INVENTORY_LANDMARK,0));
           }
       }
   }
   
   on_rez(integer p)
   {
       llResetScript();
   }

} </lsl>