Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("eAPI")
- os.loadAPI("json")
- local allmsg={}
- function writeHex(color,txt)
- local colorBank={FF55FF={colors.pink}}--,AA0000=colors.red,00AA00=colors.green,00AAAA=colors.cyan,000000=colors.black}
- if color and txt then
- term.setTextColor(colorBank[color])
- write(txt)
- term.setTextColor(colors.white)
- end
- end
- writeHex(FF55FF,txt)
- function main()
- local x=http.get("http://tekkit.craftersland.net:25800/up/world/world/").readAll()
- local data=json.decode(x)
- for _,x in pairs(data['updates']) do
- if x["type"]=="chat" and not eAPI.table_contains(allmsg,x["playerName"].." | "..x["message"]) then
- local lines={}
- f=fs.open("chat.temp","w")
- f.write(x["playerName"]:gsub("'>","'\n>"))
- f.close()
- for tmp in io.lines("chat.temp") do lines[#lines+1]=tmp end
- for _,ln in pairs(lines) do
- local color=ln:match("color:#(.-)'")
- local msg=ln:match(">(.-)<")
- end
- print(x["account"].." | "..x["message"])
- eAPI.tbInsert(allmsg,x["playerName"].." | "..x["message"])
- elseif x["type"]=="playerjoin" and not eAPI.table_contains(allmsg,x["account"].." has joined the game.") then
- eAPI.cprint(x["account"].." has joined the game.",colors.orange)
- eAPI.tbInsert(allmsg,x["account"].." has joined the game.")
- elseif x["type"]=="playerquit" and not eAPI.table_contains(allmsg,x["account"].." has left the game.") then
- eAPI.cprint(x["account"].." has left the game.",colors.orange)
- eAPI.tbInsert(allmsg,x["account"].." has left the game.")
- end
- end
- end
- while true do
- main()
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment