Advertisement
Risk_exe

bot.lua

Feb 4th, 2023
1,028
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1.  
  2. args = {...};
  3. local x = 0;
  4. local y = args[1];
  5. local z = 0;
  6.  
  7.  
  8. function forward()
  9.  
  10. end
  11.  
  12. function up()
  13.   y = y + 1;
  14.   if turtle.detectUp() then
  15.     turtle.digUp();
  16.   end
  17.   turtle.up();
  18. end
  19.  
  20. function down()
  21.   y = y - 1;
  22.   if turtle.detectDown() then
  23.     turtle.digDown();
  24.   end
  25.   turtle.down();
  26. end
  27.  
  28. function descend()
  29.   while y > -30 do
  30.     down();
  31.   end
  32. end
  33.  
  34. -- This function is causing so many problems
  35. function valuable(name)
  36.   local lis = {"minecraft:diamond_ore", "minecraft:coal_ore", "minecraftt:gold_ore", "minecraft_iron_ore", "minecraft_redstone_ore"};
  37.   for index, value in ipairs(lis) do
  38.     print("item: ", value);
  39.     if value == name.toString() then
  40.       return true;
  41.     end
  42.   end
  43.  
  44.   print("no valuable ores discovered")
  45.   print("ore name: ", name);
  46.   return false;
  47. end
  48.  
  49.  
  50. function scan()
  51.   local success, data = turtle.inspectUp();
  52.   if valuable(data.name) then
  53.     print("this ore is valueable");
  54.   end
  55. end
  56.  
  57.  
  58. if z == nil then
  59.   print("please pass y value as argument");
  60.   return;
  61. end
  62.  
  63. local success, data = turtle.inspectDown();
  64.  
  65. if success then
  66.   print("Block name: ", data.name);
  67.   print("Block metadata: ", data.metadata);
  68.   scan();
  69. end
  70.  
  71. print("x: ", x);
  72. print("y: ", y);
  73. print("z: ", z);
  74.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement