RPG Starter

by Falacy
An Open Source Demo/Game with everything you'll need to get started on your very own BYOND Game!
ID:292219
 
I'm just practicing with world.log.

Is this a "good" way to use it, or am i just over complicating it?

var/time = "([time2text(world.realtime,"MMM DD")])"

mob
Login()
var/arr = "<B>[src] has joined"
world << arr
world.log = file("Login.txt")
world.log << time + " " + arr

Logout()
var/log = "<B>[src] has left"
world << log
world.log = file("Logout.txt")
world.log << time + " " + log
That time var will only be set a single time when the game starts up. "arr" is a horrible variable name that you will hate yourself for, if you have to go back through the code. The output/log part seems overcomplicated.
In response to Falacy
Falacy wrote:
That time var will only be set a single time when the game starts up.

Are you saying that if i host it, and it's up for a day, it would still say "Feb 25" instead of "Feb 26"?

"arr" is a horrible variable name that you will hate yourself for, if you have to go back through the code.

This is a learning experience for me, thanks for the tip :p. I'll change them to "join" and "left" then, understandable and easy to remember.

The output/log part seems overcomplicated.

Meh, that's the whole reason i posted this, to see if there was a simpler way to do it. It works just fine, though.
In response to Exonit
Exonit wrote:
Are you saying that if i host it, and it's up for a day, it would still say "Feb 25" instead of "Feb 26"?

Yes

Meh, that's the whole reason i posted this, to see if there was a simpler way to do it. It works just fine, though.

Have you actually tested it with multiple logins to a single hosted session? It seems like it would get pointlessly spammy and uninformative.
Also, you shouldn't use the world.log like that for general messages, since it also stores runtime errors. I'm not sure why you even need a log for simple log in/out messages.
In response to Falacy
Falacy wrote:
Have you actually tested it with multiple logins to a single hosted session? It seems like it would get pointlessly spammy and uninformative.
Also, you shouldn't use the world.log like that for general messages, since it also stores runtime errors. I'm not sure why you even need a log for simple log in/out messages.

Hm, I'll see if i can. I don't, this is to learn how to actually log stuff (like if someone uses Say it would log their message).
In response to Exonit
In response to Falacy
Falacy wrote:
http://www.byond.com/ members/?command=reference&path=proc%2Ftext2file

After staring at and reading it, i came up with:

mob/verb/Say(t as text)
world << "[src]: [t]"
text2file("[src]: [t]","Say.txt")


Now it works and all, it creates "Say.txt" and it put in the message every other line, but would it end up getting mixed up? If not, =P.

I'm only asking because i don't have access to my router to open up a port for BYOND.