Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Program by Simlor (http://www.computercraft.info/forums2/index.php?/user/55655-simlor/)
- function Download(CodePB, Pfad)
- local cacheBuster = ("%x"):format(math.random(0, 2 ^ 30))
- local datei = http.get("https://pastebin.com/raw/" .. textutils.urlEncode(CodePB) .. "?cb=" .. cacheBuster)
- datei = datei.readAll()
- local file = fs.open(Pfad, "w")
- file.write(datei)
- file.close()
- end
- --Random Background
- BC(128)
- Clear()
- TC(SystemColor)
- CP(1,1)
- print("Random Background Program!")
- TC(1)
- CP(1,3)
- print("Generate a number...")
- sleep(1)
- Download("JTBbFypQ", "BacklisteTEMP")
- file = fs.open("BacklisteTEMP","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- MAXC = fileData[1]
- MAXC = (MAXC+0)
- number = math.random(3,MAXC)
- CP(1,4)
- print("You got the number... "..(number-2).."!")
- CP(1,5)
- print("Downloading Background...")
- fs.delete("SimSoft/Data/Background")
- Download((fileData[number]),"SimSoft/Data/Background")
- TC(SystemColor)
- CP(1,7)
- print("Here is your 'new' background!")
- sleep(2)
- --end
Add Comment
Please, Sign In to add comment