Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monSide = "back"
- local Position = 1
- local Bcol = colors.lightGray
- local bSide = "right"
- local time = .5
- mon = peripheral.wrap(monSide)
- mon.setTextScale(.5)
- xMax,yMax = mon.getSize()
- Etage = {}
- Etage[1] = { 3, 5,14,13," EG" ,colors.black ,colors.blue ,colors.cyan ,false}
- Etage[2] = {16, 5,27,13," OG 1" ,colors.black ,colors.red ,colors.yellow ,false}
- Etage[3] = {29, 5,40,13," OG 2" ,colors.black ,colors.green ,colors.gray ,false}
- Etage[4] = {42, 5,53,13," OG 3" ,colors.black ,colors.orange ,colors.pink ,false}
- Etage[5] = { 3,15,14,23," OG 4" ,colors.black ,colors.lime ,colors.white ,false}
- Etage[6] = {16,15,27,23," OG 5" ,colors.black ,colors.magenta ,colors.lightGray,false}
- Etage[7] = {29,15,40,23," OG 6.1" ,colors.black ,colors.lightBlue,colors.purple ,false}
- Etage[8] = {42,15,53,23," OG 6.2" ,colors.black ,colors.brown ,colors.black ,false}
- function JoJa(xP,yP)
- mon.setCursorPos(xP,yP)
- mon.setBackgroundColor(colors.gray)
- mon.setTextColor(colors.cyan)
- mon.write("Jo")
- mon.setTextColor(colors.orange)
- mon.write("Ja ")
- mon.setTextColor(colors.lightGray)
- mon.write("Productions")
- end
- function Background(col)
- mon.setBackgroundColor(col)
- for yPos = 1,yMax do
- for xPos = 1,xMax do
- mon.setCursorPos(xPos,yPos)
- mon.write(" ")
- end
- end
- mon.setCursorPos(xMax/2-3,3)
- mon.setBackgroundColor(colors.red)
- mon.write(" Etage "..Position.." ")
- end
- function drawButton()
- for i = 1,#Etage do
- mon.setTextColor(colors.white)
- mon.setBackgroundColor(Etage[i][6])
- for yPos = Etage[i][2],Etage[i][4] do
- for xPos = Etage[i][1],Etage[i][3] do
- mon.setCursorPos(xPos,yPos)
- mon.write(" ")
- end
- end
- mon.setCursorPos((Etage[i][1]+Etage[i][3])/2-#Etage[i][5]/2,(Etage[i][2]+Etage[i][4])/2)
- mon.write(Etage[i][5])
- end
- end
- function checkButton(xP,yP)
- for i = 1,#Etage do
- if xP >= Etage[i][1] and xP <= Etage[i][3]
- and yP >= Etage[i][2] and yP <= Etage[i][4]
- then
- Etage[i][9] = true
- end
- end
- end
- function move()
- col = 0
- for i = 1,#Etage do
- if Etage[i][9] then
- Etage[i][9] = false
- if Position < i then
- for p = Position,i do
- col = col + Etage[p][7]
- sleep(time)
- rs.setBundledOutput(bSide,col)
- end
- elseif Position > i then
- for p = Position,i,-1 do
- col = col + Etage[p][8]
- sleep(time)
- rs.setBundledOutput(bSide,col)
- end
- end
- end
- end
- rs.setBundledOutput(bSide,0)
- end
- while true do
- Background(Bcol)
- JoJa(xMax/2-7,1)
- drawButton()
- event,_,xPos,yPos = os.pullEvent("monitor_touch")
- checkButton(xPos,yPos)
- move()
- end
Advertisement
Add Comment
Please, Sign In to add comment