Dodedodo33

Turtle enchant

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