Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("kapi")
- --Table of options
- option = {"insert", "remove"}
- --Variables
- l = #option
- n = 1 --For Option Table
- while true do
- kapi.menu("Please select a option from the following:")
- for i = 1, l, 1 do
- if n == i then
- print(">" .. option[i] .. "<")
- else
- print(" " .. option[i])
- end
- end
- keypress = kapi.keyread()
- if keypress == keys.up then --Up Arrow
- if n == 1 then
- n = l
- else
- n = n - 1
- end
- elseif keypress == keys.down then --Down Arrow
- if n == l then
- n = 1
- else
- n = n + 1
- end
- elseif keypress == keys.enter then --Enter key
- if option[n] == "insert" then
- if turtle.detect() == true then
- turtle.select(2)
- turtle.drop()
- else
- print("Can't place inventory here!")
- end
- elseif option[n] == "remove" then
- if turtle.detect() == true then
- turtle.select(2)
- turtle.suck(1)
- else
- print("Can't remove inventory here!")
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement