Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Bonjour")
- print("Mots de Passe :")
- MDP = ""
- if MDP == "" then
- rednet.open("back")
- local termWidth, termHeight = term.getSize()
- local selectedItem = 1
- local onMainMenu = true
- function GereMoteur()
- term.clear()
- term.setCursorPos(1,1)
- mainMenu = {
- [1] = { text = "Four Stone", handler = FourStat },
- [2] = { text = "Sable", handler = SableStat },
- }
- main()
- sleep(1)
- end
- function SableStat()
- term.clear()
- term.setCursorPos(1,1)
- print("Four")
- mainMenu = {
- [1] = { text = "Allumer", handler = SableON },
- [2] = { text = "Arreter", handler = SableOFF },
- }
- main()
- sleep(1)
- end
- function SableON()
- term.clear()
- term.setCursorPos(1,1)
- print("Les pulverizer demare")
- rednet.send(70, 50)
- sleep(3)
- mainMenu = {
- [1] = { text = "Statut des Services", handler = GereMoteur },
- }
- main()
- end
- function SableOFF()
- term.clear()
- term.setCursorPos(1,1)
- print("Les pulverizer s'arretent")
- rednet.send(70, 57)
- sleep(3)
- mainMenu = {
- [1] = { text = "Statut des Services", handler = GereMoteur },
- }
- main()
- end
- function FourStat()
- term.clear()
- term.setCursorPos(1,1)
- print("Four")
- mainMenu = {
- [1] = { text = "Allumer", handler = FourON },
- [2] = { text = "Arreter", handler = FourOFF },
- }
- main()
- sleep(1)
- end
- function FourON()
- term.clear()
- term.setCursorPos(1,1)
- print("Les fours s'allument")
- rednet.send(70, 10)
- sleep(3)
- mainMenu = {
- [1] = { text = "Statut des Services", handler = GereMoteur },
- }
- main()
- end
- function FourOFF()
- term.clear()
- term.setCursorPos(1,1)
- print("Les fours s'arretent")
- rednet.send(70, 17)
- sleep(3)
- mainMenu = {
- [1] = { text = "Statut des Services", handler = GereMoteur },
- }
- main()
- end
- mainMenu = {
- [1] = { text = "Statut des Services", handler = GereMoteur },
- }
- function printMenu( menu )
- for i=1,#menu do
- if i == selectedItem then
- print("-> "..menu[i].text)
- else
- print(" "..menu[i].text)
- end
- end
- end
- function onKeyPressed( key, menu )
- if key == keys.enter then
- onItemSelected(menu)
- elseif key == keys.up then
- if selectedItem > 1 then
- selectedItem = selectedItem - 1
- end
- elseif key == keys.down then
- if selectedItem < #menu then
- selectedItem = selectedItem + 1
- end
- end
- end
- function onItemSelected( menu )
- menu[selectedItem].handler()
- end
- function main()
- while onMainMenu do
- term.clear()
- term.setCursorPos(1,1)
- printMenu(mainMenu)
- event, key = os.pullEvent("key")
- onKeyPressed(key,mainMenu)
- end
- end
- main()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement