Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local term = require("term")
- local os = require("os")
- local component = require("component")
- local event = require("event")
- username = "roxox1"
- password = "reece"
- isLoggedIn = false
- function clear()
- term.clear()
- end
- function login()
- if isLoggedIn == true then mainMenu() end --In case we somehow get here by mistake
- clear()
- print("Username: ")
- usernameentered = io.read()
- print("Password: ")
- passwordentered = io.read()
- if usernameetered == username then
- if passwordentered == password then
- isLoggedIn = true
- end
- end
- if isLoggedIn == true then mainMenu() end
- if isLoggedIn == false then print("Nope") os.sleep(2) login() end
- end
- function mainMenu()
- clear()
- print("--------------------")
- print("(1) Check resources")
- print("(2) Craft items")
- print("(3) Check Power")
- print("(4) Logout")
- print("(5) Close Program")
- print("--------------------")
- input = io.read()
- if input == "1" then checkResources() end -- Check resources
- if input == 2 then print("(2)") end -- Craft Items
- if input == '3' then checkPower() end
- if input == '4' then logout() end
- if input == '5' then closeProgram() end
- end
- function checkResources()
- itemTable = {}
- print("Opening listening port 888..")
- if component.modem.open(888) then
- print("Port 888 is open.")
- else
- print("Something went wrong :(")
- component.modem.close(888)
- mainMenu()
- end
- local function addItemsToTable(_, _, _, _, _, itemData)
- myTable = serialization.unserialize(itemData)
- for x,y in pairs(myTable) do print(key, value) end
- end
- event.listen("modem_message", addItemsToTable)
- a = io.read()
- end
- function checkPower()
- clear()
- print(component.RotationalDynamo.getPower())
- e = io.read()
- mainMenu()
- end
- function logout() -- Logout
- isLoggedIn = false
- login()
- end
- function closeProgram() -- Close Program
- clear()
- end
- mainMenu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement