Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m = peripheral.wrap("back")
- list = { "diamond","gold","iron","leather"}
- ready = false
- x = 7
- y = 2
- term.clear()
- function changePos(xpos,ypos)
- term.setCursorPos(posx,posy)
- term.write(" ")
- term.setCursorPos(posx+12,posy)
- term.write(" ")
- posx = xpos
- posy = ypos
- term.setCursorPos(posx,posy)
- term.write("[")
- term.setCursorPos(posx+12,posy)
- term.write("]")
- end
- term.setCursorPos(7-(string.len("exit")/2-1),1)
- term.write("exit")
- term.setCursorPos(20-(string.len("floor")/2-1),1)
- term.write("floor")
- for i = 1, #list do
- term.setCursorPos(x-(string.len(list[i])/2-1),y)
- term.write(list[i])
- if x == 20 then
- x = 7
- y = y + 1
- else
- x = 20
- end
- end
- posx = 1
- posy = 1
- changePos(posx,posy)
- while not ready do
- event = { os.pullEvent("key") }
- if event[2] == 17 and posy > 1 then
- changePos(posx,posy-1)
- elseif event[2] == 31 and posy < ((#list/2)+1) then
- changePos(posx,posy+1)
- elseif event[2] == 30 and posx == 14 then
- changePos(posx-13,posy)
- elseif event[2] == 32 and posx == 1 then
- changePos(posx+13,posy)
- elseif event[2] == 28 then
- location = (posy*2)-2
- if posx == 1 then
- location = location + 1
- else
- location = location + 2
- end
- if location == 1 then
- ready = true
- end
- if location == 2 then
- m.transmit(100,101,"floor")
- elseif location > 1 then
- m.transmit(100,101,location-2)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement