Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- rednet.open("left")
- -- Positions
- local ax, ay = 5, 6 -- Main Screen Engine Controls
- local bx, by = 30, 6 --Main Screen Tank Controls
- local dx, dy = 1, 19 -- Back Button
- --Engine Status Lights Positions
- local abx, aby = 5,3 -- bank1 light
- local acx, acy = 18, 3 -- Bank 2 Light
- local adx, ady = 31, 3 -- Bank 3 light
- local aex, aey = 5, 5 -- Bank 4 light
- local afx, afy = 18, 5 -- Bank 5 light
- local agx, agy = 31, 5 -- bank 6 light
- --Engine Switches Positions
- local aax, aay = 5, 7 -- Bank 1 On Button
- local bax, bay = 5, 8 -- Bank 1 Off Button
- local dax, day = 18, 7 -- Bank 2 On Button
- local eax, eay = 18,8 -- Bank 2 Off Button
- local fax, fay = 31,7 -- Bank 3 On Button
- local gax, gay = 31,8 --Bank 3 off button
- local hax, hay = 5, 11 -- Bank 4 On Button
- local iax, iay = 5,12 --bank 4 Off Button
- local jax, jay = 18, 11 -- Bank 5 On Button
- local kax, kay = 18, 12 -- Bank 5 off Button
- local lax, lay = 31, 11 -- Bank 6 on button
- local max, may = 31, 12 -- Bank 6 off button
- -- Button Text
- local engcon = "[ Engine Controls ]"
- local tankcon = "[ Tank Controls ]"
- local bkbtn = "[Back]"
- -- Engine Switches Text --
- local bnk1on = "[Bank 1 On]"
- local bnk1off = "[Bank 1 Off]"
- local bnk2on = "[Bank 2 On]"
- local bnk2off = "[Bank 2 Off]"
- local bnk3on = "[Bank 3 On]"
- local bnk3off = "[Bank 3 Off]"
- local bnk4on = "[Bank 4 On]"
- local bnk4off = "[Bank 4 Off]"
- local bnk5on = "[Bank 5 On]"
- local bnk5off = "[Bank 5 Off]"
- local bnk6on = "[Bank 6 On]"
- local bnk6off = "[Bank 6 Off]"
- -- Engine Status Light Text
- local bnk1staton = "Bank 1 On "
- local bnk1statoff = "Bank 1 Off"
- local bnk2staton = "Bank 2 On "
- local bnk2statoff = "Bank 2 Off"
- local bnk3staton = "Bank 3 On "
- local bnk3statoff = "Bank 3 Off"
- local bnk4staton = "Bank 4 On "
- local bnk4statoff = "Bank 4 Off"
- local bnk5staton = "Bank 5 On "
- local bnk5statoff = "Bank 5 Off"
- local bnk6staton = "Bank 6 On "
- local bnk6statoff = "Bank 6 Off"
- -- Main Page
- function main()
- term.clear()
- term.setCursorPos(ax,ay)
- write(engcon)
- term.setCursorPos(bx,by)
- write(tankcon)
- end
- -- Engine Managment Buttons
- function engine1on() -- bank1 on/off
- while true do
- local e, but, cx,cy = os.pullEvent()
- if e =="mouse_click" then
- if cx >= aax and cx <= aax + bnk1on:len() and cy == aay then
- rednet.send(1,"on")
- term.setCursorPos(abx, aby)
- term.setTextColor(colors.green)
- write(bnk1staton)
- term.setTextColor(colors.white)
- end
- end
- local e, but, cx,cy = os.pullEvent()
- if e =="mouse_click" then
- if cx >= bax and cx <= bax + bnk1off:len() and cy == bay then
- rednet.send(1,"off")
- term.setCursorPos(abx, aby)
- term.setTextColor(colors.red)
- write(bnk1statoff)
- term.setTextColor(colors.white)
- end
- end
- while true do
- local e, but, cx,cy = os.pullEvent()
- if e =="mouse_click" then
- if cx >= dax and cx <= dax + bnk2on:len() and cy == day then
- rednet.send(4,"on")
- term.setCursorPos(acx, acy)
- term.setTextColor(colors.green)
- write(bnk2staton)
- term.setTextColor(colors.white)
- end
- end
- local e, but, cx,cy = os.pullEvent()
- if e =="mouse_click" then
- if cx >= eax and cx <= eax + bnk2off:len() and cy == eay then
- rednet.send(4,"off")
- term.setCursorPos(acx, acy)
- term.setTextColor(colors.red)
- write(bnk2statoff)
- term.setTextColor(colors.white)
- end
- end
- while true do
- local e, but, cx,cy = os.pullEvent()
- if e =="mouse_click" then
- if cx >= fax and cx <= fax + bnk3on:len() and cy == fay then
- rednet.send(5,"on")
- term.setCursorPos(adx, ady)
- term.setTextColor(colors.green)
- write(bnk3staton)
- term.setTextColor(colors.white)
- end
- end
- local e, but, cx,cy = os.pullEvent()
- if e =="mouse_click" then
- if cx >= gax and cx <= gax + bnk3off:len() and cy == gay then
- rednet.send(5,"off")
- term.setCursorPos(adx, ady)
- term.setTextColor(colors.red)
- write(bnk3statoff)
- term.setTextColor(colors.white)
- end
- end
- while true do
- local e, but, cx,cy = os.pullEvent()
- if e =="mouse_click" then
- if cx >= hax and cx <= hax + bnk4on:len() and cy == hay then
- rednet.send(6,"on")
- term.setCursorPos(aex, aey)
- term.setTextColor(colors.green)
- write(bnk4staton)
- term.setTextColor(colors.white)
- end
- end
- local e, but, cx,cy = os.pullEvent()
- if e =="mouse_click" then
- if cx >= iax and cx <= iax + bnk4off:len() and cy == iay then
- rednet.send(6,"off")
- term.setCursorPos(aex, aey)
- term.setTextColor(colors.red)
- write(bnk4statoff)
- term.setTextColor(colors.white)
- end
- end
- while true do
- local e, but, cx,cy = os.pullEvent()
- if e =="mouse_click" then
- if cx >= jax and cx <= jax + bnk5on:len() and cy == jay then
- rednet.send(7,"on")
- term.setCursorPos(afx, afy)
- term.setTextColor(colors.green)
- write(bnk5staton)
- term.setTextColor(colors.white)
- end
- end
- local e, but, cx,cy = os.pullEvent()
- if e =="mouse_click" then
- if cx >= kax and cx <= kax + bnk5off:len() and cy == kay then
- rednet.send(7,"off")
- term.setCursorPos(afx, afy)
- term.setTextColor(colors.red)
- write(bnk5statoff)
- term.setTextColor(colors.white)
- end
- end
- while true do
- local e, but, cx,cy = os.pullEvent()
- if e =="mouse_click" then
- if cx >= kax and cx <= kax + bnk6on:len() and cy == kay then
- rednet.send(8,"on")
- term.setCursorPos(agx, agy)
- term.setTextColor(colors.green)
- write(bnk6staton)
- term.setTextColor(colors.white)
- end
- end
- local e, but, cx,cy = os.pullEvent()
- if e =="mouse_click" then
- if cx >= lax and cx <= lax + bnk3off:len() and cy == lay then
- rednet.send(8,"off")
- term.setCursorPos(agx, agy)
- term.setTextColor(colors.red)
- write(bnk6statoff)
- term.setTextColor(colors.white)
- end
- end
- end
- end
- end
- end
- end
- end
- end
- -- Engine Managment Screen
- function enginescreen()
- term.clear()
- term.setCursorPos(aax, aay)
- write(bnk1on)
- term.setCursorPos(bax, bay)
- write(bnk1off)
- term.setCursorPos(dax,day)
- write(bnk2on)
- term.setCursorPos (eax,eay)
- write(bnk2off)
- term.setCursorPos(fax, fay)
- write(bnk3on)
- term.setCursorPos(gax, gay)
- write(bnk3off)
- term.setCursorPos(hax,hay)
- write(bnk4on)
- term.setCursorPos (iax,iay)
- write(bnk4off)
- term.setCursorPos(jax, jay)
- write(bnk5on)
- term.setCursorPos(kax, kay)
- write(bnk5off)
- term.setCursorPos(lax,lay)
- write(bnk6on)
- term.setCursorPos (max,may)
- write(bnk6off)
- engine1on()
- end
- -- Home Page --
- function enginemanagment() -- engine managment function
- while true do
- local e, but, cx,cy = os.pullEvent()
- if e =="mouse_click" then
- if cx >= ax and cx <= ax + engcon:len() and cy == ay then
- enginescreen()
- end
- end
- end
- end
- main()
- enginemanagment()
Advertisement
Add Comment
Please, Sign In to add comment