Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Hi i am wv1106, the creator of wildroid
- -- If you while reading the code find any problems or bad practices please let me know
- -- I am self tought and still trying to learn =D
- local number = 0
- local password = "0000"
- local enterd = ""
- local bgColor = colors.cyan
- if fs.exists("password") then --reads the password
- local file = fs.open("password", "r")
- password = file.readAll()
- file.close()
- else
- local file = fs.open("password", "w")
- file.write("0000")
- file.close()
- end
- term.setBackgroundColor(bgColor) --paints the lockscreen
- term.clear()
- paintutils.drawFilledBox(5, 3, 9, 5, colors.lightGray)
- term.setCursorPos(7, 4)
- term.write("7")
- paintutils.drawFilledBox(12, 3, 16, 5, colors.lightGray)
- term.setCursorPos(14, 4)
- term.write("8")
- paintutils.drawFilledBox(19, 3, 23, 5, colors.lightGray)
- term.setCursorPos(21, 4)
- term.write("9")
- paintutils.drawFilledBox(5, 7, 9, 9, colors.lightGray)
- term.setCursorPos(7, 8)
- term.write("4")
- paintutils.drawFilledBox(12, 7, 16, 9, colors.lightGray)
- term.setCursorPos(14, 8)
- term.write("5")
- paintutils.drawFilledBox(19, 7, 23, 9, colors.lightGray)
- term.setCursorPos(21, 8)
- term.write("6")
- paintutils.drawFilledBox(5, 11, 9, 13, colors.lightGray)
- term.setCursorPos(7, 12)
- term.write("1")
- paintutils.drawFilledBox(12, 11, 16, 13, colors.lightGray)
- term.setCursorPos(14, 12)
- term.write("2")
- paintutils.drawFilledBox(19, 11, 23, 13, colors.lightGray)
- term.setCursorPos(21, 12)
- term.write("3")
- paintutils.drawFilledBox(12, 15, 16, 17, colors.lightGray)
- term.setCursorPos(14, 16)
- term.write("0")
- while 1 do --verifies the password
- local event = {os.pullEventRaw()} --os.pullEventRaw to stop terminating the program
- if event[1]=="mouse_click" then
- if event[2]==1 then
- number = 0
- if event[3]>=5 and event[3]<=9 then
- number = 1
- elseif event[3]>=12 and event[3]<=16 then
- number = 2
- elseif event[3]>=19 and event[3]<=23 then
- number = 3
- end
- if event[4]>=3 and event[4]<=5 then
- number = number+6
- elseif event[4]>=7 and event[4]<=9 then
- number = number+3
- elseif event[4]>=15 and event[4]<=17 then
- number = 0
- end
- enterd = enterd..tostring(number)
- end
- end
- if #enterd >= 4 then
- if enterd == password then
- break
- else
- os.reboot()
- end
- end
- end
- function redrawUI() --redraws the homepage
- term.setTextColor(colors.white)
- term.setBackgroundColor(bgColor)
- term.clear()
- term.setCursorPos(1, 1)
- paintutils.drawFilledBox(2, 8, 8, 12, colors.black)
- paintutils.drawLine(3, 9, 7, 9, colors.red)
- paintutils.drawLine(6, 10, 7, 10, colors.red)
- paintutils.drawLine(3, 11, 4, 11, colors.magenta)
- term.setBackgroundColor(bgColor)
- term.setCursorPos(2, 13)
- term.write("falling")
- paintutils.drawFilledBox(10, 2, 16, 6, colors.gray)
- paintutils.drawLine(13, 3, 13, 5, colors.white)
- paintutils.drawLine(12, 4, 14, 4, colors.white)
- paintutils.drawLine(11, 3, 15, 3, colors.white)
- term.setBackgroundColor(bgColor)
- term.setCursorPos(10, 7)
- term.write("update")
- paintutils.drawFilledBox(18, 2, 24, 6, colors.gray)
- paintutils.drawPixel(21, 3, colors.white)
- paintutils.drawPixel(22, 4, colors.white)
- paintutils.drawPixel(21, 5, colors.white)
- term.setBackgroundColor(bgColor)
- term.setCursorPos(20, 7)
- term.write("lua")
- paintutils.drawFilledBox(2, 2, 8, 6, colors.gray)
- paintutils.drawFilledBox(4, 5, 6, 5, colors.yellow)
- paintutils.drawPixel(4, 4, colors.lightGray)
- paintutils.drawPixel(6, 4, colors.lightGray)
- paintutils.drawLine(4, 3, 6, 3, colors.lightGray)
- term.setBackgroundColor(bgColor)
- term.setCursorPos(2, 7)
- term.write("pincode")
- paintutils.drawFilledBox(10, 8, 16, 12, colors.black)
- paintutils.drawLine(11, 9, 13, 9, colors.green)
- paintutils.drawPixel(15, 9, colors.red)
- term.setBackgroundColor(bgColor)
- term.setCursorPos(10, 13)
- term.write("snake")
- paintutils.drawLine(1, 20, 26, 20, colors.lightGray)
- term.setCursorPos(2, 20)
- term.write(textutils.formatTime(os.time("local")))
- end
- local event = {}
- function getKeyPress() -- a function for parallel on line 154
- event = {os.pullEventRaw()}
- return
- end
- function timeOut() -- a function for parallel on line 154
- sleep(1)
- return
- end
- while 1 do -- the main loop of the homepage
- redrawUI()
- event = {}
- parallel.waitForAny(getKeyPress, timeOut)
- if event[1]=="mouse_click" then
- if event[2]==1 then
- number = 0
- if event[3]>=2 and event[3]<=8 then
- number = 1
- elseif event[3]>=10 and event[3]<=16 then
- number = 2
- elseif event[3]>=18 and event[3]<=24 then
- number = 3
- else
- number = 0
- end
- if event[4]>=2 and event[4]<=6 then
- number = number
- elseif event[4]>=8 and event[4]<=12 then
- number = number+3
- else
- number = 0
- end
- if number == 1 then
- term.setBackgroundColor(bgColor)
- term.clear()
- paintutils.drawFilledBox(5, 3, 9, 5, colors.lightGray)
- term.setCursorPos(7, 4)
- term.write("7")
- paintutils.drawFilledBox(12, 3, 16, 5, colors.lightGray)
- term.setCursorPos(14, 4)
- term.write("8")
- paintutils.drawFilledBox(19, 3, 23, 5, colors.lightGray)
- term.setCursorPos(21, 4)
- term.write("9")
- paintutils.drawFilledBox(5, 7, 9, 9, colors.lightGray)
- term.setCursorPos(7, 8)
- term.write("4")
- paintutils.drawFilledBox(12, 7, 16, 9, colors.lightGray)
- term.setCursorPos(14, 8)
- term.write("5")
- paintutils.drawFilledBox(19, 7, 23, 9, colors.lightGray)
- term.setCursorPos(21, 8)
- term.write("6")
- paintutils.drawFilledBox(5, 11, 9, 13, colors.lightGray)
- term.setCursorPos(7, 12)
- term.write("1")
- paintutils.drawFilledBox(12, 11, 16, 13, colors.lightGray)
- term.setCursorPos(14, 12)
- term.write("2")
- paintutils.drawFilledBox(19, 11, 23, 13, colors.lightGray)
- term.setCursorPos(21, 12)
- term.write("3")
- paintutils.drawFilledBox(12, 15, 16, 17, colors.lightGray)
- term.setCursorPos(14, 16)
- term.write("0")
- enterd = ""
- while 1 do
- local event = {os.pullEventRaw()}
- if event[1]=="mouse_click" then
- if event[2]==1 then
- number = 0
- if event[3]>=5 and event[3]<=9 then
- number = 1
- elseif event[3]>=12 and event[3]<=16 then
- number = 2
- elseif event[3]>=19 and event[3]<=23 then
- number = 3
- end
- if event[4]>=3 and event[4]<=5 then
- number = number+6
- elseif event[4]>=7 and event[4]<=9 then
- number = number+3
- elseif event[4]>=15 and event[4]<=17 then
- number = 0
- end
- enterd = enterd..tostring(number)
- end
- end
- if #enterd >= 4 then
- password = enterd
- local file = fs.open("password", "w")
- file.write(enterd)
- file.close()
- break
- end
- end
- elseif number == 2 then
- shell.openTab("pastebin run Syw7kVuu")
- elseif number == 3 then
- shell.openTab("lua")
- elseif number == 4 then
- shell.run("rom/programs/pocket/falling.lua")
- elseif number == 5 then
- term.setBackgroundColor(colors.black)
- shell.run("rom/programs/fun/worm.lua")
- end
- end
- elseif event[1] == "key" then -- let's you exit the program
- if event[2] == keys.delete then
- term.setBackgroundColor(colors.black)
- term.setCursorPos(1, 1)
- term.clear()
- break
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement