Advertisement
Ubidibity

blood_stone2

Jan 6th, 2024 (edited)
951
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Revised with ChatGPT 3.5
  2. -- Modified to re-add the pruned while loop
  3.  
  4. local chest = peripheral.wrap("left")
  5.  chest.condenseItems()
  6.  
  7. local conversionTable = {
  8.     stone = {target = "blankSlate", sleepTime = 5},
  9.     blankSlate = {target = "reinforcedSlate", sleepTime = 7},
  10.     reinforcedSlate = {target = nil, sleepTime = 8}
  11. }
  12.  
  13. function convertTo(targetBlock, sleepTime)
  14.     while true do
  15.         local found = false
  16.         for i = 1, 27 do
  17.             local slot = chest.getStackInSlot(i)
  18.             if slot and slot.name == targetBlock then
  19.                 print("Converting "..slot.name.." to "..targetBlock.." in slot "..i)
  20.                 chest.pushItem("down", i, 1)
  21.                 sleep(sleepTime)
  22.                 found = true
  23.                 break
  24.             end
  25.         end
  26.         if not found then
  27.             break
  28.         end
  29.     end
  30. end
  31.  
  32. for _, conversionInfo in pairs(conversionTable) do
  33.     convertTo(conversionInfo.target, conversionInfo.sleepTime)
  34. end
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement