Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- monside = peripheral.wrap("monitor_0")
- monup = peripheral.wrap("monitor_2")
- sg = peripheral.wrap("stargate_0")
- boolIris = false
- mainMenu = true
- menuPrivate = false
- gate = "stargate_0"
- energyMax = 1000000
- -- STARTUP --
- if irisState == "Open" then
- boolIris = false
- else
- boolIris = true
- end
- -------------
- function TouchScreen()
- -- TOUCH SCREEN --
- local event, side, arg1, arg2 = os.pullEvent()
- if event == "monitor_touch" then
- if side == "monitor_2" then
- -- bouton iris --
- if (arg1 > 1 and arg1 < 13) and
- (arg2 > 10 and arg2 < 12) and
- (irisState == "Closed" or
- irisState == "Open") then
- boolIris = not boolIris
- if boolIris == true then
- sg.closeIris()
- elseif boolIris == false then
- sg.openIris()
- end
- end
- -----------------
- elseif side == "monitor_0" then
- if (arg1 > 9 and arg1 < 21) and
- (arg2 > 0 and arg2 < 3) then
- AffichageSideScreen()
- menuPrivate = false
- mainMenu = true
- elseif (arg1 > 1 and arg1 < 9) and
- (arg2 > 1 and arg2 < 3) then
- AffichageSideScreen()
- mainMenu = false
- menuPrivate = true
- end
- end
- ------------------
- end
- end
- function AffichageSideScreen()
- monside.clear()
- monside.setBackgroundColor(colors.black)
- monside.setTextColor(colors.white)
- monside.setCursorPos(1,1)
- monside.write("O-------O O-------O")
- monside.setCursorPos(1,2)
- monside.write("| | | |")
- monside.setCursorPos(1,3)
- monside.write("| O-----------O |")
- monside.setCursorPos(1,4)
- monside.write("| | | |")
- monside.setCursorPos(1,5)
- monside.write("| | | |")
- monside.setCursorPos(1,6)
- monside.write("| | | |")
- monside.setCursorPos(1,7)
- monside.write("| | | |")
- monside.setCursorPos(1,8)
- monside.write("| | | |")
- monside.setCursorPos(1,9)
- monside.write("| | | |")
- monside.setCursorPos(1,10)
- monside.write("| | | |")
- monside.setCursorPos(1,11)
- monside.write("| | | |")
- monside.setCursorPos(1,12)
- monside.write("O-------O-----------O-------O")
- monup.setBackgroundColor(colors.black)
- monup.clear()
- monside.setBackgroundColor(colors.black)
- monside.clear()
- while true do
- TouchScreen()
- state, engaged, direction = sg.stargateState()
- irisState = sg.irisState()
- address = sg.remoteAddress()
- energy = math.floor(sg.energyAvailable() * 20)
- --energyToDial = (sg.energyToDial(address) * 20)
- if energy > energyMax then
- energy = energyMax
- end
- local sgChevronEngaged, gate, chevNum, symbol
- -- AFFICHAGE ECRAN DU HAUT --
- monup.setCursorPos(1,1)
- monup.setTextColor(colors.white)
- monup.setBackgroundColor(colors.lightGray)
- monup.write(" Etat de la porte : ")
- monup.setBackgroundColor(colors.gray)
- monup.setCursorPos(2,10)
- monup.setTextColor(colors.white)
- monup.write("Etat Iris :")
- monup.setCursorPos(2,11)
- monup.setBackgroundColor(colors.blue)
- monup.write(" ")
- monup.setCursorPos(12,11)
- monup.write(" ")
- monup.setCursorPos(3,11)
- monup.setTextColor(colors.white)
- if irisState == "Closed" then
- monup.setBackgroundColor(colors.red)
- monup.write(" Fermé ")
- elseif irisState == "Closing" then
- monup.setBackgroundColor(colors.orange)
- monup.write("Fermeture")
- elseif irisState == "Open" then
- monup.setBackgroundColor(colors.green)
- monup.write(" Ouvert ")
- elseif irisState == "Opening" then
- monup.setBackgroundColor(colors.orange)
- monup.write("Ouverture")
- end
- monup.setBackgroundColor(colors.gray)
- monup.setTextColor(colors.white)
- monup.setCursorPos(14,10)
- monup.write("Etat Porte :")
- monup.setBackgroundColor(colors.lightGray)
- monup.setCursorPos(14,11)
- monup.write(" ")
- monup.setCursorPos(26,11)
- monup.write(" ")
- monup.setCursorPos(15,11)
- if state == "Idle" then
- monup.setBackgroundColor(colors.green)
- monup.write(" Prêt ")
- elseif state == "Dialling" then
- monup.setBackgroundColor(colors.yellow)
- monup.write("Composition")
- elseif state == "Opening" then
- monup.setBackgroundColor(colors.orange)
- monup.write(" Ouverture ")
- elseif state == "Connected" then
- monup.setBackgroundColor(colors.green)
- monup.write(" Connecté ")
- elseif state == "Closing" then
- monup.setBackgroundColor(colors.orange)
- monup.write(" Fermeture ")
- elseif state == "Offline" then
- monup.setBackgroundColor(colors.red)
- monup.write("Déconnecté ")
- end
- monup.setCursorPos(28,3)
- monup.setBackgroundColor(colors.gray)
- monup.write("Chevrons :")
- monup.setBackgroundColor(colors.lightGray)
- monup.setCursorPos(28,4)
- monup.write(" ")
- monup.setCursorPos(38,4)
- monup.write(" ")
- if (state == "Dialing" or state == "Closing") then
- monup.setBackgroundColor(colors.orange)
- else
- monup.setBackgroundColor(colors.green)
- end
- monup.setCursorPos(29,4)
- monup.write(" "..engaged.." / 9 ")
- monup.setCursorPos(28,6)
- monup.setBackgroundColor(colors.gray)
- monup.write("Direction :")
- monup.setBackgroundColor(colors.lightGray)
- monup.setCursorPos(28,7)
- monup.write(" ")
- monup.setCursorPos(38,7)
- monup.write(" ")
- monup.setCursorPos(29,7)
- if direction == "Outgoing" then
- monup.setBackgroundColor(colors.green)
- monup.write(" Sortant ")
- elseif direction == "Incoming" then
- monup.setBackgroundColor(colors.red)
- monup.write(" Entrant ")
- elseif direction == "" then
- monup.setBackgroundColor(colors.orange)
- monup.write(" Aucune ")
- end
- monup.setBackgroundColor(colors.gray)
- monup.setCursorPos(28,9)
- monup.write("Composer :")
- monup.setBackgroundColor(colors.blue)
- monup.setCursorPos(28,10)
- monup.write(" ")
- monup.setCursorPos(28,11)
- monup.write(" ")
- monup.setCursorPos(38,10)
- monup.write(" ")
- monup.setCursorPos(38,11)
- monup.write(" ")
- monup.setBackgroundColor(colors.green)
- monup.setCursorPos(29,10)
- monup.write(" Prêt ")
- monup.setCursorPos(29,11)
- monup.write(" ")
- monup.setBackgroundColor(colors.lightGray)
- monup.setCursorPos(2,6)
- monup.write(" Energie de la porte : ")
- monup.setBackgroundColor(colors.gray)
- monup.setCursorPos(2,7)
- monup.write("Disponible:")
- monup.setBackgroundColor(colors.lightGray)
- monup.setCursorPos(2,8)
- monup.write(" ")
- monup.setBackgroundColor(colors.green)
- monup.setCursorPos(3,8)
- monup.write(" ")
- monup.setCursorPos(3,8)
- monup.setTextColor(colors.yellow)
- monup.write(tostring(energy))
- monup.setCursorPos(10,8)
- monup.setTextColor(colors.red)
- monup.write("EU")
- monup.setCursorPos(14,7)
- monup.setBackgroundColor(colors.gray)
- monup.setTextColor(colors.white)
- monup.write("Nécessaire :")
- monup.setBackgroundColor(colors.lightGray)
- monup.setCursorPos(14,8)
- monup.write(" ")
- monup.setBackgroundColor(colors.green)
- monup.setCursorPos(15,8)
- monup.write(" ")
- monup.setCursorPos(24,8)
- monup.setTextColor(colors.red)
- monup.write("EU")
- monup.setCursorPos(2,3)
- monup.setBackgroundColor(colors.gray)
- monup.write(" ")
- monup.setCursorPos(2,3)
- monup.setTextColor(colors.white)
- monup.write("Composition de la porte :")
- -----------------------------
- -- AFFICHAGE ECRAN UP --
- monup.setBackgroundColor(colors.black)
- monup.setTextColor(colors.white)
- monup.setCursorPos(1,2)
- monup.write("--------------------------O------------")
- monup.setCursorPos(27,3)
- monup.write("|")
- monup.setCursorPos(27,4)
- monup.write("|")
- monup.setCursorPos(27,5)
- monup.write("|")
- monup.setCursorPos(27,6)
- monup.write("|")
- monup.setCursorPos(27,7)
- monup.write("|")
- monup.setCursorPos(27,8)
- monup.write("|")
- monup.setCursorPos(27,9)
- monup.write("|")
- monup.setCursorPos(27,10)
- monup.write("|")
- monup.setCursorPos(27,11)
- monup.write("|")
- monup.setCursorPos(27,12)
- monup.write("|")
- ------------------------
- -- AFFICHAGE ECRAN SIDE --
- monside.setTextColor(colors.green)
- monside.setCursorPos(11,1)
- monside.write("Stargate")
- monside.setCursorPos(14,2)
- monside.write("DHD")
- -- PARTIE GAUCHE --
- monside.setCursorPos(2,2)
- monside.setBackgroundColor(colors.blue)
- monside.setTextColor(colors.white)
- monside.write("Private")
- -------------------
- -- PARTIE CENTRALE --
- if mainMenu == true then
- monside.setCursorPos(10,4)
- monside.setBackgroundColor(colors.green)
- monside.write(" Menu ")
- monside.setCursorPos(10,5)
- monside.write("Principale ")
- end
- ---------------------
- -- PARTIE DROITE --
- -------------------
- --------------------------
- sleep(0.05)
- end
Advertisement
Add Comment
Please, Sign In to add comment