Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- monitor = peripheral.wrap("right")
- monitor.clear()
- curfloor = -3
- function scan()
- print("scanning routine")
- end
- function drawFile(f,s)
- fails = fs.open(f,"r")
- for line=1,28 do
- row = fails.readLine()
- if row then
- for char=1,string.len(row) do
- sym = string.sub(row,char,char)
- if s == 1 then
- monitor.setCursorPos(char+24,line)
- else
- monitor.setCursorPos(char,line)
- end
- if sym == "#" then
- monitor.setBackgroundColor(colors.gray)
- monitor.write(" ")
- elseif sym == "r" then
- monitor.setBackgroundColor(colors.red)
- monitor.write(" ")
- elseif sym == "g" then
- monitor.setBackgroundColor(colors.green)
- monitor.write(" ")
- elseif sym == "b" then
- monitor.setBackgroundColor(colors.blue)
- monitor.write(" ")
- else
- monitor.setBackgroundColor(colors.black)
- monitor.write(" ")
- end
- end
- end
- end
- if s == 0 then
- monitor.setCursorPos(1,1)
- monitor.write("Floor:")
- monitor.setCursorPos(13-string.len(f)/2,1)
- monitor.write(f)
- end
- end
- while true do
- drawFile(tostring(curfloor),0)
- drawFile("sidebar",1)
- event,side,x,y =os.pullEvent("monitor_touch")
- if x >25 and x<29 and y>1 and y<6 then
- if fs.exists(tostring(curfloor+1)) then
- curfloor = curfloor+1
- end
- end
- if x>25 and x<29 and y>6 and y<11 then
- if fs.exists(tostring(curfloor-1)) then
- curfloor = curfloor-1
- end
- end
- if x>25 and x<29 and y>11 and y<16 then
- scan()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement