Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Bar()
- local w,h = term.getSize()
- local Lstart = 1 -- Start X von Loadingbar
- local Lende = 50 -- Ende X von Loadingbar
- local Lzeichen = "X" -- Zeichen was verwendet wird in Loadingbar
- local Lzeit = 0.2 -- Zeit die gebraucht wird
- local Lrstart = 1.0 -- Random zeit min
- local Lrende = 5.0 -- Random zeit max
- local mon = peripheral.wrap("right")
- function printCentred( y, s )
- local x = math.floor((w - string.len(s)) / 2)
- term.setCursorPos(x,y)
- term.clearLine()
- term.write( s )
- end
- function HorzLoadBar(sx, fx, sym, zeit, st, en)
- x,y = term.getCursorPos()
- if y >= 18 then
- term.clear()
- term.setCursorPos(sx,1)
- x,y = sx,1
- end
- term.setCursorPos(sx,y)
- write("[")
- term.setCursorPos(sx,y)
- term.setCursorPos(fx-1,y)
- write("]")
- mdp = math.floor((sx + fx)/2) - 5
- for i = (sx+1),(fx-2) do
- term.setCursorPos(i,y)
- write(sym)
- sleep(zeit-math.random(st,en)) -- random zeit
- term.setCursorPos(mdp,y+1)
- write(string.format("%d",i/(fx-2) * 100))
- write("%")
- end
- term.setCursorPos(1,y+2)
- end
- HorzLoadBar(Lstart, Lende, Lzeichen, Lzeit, Lrstart, Lrende)
- end
- function getfile()
- rednet.open("left")
- term.clear()
- term.setCursorPos(1,1)
- print("Getting Files..")
- while true do
- id,msg = rednet.receive()
- if msg == "RECEIVE" then
- id2,msg2 = rednet.receive()
- if fs.exists(msg2) then
- fs.delete(msg2)
- else
- f = fs.open(msg2, "w")
- id3,msg3 = rednet.receive()
- f.write(msg3)
- f.close()
- print("File "..msg2.." received!")
- file = fs.open("file", "r")
- mon.write(file.readAll())
- file.close()
- end
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- print("Got da file")
- sleep(5)
- shell.run("startup")
- end
- function c()
- term.clear()
- term.setCursorPos(1,1)
- end
- function start()
- c()
- print("Booting up!")
- Bar()
- getfile()
- end
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement