Jump to content
Aeromesi

MOTD Hourly - (Randomized MOTD's every Hour!)

Recommended Posts

Hey Hercules, @@Alexandria requested a script so I decided to make it.

 

Information:
[MOTD Hourly Randomizer]

 
So What exactly is my script 'MOTD Hourly Randomizer' :que:

/*  Advanced MOTD Hourly Script    Created by: Aeromesi    Idea from: Alexandria    Built for Hercules    Version 1.0    Special Feature: Randomized messages so that you'll never see the same message twice     Edit .@ServName$ variable to your servers name    Comments: To add more messages, change .@msgrand = (1,10) to your desired # of messages.    Also add the new messages in the if checks.*/



Just download the Attachment below.


Enjoy Hercules  :no1:

motd_hourly.zip

Share this post


Link to post
Share on other sites

hmm ...
 

initnpctimer("MOTD_HOURLY"),OnTimer3600000; 

https://github.com/HerculesWS/Hercules/blob/master/doc/script_commands.txt#L6370
Flag isn't refer to event/timer label.

You actually need to use attachnpctimer.

https://github.com/HerculesWS/Hercules/blob/master/doc/script_commands.txt#L6378

 

OnTimer3600000:        @cid = getcharid(0);        @aid = getcharid(3);

you can actually save these 2 variables when they login if you want to,   OnPCLoginEvent

No need to keep execute the same thing over and over again.

 

if( attachrid( @aid ) )    if( getcharid(0) == @cid ) 

I believe there is no need to check for these.  just use the OnTimerQuit event label to keep track whether they already offline or not and stop the timer.

 


 

You should try these methods ...

  • Array to store the announce messages.
  • use addtimer
  • avoid redundancy.
  • use Floating NPC.  (without valid location)

Share this post


Link to post
Share on other sites

it would be better if there a setting let the user chose if the announcement in  the array will be send randomly or in sequence

 

PS:

- Why not use OnMinute00, attaching timer to the user will take more ram since server keep the timer peruser CMIIW

Edited by Litro

Share this post


Link to post
Share on other sites
- script MOTD_HOURLY -1,{OnInit:	.@ServName$ = "YourRO";	setarray .announcements$,	"Hope you're having fun on "+ .@ServName$+"!",	"Please remember to review our "+ .@ServName$+", check the website for more information!",	"Remember, prolong periods of gameplay can cause serious health problems, take a breather! "+ .@ServName$+" can wait!",	"Type @commands to view a list of helpful tools to aid you in your adventure.",	"Don't forget to check the forums for the latest updates on "+ .@ServName$+"!",	"Remember, a GM will never ask for your username and password, always be safe.",	"Reminder, hackers, botters, exploiters will recieve a harsh punishment if caught. That is NOT tolerated here at "+ .@ServName$+".",	.@ServName$+" is very happy to have such a wonderful community!",	"Don't forget to Vote to gain Points!",	"Keep up the fun here at "+ .@ServName$+"!";	.announcements_size = getarraysize( .announcements$ );	.npc_name$ = strnpcinfo(0);	end;OnPCLoginEvent:	addtimer 3600000,.npc_name$+"::OnPCLoginEvent";	announce .announcements$[ rand( .announcements_size ) ],bc_self;end;}

 

or

-	script	MOTD_HOURLY	-1,{	OnPCLoginEvent:	addtimer 3600000,strnpcinfo(0)+"::OnPCLoginEvent";	.@ServName$ = "YourRO";	.@motd$ = F_Rand( 		"Hope you're having fun on "+ .@ServName$+"!",		"Please remember to review our  "+ .@ServName$+", check the website for more information!",		"Remember, prolong periods of gameplay can cause serious health problems, take a breather!  "+ .@ServName$+" can wait!",		"Type @commands to view a list of helpful tools to aid you in your adventure.",		"Don't forget to check the forums for the latest updates on  "+ .@ServName$+"!",		"Remember, a GM will never ask for your username and password, always be safe.",		"Reminder, hackers, botters, exploiters will recieve a harsh punishment if caught. That is NOT tolerated here at  "+ .@ServName$+".",		.@ServName$+" is very happy to have such a wonderful community!",		"Don't forget to Vote to gain Points!",		"Keep up the fun here at  "+ .@ServName$+"!"	);	announce .@motd$,bc_self;	end;}

Share this post


Link to post
Share on other sites

Thanks for fixing my script @@Emistry, I made this when I was too tired xD, all I found out that it worked for me, though maybe not optimized it worked xD

Share this post


Link to post
Share on other sites

@@Emistry

I almost going to write one, and your 2nd type is almost the same as the one I have in mind

give you 1 rep

 

but where is .npc_name$ ?

shouldn't it be strnpcinfo(0) ?

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.