Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function testLogIn()
- shell.run("clear")
- print(msg1)
- term.setCursorBlink(false)
- read()
- if msg == "YOU HAVE BEEN LOGGED IN" then
- loadRandomCrap()
- else
- loadRandomCrap()
- end
- end
- function requestFriends()
- rednet.send(37, crntname)
- end
- function testLogInTwo()
- shell.run("clear")
- print(msg2)
- term.setCursorBlink(false)
- read()
- loadRandomCrap()
- end
- function OpenAll()
- for _,side in ipairs(rs.getSides()) do
- rednet.open(side)
- end
- end
- function mineBook()
- cursor = "=> "
- w1 = "Search"
- w2 = "Change Status"
- w3 = "Friends"
- w4 = "Exit"
- min = 1
- max = 4
- cur = min
- function doThings2()
- if cur == 4 then
- runApp()
- elseif cur == 3 then
- OpenAll()
- loadRandomCrap2()
- elseif cur == 1 then
- logIn()
- elseif cur == 2 then
- makeUser()
- loadRandomCrap2()
- end
- end
- function loadRandomCrap2()
- OpenAll()
- term.clear()
- term.setCursorPos(1,1)
- print("|----------------------|")
- print("| MineBook 1.0 |")
- print("| in the beginning |")
- print("|----------------------|")
- if cur == 1 then
- term.setCursorPos(1,7)
- print(""..cursor..""..w1.."")
- else
- term.setCursorPos(1,7)
- print(w1)
- end
- if cur == 2 then
- term.setCursorPos(1,8)
- print(""..cursor..""..w2.."")
- else
- term.setCursorPos(1,8)
- print(w2)
- end
- if cur == 3 then
- term.setCursorPos(1,9)
- print(""..cursor..""..w3.."")
- else
- term.setCursorPos(1,9)
- print(w3)
- end
- if cur == 4 then
- term.setCursorPos(1,10)
- print(""..cursor..""..w4.."")
- else
- term.setCursorPos(1,10)
- print(w4)
- end
- end
- function runMineBook()
- loadRandomCrap2()
- while true do
- event, param1 = os.pullEvent()
- if event == "key" and param1 == 200 then
- if cur == min then
- cur = max
- loadRandomCrap2()
- else
- cur = cur-1
- loadRandomCrap2()
- end
- elseif event == "key" and param1 == 208 then
- if cur == max then
- cur = min
- loadRandomCrap2()
- else
- cur = cur+1
- loadRandomCrap2()
- end
- elseif event == "key" and param1 == 28 then
- doThings2()
- end
- end
- end
- runMineBook()
- end
- function split(str, pat)
- local t = { }
- local fpat = "(.-)"..pat
- local last_end = 1
- local s, e, cap = str:find(fpat, 1)
- while s do
- if s ~= 1 or cap ~= "" then
- table.insert(t,cap)
- end
- last_end = e+1
- s, e, cap = str:find(fpat, last_end)
- end
- if last_end <= #str then
- cap = str:sub(last_end)
- table.insert(t, cap)
- end
- return t
- end
- min = 1
- max = 4
- cur = min
- function makeUser()
- shell.run("clear")
- term.write("ENTER DESIRED USERNAME: ")
- term.setCursorPos(1,3)
- term.write("ENTER DESIRED PASSWORD: ")
- term.setCursorPos(1,5)
- term.write("RE-ENTER DESIRED PASSWORD: ")
- term.setCursorPos(26,1)
- dusrnm = read()
- term.setCursorPos(26,3)
- dpw = read("*")
- term.setCursorPos(29,5)
- rdpw = read("*")
- if dpw == rdpw then
- y = dusrnm.."!SP!"..dpw
- rednet.send(35, y)
- id2, msg2, d2 = rednet.receive()
- testLogInTwo()
- else
- shell.run("clear")
- print("PASSWORDS DO NOT MATCH")
- end
- end
- function logIn()
- shell.run("clear")
- term.write("ENTER USERNAME: ")
- term.setCursorPos(1,3)
- term.write("ENTER PASSWORD: ")
- term.setCursorPos(17,1)
- usrnm = read()
- term.setCursorPos(17,3)
- pswrd = read("*")
- x = usrnm.."!SP!"..pswrd
- rednet.send(34, x)
- id1, msg1, d1 = rednet.receive()
- if msg1 == "YOU HAVE BEEN LOGGED IN" then
- crntname = usrnm
- testLogIn()
- end
- testLogIn()
- end
- term.setCursorBlink(false)
- cursor = "=> "
- s1 = "Log In"
- s2 = "Make Account"
- s3 = "Open Rednet Ports"
- s4 = "Exit"
- function doThings()
- if cur == 4 then
- os.reboot()
- elseif cur == 3 then
- OpenAll()
- loadRandomCrap()
- elseif cur == 1 then
- logIn()
- elseif cur == 2 then
- makeUser()
- loadRandomCrap()
- end
- end
- function loadRandomCrap()
- OpenAll()
- term.clear()
- term.setCursorPos(1,1)
- print("|----------------------|")
- print("| MineBook 1.0 |")
- print("| in the beginning |")
- print("|----------------------|")
- if cur == 1 then
- term.setCursorPos(1,7)
- print(""..cursor..""..s1.."")
- else
- term.setCursorPos(1,7)
- print(s1)
- end
- if cur == 2 then
- term.setCursorPos(1,8)
- print(""..cursor..""..s2.."")
- else
- term.setCursorPos(1,8)
- print(s2)
- end
- if cur == 3 then
- term.setCursorPos(1,9)
- print(""..cursor..""..s3.."")
- else
- term.setCursorPos(1,9)
- print(s3)
- end
- if cur == 4 then
- term.setCursorPos(1,10)
- print(""..cursor..""..s4.."")
- else
- term.setCursorPos(1,10)
- print(s4)
- end
- end
- function runProgram()
- min = 1
- max = 4
- cur = min
- loadRandomCrap()
- while true do
- event, param1 = os.pullEvent()
- if event == "key" and param1 == 200 then
- if cur == min then
- cur = max
- loadRandomCrap()
- else
- cur = cur-1
- loadRandomCrap()
- end
- elseif event == "key" and param1 == 208 then
- if cur == max then
- cur = min
- loadRandomCrap()
- else
- cur = cur+1
- loadRandomCrap()
- end
- elseif event == "key" and param1 == 28 then
- if cur == 4 then
- break()
- else
- doThings()
- end
- end
- end
- end
- runProgram()
Add Comment
Please, Sign In to add comment