-- I HIGHLY SUGGEST YOU CHECK OUT http://pastebin.com/cnmnNznF (BY "revereddesecration"). IT'S A RESTRUCTURED SCRIPT OF THIS AND MY 2 OTHER SCRIPTS.

c = peripheral . wrap ( "left" ) -- This wraps the chatbox, change variable and side to whatever you use.

s = peripheral . wrap ( "right" ) -- This wraps the speaker, change variable and side to whatever you use.

range = 100000

lang = "en"

name = "Jacklin" -- Name/Prefix used for the chat messages, if it doesn't work check your config!

-- Commands config (You can also delete this and just specify the commands in the main loop)

local timeCommand = ".time" -- for giving the time in your minecraft world

local timePlayedCommand = ".played" -- for giving the amount of ingame days you have played in your world

local exitCommand = ".exit" -- Not really necessary, this will terminate the main loop. Can be useful if you wish to terminate the program from a distance.

while true do -- Main loop starts here

e , player , Message = os . pullEvent ( "chat" )

if Message == timeCommand then

local time = os.time ( )

local formattedTime = textutils . formatTime ( time , false ) -- This is to convert the time into something that makes more sense

c . say ( "It is " .. formattedTime , range , false , name )

s . speak ( "It is " .. formattedTime , range , lang )

elseif Message == timePlayedCommand then -- Feel free to edit/add the special messages at certain days

day = os . day ( )

if day == 1 then

c . say ( "You have only been playing for 1 day and you already made me. Good job!" , range , false , name )

s . speak ( "You have only been playing for 1 day and you already made me. Good job!" , range , lang )

elseif day == 7 then

c . say ( "You have been playing for 1 week now!" , range , false , name )

s . speak ( "You have been playing for 1 week now!" , range , false , name )

elseif day == 365 then

c . say ( "You have been playing for 1 year?! You are truly amazing!" , range , false , name )

s . speak ( "You have been playing for 1 year?! You are truly amazing!" , range , false , name )

else

c . say ( "You have been playing for " .. day .. " days" , range , false , name )

s . speak ( "You have been playing for " .. day .. " days" , range , lang )

elseif Message == exitCommand then

c . say ( "Shutting Down" , range , false , name )

s . speak ( "Shutting Down" , range , lang )

return

end