Dodedodo33

Enchanting turtle v1.1

May 29th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getLevels()
  2.    local Levels = m.getLevels()  
  3.    print("There are ".. Levels.." levels stored")
  4. end
  5.  
  6. function Enchant()
  7.    term.clear()
  8.    term.setCursorPos(1,1)
  9.    select(1)
  10.    getLevels()
  11.    print("Enchanting item at Which Level?")
  12.    local LVLS = tonumber(m.getLevels())
  13.    local EnchantLVL = tonumber(read())
  14.    term.clear()
  15.    term.setCursorPos(1,1)
  16.    if type(EnchantLVL) ~= "number" then
  17.       print("Cannot enchant, you probably did not enter a number.")
  18.       sleep(2)
  19.    elseif EnchantLVL > 30 then
  20.       print("Cannot enchant with more then 30 Levels.")
  21.       sleep(2)
  22.    elseif EnchantLVL > LVLS then
  23.       print("Cannot enchant, not enough Levels available.")
  24.       sleep(2)
  25.    elseif m.enchant(EnchantLVL) == true then
  26.       print("Enchanting succeeded, please check your item.")
  27.       sleep(5)
  28.    else
  29.       print("Enchanting failed, either there is no item in slot 1, or it is not enchantable.")
  30.       sleep(2)
  31.    end
  32. end
  33.  
  34. m=peripheral.wrap("right")
  35. while true do
  36.    term.clear()
  37.    term.setCursorPos(1,1)
  38.    print("To enchant an item, place it in slot 1 and press any character key to continue...")
  39.    os.pullEvent("char")
  40.    Enchant()
  41. end
Advertisement
Add Comment
Please, Sign In to add comment