Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Do not use
- local stop
- local function text(color)
- term.setTextColor(color)
- end
- local function color(colo)
- term.setBackgroundColor(colo)
- end
- local function pos(x, y)
- term.setCursorPos(x, y)
- end
- local function yellowScreen()
- color(colors.yellow)
- term.clear()
- pos(1,1)
- text(colors.white)
- color(colors.green)
- term.write("Cookie Browser")
- color(colors.lime)
- term.write(" ")
- color(colors.red)
- pos(51,1)
- term.write("X")
- pos(1,19)
- color(colors.lime)
- term.write(" ")
- pos(1,3)
- color(colors.lime)
- term.write(" ")
- pos(1,2)
- text(colors.black)
- term.write(" >")
- color(colors.white)
- term.write(" ")
- color(colors.lime)
- pos(50,2)
- term.write(" ")
- pos(5, 8)
- color(colors.yellow)
- text(colors.black)
- term.write("Yellow Screen of Death")
- pos(5, 10)
- term.write("Can't connect to webpage")
- pos(5, 12)
- term.write("The server computer is not loaded")
- pos(5, 13)
- term.write("or the webpage does not exist")
- end
- local function reset()
- term.clear()
- pos(1,1)
- text(colors.white)
- color(colors.green)
- term.write("Cookie Browser")
- color(colors.lime)
- term.write(" ")
- color(colors.red)
- pos(51,1)
- term.write("X")
- pos(1,19)
- color(colors.lime)
- term.write(" ")
- pos(1,3)
- color(colors.lime)
- term.write(" ")
- pos(1,2)
- text(colors.black)
- term.write(" >")
- color(colors.white)
- term.write(" ")
- color(colors.lime)
- pos(50,2)
- term.write(" ")
- end
- xPos = 0
- yPos = 0
- w, h = term.getSize()
- local function drawClock()
- color(colors.green)
- text(colors.white)
- if os.time() >= 10 then
- xTime = 47
- else
- xTime = 48
- pos(47, 19)
- io.write("0")
- end
- pos(xTime, 19)
- io.write(textutils.formatTime(os.time(), true))
- end
- local function events()
- event, p1, p2, p3 = os.pullEvent()
- if event == "rednet_message" then
- return p2
- end
- if event == "mouse_click" then
- xPos = p2
- yPos = p3
- button = p1
- browserClickPos()
- return "fail"
- end
- if event == "alarm" and stop == nil then
- drawClock()
- return "fail"
- end
- end
- function browserClickPos()
- if xPos == 51 and yPos == 1 then
- stop = true
- elseif xPos > 4 and xPos < 51 and yPos == 2 then
- pos(5,2)
- color(colors.white)
- term.write(" ")
- pos(5,2)
- text(colors.black)
- adress = read()
- rednet.send(serverID, adress)
- repeat
- id = events()
- until id
- if id ~= "fail" then
- rednet.send(id,1)
- repeat
- id2 = events()
- until id2
- end
- if id == "fail" or id2 == "fail" then
- yellowScreen()
- else
- local num = 1
- message = {}
- webInfo = {color = {}, text = {}, tColor = {}, pos = {x = {}, y = {}}}
- while message[6] == nil do
- rednet.send(id,num)
- id, message = rednet.receive()
- webInfo.color[num] = message[1]
- webInfo.text[num] = message[2]
- webInfo.tColor[num] = message[3]
- webInfo.pos.x[num] = message[4]
- webInfo.pos.y[num] = message[5]
- num = num + 1
- end
- color(message[6])
- reset()
- for i = 1,num-1 do
- color(webInfo.color[i])
- pos(webInfo.pos.x[i],webInfo.pos.y[i])
- text(webInfo.tColor[i])
- term.write(webInfo.text[i])
- end
- end
- end
- end
- local function clockUpdate()
- while stop == nil do
- if os.time() < 23.99 then
- os.setAlarm(os.time() + 0.01)
- else
- os.setAlarm(0)
- end
- events()
- end
- end
- if stop == nil then
- color(colors.white)
- reset()
- color(colors.green)
- text(colors.white)
- if os.time() >= 10 then
- xTime = 47
- else
- xTime = 48
- pos(47, 19)
- io.write("0")
- end
- pos(xTime, 19)
- io.write(textutils.formatTime(os.time(), true))
- clockUpdate()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement