cecell

Turtle Refuel

Apr 28th, 2014
451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1. local tArgs = { ... }
  2. local nSlot = tArgs[1]
  3. local nQty = tArgs[2]
  4.  
  5. nSlot = nSlot + 0
  6. nQty = nQty + 0
  7.  
  8. --print("nSlot is: " .. nSlot)
  9. --print("nQty is: " .. nQty)
  10. --return
  11.  
  12. if not nSlot then
  13.   print("Usage: refuel <slot> <quantity>")
  14.   return
  15. end
  16.  
  17. if not nQty then
  18.   print("Usage: refuel <slot> <quantity>")
  19.   return
  20. end
  21.  
  22. if nSlot > 16 then
  23.   print("Turtle inventory slot must be a value between 1 and 16.")
  24.   return
  25. end
  26.  
  27. if nSlot < 1 then
  28.   print("Turtle inventory slot must be a value between 1 and 16.")
  29.   return
  30. end
  31.  
  32. turtle.select(nSlot)
  33. local success = turtle.refuel(nQty)
  34.  
  35. if success == false then
  36.   print("\n")
  37.   print("Turtle refuel failed. Check your quantity or slot number and retry.")
  38.   print("Usage: refuel <slot> <quantity>")
  39.   return
  40. end
  41.  
  42. print("Turtle successfully refueled!")
  43. turtle.select(1)
Advertisement
Add Comment
Please, Sign In to add comment