Page 1 of 1
Random MOTD code
Posted: November 7th, 2011, 12:59 pm
by Jonty800
would it be possible to make the MOTD random by reading a random line from a .txt file?
Where abouts is the motd code part? lol
Re: Random MOTD code
Posted: November 7th, 2011, 6:19 pm
by Hellenion
for a Message Of The Day, it is being changed surprisingly little indeed.
Re: Random MOTD code
Posted: November 7th, 2011, 6:30 pm
by Jonty800
it all seems complicated because of the /env womid stuff.
I basically want to add a
Code: Select all
if file exists... read random line from motd.txt
else, use normal behaviour
I know how to do this, just not sure where.
Re: Random MOTD code
Posted: November 7th, 2011, 6:42 pm
by Hellenion
I'm guessing it's in Player.Networking around line 665, but I could be wrong.
Hold on...
Commit by fragmer :: r1219 /branch-0.60x/fCraft/ (2 files in 2 dirs):
Moved Player.Networking.cs from Player/ to Networking/. Derp.
I'm using old revisions...
Re: Random MOTD code
Posted: November 8th, 2011, 4:32 am
by Jonty800
I did the usual "search the entire project for motd"
each result looked confusing.
I'll look at it again tomorrow, and post any success I have
Re: Random MOTD code
Posted: November 8th, 2011, 11:16 am
by fragmer
Here's how MOTD works.
For the initial connection:
- If WoM extensions are enabled (ConfigKey.WoMEnableEnvExtensions), everyone is sent the WoM configuration link (&0cfg=IP:Prt/WorldName~motd"). WoM users have that replaced by the actual MOTD when they download the config from the server (produced by World.GenerateWoMConfig method).
- If WoM extensions are not enabled, everyone gets to see the MOTD (produced by Player.LoginSequence method).
For world changes, everyone gets to see "Loading world <WorldName>", but it's produced in different ways.
- If WoM extensions are enabled AND the player is using WoM, that message is produced by World.GenerateWoMConfig, from a separate thread.
- For everyone else, that message is produced by Player.JoinWorldNow, from the player's i/o thread.
There is also a Player.JoiningWorld event which allows changing those two lines of text that are shown during joining/loading. Note that if WoM extensions are enabled, the initial connection's MOTD must contain the config link. And if WoM extensions are enabled AND the player is using WoM, there is currently no easy event-based way to edit that message produced by World.GenerateWoMConfig. WoM complicates things :<
Re: Random MOTD code
Posted: November 11th, 2011, 4:29 am
by Jonty800
Thanks for the support, not worth the hassle
