Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ Luke Beesley & Co. Work in Progress - File Created: 23/10/2014 ]]--
- --[[ INCLUDE FUNCTIONS ]]--
- --[[ Function to center text within the monitor attached to the terminal, the calculation is mathematically correct, thus the text is centered, however it does not seem this way when viewed in game ]]--
- local function writeCenter(var, lineNo)
- local x, y = m.getSize()
- local stringLength = string.len(var)
- local center = (x / 2) - (stringLength / 2)
- m.setCursorPos(center, lineNo)
- m.write(var)
- end
- --[[ Function to prepare the monitor for data ]]--
- local function monitorReset()
- m.clear()
- m.setCursorPos(1,1)
- m.setTextColor(colors.white)
- end
- --[[ Function to prepare the terminal for data ]]--
- local function terminalReset()
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.white)
- end
- --[[ CHECK DEPENDANCES ]]--
- --[[ Wrap the peripheral to the left of the computer ]]--
- if peripheral.isPresent("left") ~= true then
- terminalReset()
- term.setTextColor(colors.red)
- print("A monitor is not present to the left hand side of the terminal, please connect a monitor and let the program restart")
- print("**If your program does not restart or you have an error press and hold 'CTRL + R' for 1 second")
- print()
- print("Restarting in 5...")
- os.sleep(5)
- term.clear()
- os.sleep(1)
- term.setCursorPos(1,1)
- shell.run("test")
- else
- m = peripheral.wrap("left")
- end
- --[[ INITIALISE / DECLARE VARIABLES ]]--
- --[[currently empty ]]--
- --[[ START OF PROGRAM || DEPENDANCES CHECKED || FUNCTIONS INCLUDED || VARIABLES INITIALISED / DECLARED ]]--
- monitorReset()
- writeCenter("Welcome", 1)
- writeCenter("Please consult the terminal", 2)
- writeCenter("for more information", 3)
- terminalReset()
- print("Welcome to the secrurity protocol 3000!")
- print("Please follow on screen instructions below to continue!")
- print()
- print("Welcome user please enter your password")
- local input = read("*")
- if "password" == input then
- terminalReset()
- print("Thank you for inputting your password")
- print()
- print("Please wait...")
- os.sleep(3)
- print()
- print("security protocol lowered, access granted")
- else
- terminalReset()
- print("Error you have inputted the wrong password!")
- print("INTRUDER ALERT")
- print("The Program will now restart for safety")
- print()
- print("Restarting in 5...")
- os.sleep(5)
- term.clear()
- os.sleep(1)
- term.setCursorPos(1,1)
- shell.run("test")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement