Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ Local Variables ]]--
- local termWidth, termHeight = term.getSize()
- local selectedItem = 1
- local inMainMenu = true
- --[[ Elevator Movement Methods ]]--
- function up()
- --shouldn't be needed but in case system needs reset
- --indiv. level computers handle going back
- redstone.setOutput("left",true)
- sleep(0.2)
- redstone.setOutput("left",false)
- end
- function down()
- redstone.setOutput("back",true)
- sleep(0.2)
- rs.setOutput("back",false)
- end
- function downMainFloor()
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.purple)
- print("Calling Elevator")
- for i = 1,6 do
- down()
- end
- print("Elevator has arrived, you have precisely 3 seconds to get on.")
- sleep(3)
- end
- --[[ Menu Methods ]]--
- function level45()
- downMainFloor()
- for i = 1, 2 do
- down()
- end
- end
- function level25()
- downMainFloor()
- for i = 1, 2 do
- down()
- end
- end
- function level10()
- downMainFloor()
- for i = 1, 2 do
- down()
- end
- end
- function exit()
- inMainMenu = false
- end
- --[[ Menu Definitions ]]--
- mainMenu = {
- [1] = { text = "Level 10:Best for Diamonds", handler = level10 } ,
- [2] = { text = "Level 25:Best for Lead/Silver" , handler = level25 } ,
- [3] = { text = "Level 45:Best for Copper" , handler = level45 } ,
- [4] = { text = "Exit" , handler = exit }
- }
- --[[ Printing Methods ]]--
- function printMenu( mainMenu )
- for i = 1,#mainMenu do
- if i == selectedItem then
- term.setTextColor(colors.red)
- print(mainMenu[i].text)
- else
- term.setTextColor(colors.white)
- print(mainMenu[i].text)
- end
- end
- end
- --[[ Handler Methods ]]--
- function onKeyPressed( key, mainMenu )
- if key == keys.enter then
- onItemSelected(mainMenu)
- elseif key == keys.up then
- if selectedItem > 1 then
- selectedItem = selectedItem - 1
- end
- elseif key == keys.down then
- if selectedItem < #mainMenu then
- selectedItem = selectedItem + 1
- end
- end
- end
- --[[ Main Methods ]]--
- function main()
- while inMainMenu do
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.white)
- printMenu(mainMain)
- event,key = os.pullEvent("key")
- onKeyPressed(key,menu)
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment