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

Zirius

New member
Messages
261
Points
0
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!

 
Last edited by a moderator:
add a semi-colon at the end of .News$[0] array

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

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

 
Back
Top