Jump to content
  • 0
Sign in to follow this  
Zirius

[ Help ] Memory leak & loop bug at my minutely announcer for hercules

Question

Hello! I modified this script: http://rathena.org/board/topic/62184-can-someone-help-me-with-auto-broadcast-script/#entry119609

 

to work on Hercules, and instead of random, it would announce messages in order by array, here is what I manage to have:

 

-	script	News	-1,{OnInit:	set .Time,1;  // Announce every x Minutes.	setarray .News$[0], // Message to be Announced		"MSG 1",		"MSG 2",		"MSG 3",		"MSG 4",	set (.msgs, getarraysize(.News$));	set .NewsID,0;OnTimer5000: //for dev ~zirius//OnTimer60000:	initnpctimer;	set .Counter, .Counter + 1;	if (.Counter >= .Time) {		announce .News$[.NewsID], bc_all;		set .Counter, 0;		set .NewsID, .NewsID +1 ;			if (.NewsID == getarraysize(.News$)) {			set .NewsID,0;			}	}}

I fast track the time btw, the order of announcing the messages works great, but after the last message it announce "0", so there must be memory leak/loop bug, hope somebody can help me fix it.

 

Thanks!

 

P.S. Btw, how can I change broadcast color? LOL. thanks!

Edited by Zirius

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

add a semi-colon at the end of .News$[0] array

e.g. setarray .News$[0], "MSG1", "MSG2", "MSG3", "MSG4";

Edited by Poison

Share this post


Link to post
Share on other sites
  • 0

Its always that semi-colon. LOL.

 

Anyways for those who want to have minutely broadcaster at their server here is a fixed version:

 

-	script	News	-1,{OnInit:	set .Time,10;  // Announce every x Minutes.	setarray .News$[0], // Message to be Announced		"MSG 1",		"MSG 2",		"MSG 3",		"MSG 4";	set (.msgs, getarraysize(.News$));	set .NewsID,0;OnTimer60000:	initnpctimer;	set .Counter, .Counter + 1;	if (.Counter >= .Time) {		announce .News$[.NewsID], bc_all;		set .Counter, 0;		set .NewsID, .NewsID +1 ;			if (.NewsID == getarraysize(.News$)) {			set .NewsID,0;			}	}}

Current setting broadcast every 10 mins.

 

Goodluck!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

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