ID:148519
 
For some reason my code:

    Del()
..()
world.log = file("saves/log.txt")</DM

Doesnt save what users say into a log that I or the person running it can view...Can anyone help? Thanks in advance!

-Crio
Koolguy900095 wrote:
For some reason my code:

    Del()
> ..()
> world.log = file("saves/log.txt")

Doesnt save what users say into a log that I or the person running it can view...Can anyone help? Thanks in advance!

-Crio

I couldn't firuge this one out either, and gave up on the forums. I got so angry, I did this:
var/myLog
world/New()
myLog = file("theLog.txt")
myLog << "If this doesn't work, I'll explode."

And that worked for me, so...
In response to Nova2000
AHHH....It doesnt work...you would think that would work...
In response to Koolguy900095
Nova actually had the best idea in my opinion. I've never had much success with saving the world.log to an actual file. Besides, anything sent to the file will also go the host, so it'd more likely spam him/her. I'd suggest something like this:

var/Log_File 

world/New()
..()
Log_File = file("saves/log.txt")

mob/verb/say(msg as text)
//say verb coding
Log_File<<"[src] said [msg]"


Note: I haven't tested this, but it should more or less work =P

By the way, your main problem was that you used world.log = file(blah) in your world.del(). I assume you were expecting the contents of world.log to transfer into the file. That won't happen. If you wanted to do that, I'd suggest using fcopy(). Otherwise, just define your log file and write to it when needed.

In response to sapphiremagus
it works
In response to Zlegend2
How would i make it so when it creates the log it puts the date so i can have dif logs for different days...
In response to Koolguy900095
instead of
  Log_File = file("saves/log.txt")
put this:
  Log_File = file("saves/log[time2text(world.realtime,"DD MM YY")].txt")
. That will give you the date month and year. Look up time2text in the reference for more info.
[EDIT]
I have a question. Would it be world.realtime/10 since the time is in ticks? or maybe it doesnt matter for date?
In response to Koolguy900095
Working on a code for this, but what you want is world.realtime, look it up.
In response to Weedman
Weedman wrote:
instead of
  Log_File = file("saves/log.txt")
put this:
  Log_File = file("saves/log[time2text(world.time,"DD MM YY")].txt")
. That will give you the date month and year. Look up time2text in the reference for more info.

Use world.realtime, not world.time... world.time is the time server has been running... world.realtime is the actual date.