repeated announcement

orange

New member
Messages
127
Points
0
hello hercules

i want to make a specific announcement in my server every hour. i have 3 messages to  broadcast every 1 hour. 

i want each message to be announced once in 3 hours. eg if i i have message A, B and C. then 1st hour message A is announced , 2nd hour message B is announced and 3rd hour message C is announced and then the 4th hour again message A is announced and so on.

Please help me with such a script.

Thank you
default_smile.png


 
never tried this

- script news -1,{ OnInit:     set .Time,60;    // Announce every x Minute. setarray .News$[0], // Random Message to be announced "1 hi", "2 hello", "3 holla"; while(1){ if(getarraysize(.News$)==.xxx-1) set .xxx, 0; announce .News$[.xxx],bc_blue; set .xxx, .xxx + 1; sleep ( .Time * 60000 ); }}
edit from http://rathena.org/board/files/file/2503-random-news/

 
Last edited by a moderator:
Here's my method using the OnMinuteXX label as a trigger. It's a bit less effort and allows for virtually limitless amounts of announcements; when the last announcement has been made, it will repeat from the beginning on the next hour.

Code:
-	script	announce	-1,{	/*-----------------------------------------------------	Script	-----------------------------------------------------*/	OnInit:		// Announcement messages		setarray .news$[0],	"This is the first announcement.",							"This is the second announcement.",							"This is the third announcement.";				// Announcement options in corresponding order		setarray .options[0],	bc_all,								bc_all|bc_blue,								bc_all|bc_yellow;				end;			/*-----------------------------------------------------	Configuration	-----------------------------------------------------*/	OnMinute00:		announce .news$[.i], .options[.i];		.i++;				if (.i == getarraysize(.news$)) {			.i = 0;		}				end;}
 
Last edited by a moderator:
so do i have to change any value here except the "This is 1st announcement"   or  do i use it as it is?

 
You can set any number of announcements you want, just change the "This is the first announcement.", "This is the second announcement.", "This is the third announcement.", "4th", "5th"; and so on. The script adapts to any number of announcements you have. Remember last member of the array should end with a semicolon (
default_wink.png
, not a comma (,) and you're good to go.

 
Last edited by a moderator:
Back
Top