Risk_exe

bot.lua

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