Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- CC ftpChatUpload
- Uploads the game conversation to an FTP .txt file
- Created by VintageRice
- Completed: December 7th 2013
- --]]
- --Setting up the variables
- chatBox = peripheral.wrap("right")
- fileName = "tempLog"
- ftpSite = "ftp://[email protected]@91.208.99.4/public_html/ftp_items/ftbLog.txt"
- maxString = 50
- --Recording the games chat
- function recordChat()
- stringCount = 0
- tempLog = fs.open(fileName, "a")
- while true do
- term.clear()
- term.setCursorPos(1, 1)
- print((maxString - stringCount).." strings until upload")
- if stringCount == maxString then
- stringCount = 0
- tempLog.close()
- uploadLog()
- end
- event, player, message = os.pullEvent("chat")
- if message ~= " " then
- tempLog.writeLine("[ "..player.." ] "..message)
- stringCount = stringCount + 1
- end
- end
- end
- --Uploads to your ftp file
- function uploadLog()
- term.clear()
- term.setCursorPos(1, 1)
- if http.request() ~= true then
- print("Error connecting to: "..ftpSite)
- sleep(1000)
- recordChat()
- else
- print("Reading contents of: "..fileName)
- getContents = fs.open(fileName, "r")
- toUpload = getContents.readAll()
- getContents.close()
- print("Uploading to: "..ftpSite)
- http.post(ftpSite, "data="..textutils.urlEncode(tostring(toUpload)))
- recordChat()
- end
- end
- recordChat()
Advertisement
Add Comment
Please, Sign In to add comment