Dodedodo33

Enchanting turtle v1.0

May 20th, 2013
72
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.    if EnchantLVL > 30 then
  15.       print("Cannot enchant with more then 30 Levels.")
  16.       sleep(2)
  17.    elseif EnchantLVL > LVLS then
  18.       print("Cannot enchant, not enough Levels available.")
  19.       sleep(2)
  20.    elseif m.enchant(EnchantLVL) == true then
  21.       print("Enchanting succeeded, please check your item.")
  22.       sleep(5)
  23.    else
  24.       print("Enchanting failed, either there is no item in slot 1, or it is not enchantable.")
  25.       sleep(2)
  26.    end
  27. end
  28.  
  29. m=peripheral.wrap("right")
  30. while true do
  31.    term.clear()
  32.    term.setCursorPos(1,1)
  33.    print("To enchant an item, place it in slot 1 and press any character key...")
  34.    os.pullEvent("char")
  35.    Enchant()
  36. end
Advertisement
Add Comment
Please, Sign In to add comment