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

Aeromesi

Custom Instance Maniac
Messages
821
Points
0
Age
33
Location
Custom Instances
Discord
Aeromesi#0293
Github
http://www.github.com/aeromesi
Emulator
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'
default_que.gif
/*  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 
default_no1.gif
motd_hourly.zip

 

Attachments

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)

 
Last edited by a moderator:
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

 
Last edited by a moderator:
- 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

Code:
-	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;}
 
Last edited by a moderator:
@@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) ?

 
Last edited by a moderator:
Back
Top