Advertisement
salahzar

terraformer

Mar 28th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. integer CHANNEL;
  2.  integer ACTION;
  3.  integer SIZE;
  4.  
  5.  string MAIN_MENU_STRING;
  6.  string SIZE_MENU_STRING;
  7.  
  8.  list MAIN_MENU = [ "Level", "Raise", "Lower", "Smooth", "Noise", "Revert", "Size", "Stop", "Help", "Ground"];
  9.  list SIZE_MENU = [ "Small (2x2)", "Medium (4x4)", "Large (8x8)", "Back" ];
  10.  
  11.  default
  12.  {
  13.      state_entry()
  14.      {
  15.          
  16.          llSetPrimitiveParams([PRIM_COLOR, ALL_SIDES, <1, 0, 0>, 0.5, PRIM_SIZE, <3, 3, 0.5>]);
  17.          //ACTION = LAND_LEVEL;
  18.          //SIZE = LAND_SMALL_BRUSH;
  19.          MAIN_MENU_STRING = "Pick a tool or size of tool";
  20.          SIZE_MENU_STRING = "Pick size of tool or back to return";
  21.          CHANNEL = llFloor(llFrand(100000.0)) + 1000;
  22.          llListen(CHANNEL, "", NULL_KEY, "");
  23.      }
  24.      
  25.      touch_start(integer num_detected)
  26.      {
  27.          if (llDetectedOwner(0) == llGetOwner())
  28.          {
  29.              llDialog(llDetectedKey(0), MAIN_MENU_STRING, MAIN_MENU, CHANNEL);
  30.          }
  31.      }
  32.      
  33.      listen(integer CHANNEL, string name, key id, string message)
  34.      {
  35.          if (llListFindList(MAIN_MENU + SIZE_MENU, [message]) != -1)  // verify dialog choice
  36.          {
  37.              if (message == "Size")
  38.              {
  39.                  llDialog(id, SIZE_MENU_STRING, SIZE_MENU, CHANNEL);
  40.              }
  41.              
  42.              if (message == "Help")
  43.              {
  44.                  llGiveInventory(id, "Land Leveller");
  45.              }
  46.              
  47.              if (message == "Level")
  48.              {
  49.                  ACTION = LAND_LEVEL;
  50.                  llSetTimerEvent(0.1);
  51.              }
  52.              
  53.              if (message == "Raise")
  54.              {
  55.                  ACTION = LAND_RAISE;
  56.                  llSetTimerEvent(0.1);
  57.              }
  58.              
  59.              if (message == "Lower")
  60.              {
  61.                  ACTION = LAND_LOWER;
  62.                  llSetTimerEvent(0.1);
  63.              }
  64.              
  65.              if (message == "Smooth")
  66.              {
  67.                  ACTION = LAND_SMOOTH;
  68.                  llSetTimerEvent(0.1);
  69.              }
  70.              
  71.              if (message == "Noise")
  72.              {
  73.                  ACTION = LAND_NOISE;
  74.                  llSetTimerEvent(0.1);
  75.              }
  76.              
  77.              if (message == "Revert")
  78.              {
  79.                  ACTION = LAND_REVERT;
  80.                  llSetTimerEvent(0.1);
  81.              }
  82.              
  83.              if (message == "Small (2x2)")
  84.              {
  85.                  SIZE = LAND_SMALL_BRUSH;
  86.                  llSetPrimitiveParams([PRIM_COLOR, ALL_SIDES, <1, 0, 0>, 0.5, PRIM_SIZE, <3, 3, 0.5>]);
  87.              }
  88.              
  89.              if (message == "Medium (4x4)")
  90.              {
  91.                  SIZE = LAND_MEDIUM_BRUSH;
  92.                  llSetPrimitiveParams([PRIM_COLOR, ALL_SIDES, <0, 1, 0>, 0.5, PRIM_SIZE, <5, 5, 0.5>]);
  93.              }
  94.              
  95.              if (message == "Large (8x8)")
  96.              {
  97.                  SIZE = LAND_LARGE_BRUSH;
  98.                  llSetPrimitiveParams([PRIM_COLOR, ALL_SIDES, <0, 0, 1>, 0.5, PRIM_SIZE, <9, 9, 0.5>]);
  99.              }
  100.              
  101.              if (message == "Stop")
  102.              {
  103.                  llSetTimerEvent(0);
  104.              }
  105.              
  106.              if (message == "Ground")
  107.              {
  108.                  // THIS PORTION BY STRIFE ONIZUKA //
  109.                  float height = llGround(ZERO_VECTOR);
  110.                  vector pos = llGetPos();
  111.                  integer count = llCeil(llFabs(height - pos.z) / 10.0);
  112.                  pos.z = height;
  113.                  for(;count;--count)
  114.                      llSetPos(pos);
  115.                  // THANK YOU STRIFE! //
  116.                  llSay(0, "Now at ground level");
  117.                  ACTION = LAND_LEVEL;
  118.                  llSetTimerEvent(0.1);
  119.              }
  120.          }
  121.      }
  122.  
  123.      timer()
  124.      {
  125.          llModifyLand((integer)ACTION, (integer)SIZE);
  126.          llSetTimerEvent(0.1);
  127.      }
  128.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement