Jump to content

convert MOTD to a script


Brian

Recommended Posts


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

I'd like to suggest moving the Message Of The Day to a script with OnPCLoginEvent instead of !svn/bc/16928/trunk/conf/motd.txt

suggestion: trunk/npc/scripts_athena.conf

// --------------------------- MOTD -----------------------------
npc: conf/motd.txt // so people will find the MOTD script in the same place it's always been

// or should we go keep all NPCs in the same folder?
npc: npc/motd.txt

motd.txt

-	script	rathena_MOTD	-1,{
OnPCLoginEvent:
if (getbattleflag("display_version"))
	dispbottom "SVN version: " + get_revision();
dispbottom "Welcome to rAthena SVN! Enjoy! Please report any bugs you find.";

// add your custom MOTD messages and other script commands here:

end;
}

Advantages:

+ easier for server owners to customize

+ not limited to just displaying a message

+ they can trigger ANY script commands (ex: a common one, atcommand "@main on";)

+ (?) encourages new users learning rAthena to put all OnPCLoginEvent triggers in one file, thus avoiding "Event queue full" errors

Disadvantages:

- performance? loading one more npc script

- might still cause "Event queue full" errors if they already have a bunch of separate scripts with OnPCLoginEvent..

+ solution: load our MOTD script first, since it will not have any script commands that pause script execution

  • Upvote 5
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

There another disavantage that I can see

what if I had done something like a cron :

conf/motd.txt < news_on_forum

In short an automatic script tthat would read news somewhere and put them in MOTD for me, (like dunno why not fetch the last svn log message and put it there, if you doing that well could have a nice display)

Anyway with an npc that would require more skills to automate, (either remplace to npctxt by sed and such or link it to an extern file wich npc can't do atm...)

For this massive disavantage I'd vote "No" but we may add it as an npc too, or found another way.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

Ah good point.

Why didn't I think of putting news/svn updates in the MOTD like that? XD

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  427
  • Reputation:   123
  • Joined:  11/17/11
  • Last Seen:  

I think it is not a valid point.

IMO a better solution is, to pull the mesasage from SQL. I'm all for removing motd support and replacing it with a script. It is always better to get rid of redundant features. Futhermore scripts are much more flexible. The logging in is not a too frequent action, so I doubt it could become a performance bottleneck for any server.

Anyways I think the default value of the event queue is way to low.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

There other way of doing my example I agree.

You could just dump the message put it in sql table wich is read by npc IG and even have your log commit display automagically without reloading the npc etc.. ok

Still right now the way I see it, is simply taking off a feature for medium+ user.

They already can do a NPC like that on their own and probably already did something like that. But reading a common file and display it to the game that probably less common. So in short you taking away something "dunno how to do" for something pretty basic.

Like if one day I wanna read another file for display at a certain hour/event whatever. Assuming I'm intermediate I can just look MOTD behaviour and reproduce for a new event. Advance won't care much they'll fread...

Still the global idea is good but im just nor in favor to pure remplacement.

To encourage OnPC... in a same file the best thing would be to limit it in source to a certain premade file.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  427
  • Reputation:   123
  • Joined:  11/17/11
  • Last Seen:  

I do not like to add all the events to one file. It doesn't feel structured enough for me. At leas at my server I rather increase the size of the event queue, than forcing unstructured layout of scripts. Of course it is just my personal preference, probably others think differently.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  60
  • Topics Per Day:  0.01
  • Content Count:  174
  • Reputation:   3
  • Joined:  06/19/12
  • Last Seen:  

Would not do something for msg_athena.conf ?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

I don't get it Beret can you elaborate your point ?, If you ask if that will influence msg_athena.conf the awnser is no, not at all.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  60
  • Topics Per Day:  0.01
  • Content Count:  174
  • Reputation:   3
  • Joined:  06/19/12
  • Last Seen:  

I expressed badly, wanted to say it couldn't be done in msg_athena.conf

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  782
  • Reputation:   82
  • Joined:  01/01/12
  • Last Seen:  

So the main point is to let user customize it easily and encourage users to learn more script commands that can use with OnPCLoginEvent, so why not just a custom MOTD.txt in /custom/ folder (Which is disabled in default). Maybe a /doc/sample if /custom/npc is not 'so-good'.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  341
  • Reputation:   43
  • Joined:  01/10/12
  • Last Seen:  

It's a good idea to change MOTD into a script and we can get rid of @reloadmotd (@gmotd).

However, it would be a mess by putting all loginevent into one file.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  148
  • Reputation:   46
  • Joined:  11/02/11
  • Last Seen:  

It is good for me but what about the @reloadmotd thingy? When you do @reloadmotd the motd is displayed again i think.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

I should clarify - I didn't mean telling users to put every single OnPCLoginEvent in the same file; I meant combining ones that made sense. Ex: combine these 3 npcs into 1:

-	script	news1	-1,{
OnPCLoginEvent:
dispbottom "Welcome to <server name> RO! Have fun!";
end;
}
-	script	news2	-1,{
OnPCLoginEvent:
dispbottom "Reminder: WoE will start on Saturday Dec 1.";
dispbottom "WoE times are Sat 1pm - 2pm, Sunday 8am - 9am.";
dispbottom "Type @time to see the current server time."
end;
}
-	script	news3	-1,{
OnPCLoginEvent:
announce "New maps were added. Please patch your client!",bc_self|bc_blue;
end;
}

It is good for me but what about the @reloadmotd thingy? When you do @reloadmotd the motd is displayed again i think.

Yes you're right. With my suggestion @gmotd would probably be removed since the MOTD would not be restricted to text announcements anymore.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  44
  • Reputation:   48
  • Joined:  11/19/11
  • Last Seen:  

Couldn't we change it so if the MOTD is blank it just wouldn't show. That way if a user requires a more advanced MOTD they can disable the existing implementation still add their own thing using OnPCLoginEvent.

Having a script reference directly hardcoded into source feels very weird for me.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  713
  • Reputation:   70
  • Joined:  11/08/11
  • Last Seen:  

Couldn't we change it so if the MOTD is blank it just wouldn't show. That way if a user requires a more advanced MOTD they can disable the existing implementation still add their own thing using OnPCLoginEvent.

Having a script reference directly hardcoded into source feels very weird for me.

the best idea :P

Link to comment
Share on other sites


  • Group:  Forum Manager
  • Topic Count:  282
  • Topics Per Day:  0.06
  • Content Count:  3122
  • Reputation:   1614
  • Joined:  03/26/12
  • Last Seen:  

I like Brian's original post. If we had it set out as an NPC script then there's no difference, then if users don't want it they can comment out the npc: npc/motd.txt line. This may give users who are not quite so confident a little push in the right direction for modifying their MOTD instead of leaving it default or removing it completely.

  • Upvote 1
Link to comment
Share on other sites

  • 1 month later...

  • Group:  Developer
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1443
  • Reputation:   337
  • Joined:  10/17/12
  • Last Seen:  

I've always used a MOTD script and not the txt in the conf I find it far easier and more customized

@Toasterofdoom, I'm assuming if we implemented this we would remove and hardcore reference to the script.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...