Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m = peripheral.wrap( "right" )
- m.setTextScale(2)
- x,y = m.getSize()
- m.clear()
- direction = 0
- --H H H /\
- --H H H \/
- floors = {}
- for i=1,6 do
- floors[i]=0
- end
- floorsCount=5
- currentFloor=3
- floors[2]=1
- function setColors(X)
- if X == 0 then --blank
- m.setTextColor(colors.white)
- m.setBackgroundColor(colors.black)
- elseif X==1 then --inactive
- m.setTextColor(colors.lightGray)
- m.setBackgroundColor(colors.gray)
- elseif X==2 then --active
- m.setTextColor(colors.white)
- m.setBackgroundColor(colors.lightGray)
- elseif X==3 then --current
- m.setTextColor(colors.white)
- m.setBackgroundColor(700)
- end
- end
- function redraw()
- setColors(0)
- m.clear()
- cf = 1
- for j=1,2 do
- for i=1,5 do
- m.setCursorPos(i,j)
- if i%2 == 1 and cf<=floorsCount then
- if cf==currentFloor then
- setColors(3)
- elseif floors[cf] == 1 then
- setColors(2)
- else
- setColors(1)
- end
- m.write(cf)
- cf = cf+1
- else
- setColors(0)
- m.write(" ")
- end
- end
- end
- end
- c=1
- redraw()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement