Difference between revisions of "User:Talia Tokugawa/scripts/MapUrlExample"

From Second Life Wiki
Jump to navigation Jump to search
Line 1: Line 1:
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.
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>
<lsl>
key request;
key request;
string name;
string name;
Line 6: Line 8:
vector pos;
vector pos;
integer current=0;
integer current=0;
default
 
{
default {
     state_entry()
     state_entry() {
    {
         if(llGetInventoryNumber(INVENTORY_LANDMARK)) {
         if(llGetInventoryNumber(INVENTORY_LANDMARK))
        {
             current = 0;
             current = 0;
             request = llRequestInventoryData(name = llGetInventoryName(INVENTORY_LANDMARK,0));
             request = llRequestInventoryData(name = llGetInventoryName(INVENTORY_LANDMARK,0));
         }
         }
     }
     }
     dataserver(key id, string data)
     dataserver(key kid, string sdt) {
    {
         if(kid == request) {
         if(id == request)
             pos = (vector)sdt;
        {
             pos = (vector)data;
             sim_name = llGetRegionName();
             sim_name = llGetRegionName();
         }
         }
     }
     }
      
      
     touch_start(integer a)
     touch_start(integer itn) {
    {
             if(name != "") llMapDestination(sim_name, pos, pos);
             if(name != "") llMapDestination(sim_name, pos, pos);
     }
     }
      
      
     changed(integer a)
     changed(integer ich) {
    {
         if(ich & (CHANGED_INVENTORY | CHANGED_ALLOWED_DROP)) {
         if(a & (CHANGED_INVENTORY | CHANGED_ALLOWED_DROP))
             if(llGetInventoryNumber(INVENTORY_LANDMARK)) {
        {
             if(llGetInventoryNumber(INVENTORY_LANDMARK))
            {
                 current = 0;
                 current = 0;
                 request = llRequestInventoryData(name = llGetInventoryName(INVENTORY_LANDMARK,0));
                 request = llRequestInventoryData(name = llGetInventoryName(INVENTORY_LANDMARK,0));
Line 42: Line 36:
     }
     }
      
      
     on_rez(integer p)
     on_rez(integer irp) {
    {
         llResetScript();
         llResetScript();
     }
     }

Revision as of 13:34, 23 August 2023

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 kid, string sdt) {
       if(kid == request) {
           pos = (vector)sdt;
           sim_name = llGetRegionName();
       }
   }
   
   touch_start(integer itn) {
           if(name != "") llMapDestination(sim_name, pos, pos);
   }
   
   changed(integer ich) {
       if(ich & (CHANGED_INVENTORY | CHANGED_ALLOWED_DROP)) {
           if(llGetInventoryNumber(INVENTORY_LANDMARK)) {
               current = 0;
               request = llRequestInventoryData(name = llGetInventoryName(INVENTORY_LANDMARK,0));
           }
       }
   }
   
   on_rez(integer irp) {
       llResetScript();
   }

}

</lsl>