ID:152038
 
is their any better way to make a MOtD than this?? i dont really think so :P

:
mob/Login()
src.icon = 'mob.dmi'
alert(MOtD)
..()
var/MOtD = "Have fun, enjoy the game, and follow the rules!"
mob/verb/MOtD()
usr << MOtD
mob/GM/verb/set_MOtD(txt as text)
MOtD = txt
world<<"new MOtD = [MOtD]"


Its fast, simple, not alot of code, and any GM can readily change it to incorperate any short term player problems that a player would need to know upon logging in
I wouldn't do it in an alert box since they can be annoying and many users will just click OK right away without looking at anything. Also, I usually avoid using usr in mob/Login() as src will work fine and usr will not work in certain cases.

Also, instead of setting the message to a single line, it may be nice to have it multi-lined, just change
mob/GM/verb/set_MOtD(txt as text)

to
mob/GM/verb/set_MOtD(txt as message)


 world<<"new MOtD = [MOtD]"

I wouldn't send this to the whole world, probably just usr.

Lastly you might want to save the message to a file so it doesn't get lost after reboots. For this, look up the file2text() and text2file() procs.

You got the right idea, these are just some small suggestions to make everything better
In response to Nickr5
ok, i see what your saying, but if you send it to the whole world, they know its been changed, and if a rule has been added, Gm's dont get mad & boot players for not following the new rule... but ya i see what your saying lol
In response to RanEsu
Adding to what Nick said about saving you could also look into the ini reader library as it can be used for this and lets you have all set up variables in one place.
In response to RanEsu
If a new rule's added they could just announce it to everyone?
I make MOTD panels in my skins and position them so that the player sees them when they first log in. I put my MOTD at the top and let the host put theirs at the bottom.

I think sending the MOTD to some general text area is just asking for people to ignore it as spam. You should place it where people can get to it later.
RanEsu wrote:
is their any better way to make a MOtD than this?? i dont really think so :P

Oh, you're asking for it here. =P
--First off it's MotD, if you're going to consistently try to use a "grammatically proper" acronym then do it right. :P Message of the Day.

--You shouldn't be doing it in mob/Login(). Better do it in client/New(). Not to mention otherwise players would probably end up getting the message multiple times in a single logon.

--You shouldn't be setting the icon in Login(). It's even worse than it seems, since it will override the icon for every /mob a player connects to even if you've set a different one in the compile-time definition. Either way there isn't any reason to put it there instead of in the definition, also this doesn't have to do with MotD but you've put it here.

--As pointed out, you have 'usr abuse' in your alert() call.
Login() will normally be usr-safe, but not all of the time, and there isn't any reason not to use src instead which will always work; in this case you're using both mixed (src+usr) which is bad as well.

--The MotD verb should really be a client/verb. It should be always available regardless of what mob you're connected to, and it doesn't have anything to do with the mob either.

--Also, you could of course implement this better than an ugly alert() box and a message output to the regular text area (explained by ACWraith), implement fancy features such as text styles and including the key/name of the GM who edited the message and all sorts of stuff.