Advertisement
RuthvenWillenov

Multi Destination Experience Teleporter

Jun 20th, 2018
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. integer index;
  2. integer numlandmarks;
  3. menu(key id)
  4. {
  5.     list buttons = ["<<","Cancel",">>"];
  6.     integer i = index;
  7.     string text = "Choose a destination";
  8.     while(i < (index+9) && i < numlandmarks)
  9.     {
  10.         buttons += (string)(i+1);
  11.         text += llDumpList2String(["\n",i+1,". " +llGetInventoryName(INVENTORY_LANDMARK,i)],"");
  12.         i++;
  13.     }
  14.     llDialog(id,text,buttons,Dchan);
  15. }
  16. string destination;
  17. integer Dchan;
  18. default
  19. {
  20.     state_entry()
  21.     {
  22.         Dchan = (integer)llFrand(-5000)-7000;
  23.         numlandmarks = llGetInventoryNumber(INVENTORY_LANDMARK);
  24.         llListen(Dchan,"","","");
  25.     }
  26.     on_rez(integer n)
  27.     {
  28.         llResetScript();
  29.     }
  30.    
  31.     touch_start(integer total_number)
  32.     {
  33.         key id = llDetectedKey(0);
  34.         menu(id);
  35.     }
  36.    
  37.     listen(integer chan, string name, key id, string message)
  38.     {
  39.         if(message == "<<")
  40.         {
  41.             index -= 9;
  42.             if(index < 0)index = numlandmarks-9;
  43.             menu(id);
  44.         }
  45.         else if(message == ">>")
  46.         {
  47.             index += 9;
  48.             if(index >= numlandmarks)index = 0;
  49.             menu(id);
  50.         }
  51.         else if(message == "Cancel")
  52.         {
  53.             index = 0;
  54.         }
  55.         else
  56.         {
  57.             destination = llGetInventoryName(INVENTORY_LANDMARK,((integer)message)-1);
  58.             llRequestExperiencePermissions(id,"");
  59.             index = 0;
  60.         }
  61.     }
  62.    
  63.     experience_permissions(key id)
  64.     {
  65.         llTeleportAgent(id,destination,ZERO_VECTOR,ZERO_VECTOR);
  66.     }
  67.    
  68.     changed(integer change)
  69.     {
  70.         numlandmarks = llGetInventoryNumber(INVENTORY_LANDMARK);
  71.     }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement