Jump to content
  • 0

Can someone Help me with Auto Broadcast Script?


Pink Guy

Question


  • Group:  Members
  • Topic Count:  131
  • Topics Per Day:  0.03
  • Content Count:  371
  • Reputation:   3
  • Joined:  11/14/11
  • Last Seen:  

Uh I got a auto broadcast npc script but when I reloaded the script and restart the server (added to script_custom) nothing happens.. can someone help me edit it or tell me what's wrong? Do I need src edits and stuff?

- script News -1,{
OnInit:
set .Time,180;  // Announce every x Seconds.
setarray .News$[0], // Random Message to be Announced
 "Respect all the players of the server especially the GMs.",
 "Please report all bugs that you find immediately by using @request.",
 "Do not impersonate any player or GMs on the server.",
 "Reminder: GM's don't edit their characters(they don't have commands).",
 "Please Speak in English in the Maintown or suffer the consequences.",
 "Remember: Your Account and Items is your responsibility.",
		  "Welcome to your RO!!",
 "Whoever counquers the Opened Castles will get 30 Mithril Coins Per Guild",
 "No More Salary to the Losing Guilds, You now Support your own Guild",
while(1)
{
announce .News$[ rand( getarraysize( .News$ ) ) ],0;
sleep ( .Time * 1000 );
}
end;
}

Link to comment
Share on other sites

12 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  210
  • Reputation:   10
  • Joined:  11/20/11
  • Last Seen:  

Line 13:

"No More Salary to the Losing Guilds, You now Support your own Guild",

Should be:

"No More Salary to the Losing Guilds, You now Support your own Guild";

you lack semi-colon.

Edited by quesoph
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  45
  • Topics Per Day:  0.01
  • Content Count:  715
  • Reputation:   83
  • Joined:  01/05/12
  • Last Seen:  

Try this one i edit it into simplier form

-    script    News    -1,{
   end;
   OnMinute01:
   OnMinute02:
   switch(rand(1,9)) {
       case 1: announce "Respect all the players of the server especially the GMs.",bc_all,0xFFFF00; end;
       case 2: announce "Please report all bugs that you find immediately by using @request.",bc_all,0xFFFF00; end;
       case 3: announce "Do not impersonate any player or GMs on the server.",bc_all,0xFFFF00; end;
       case 4: announce "Reminder: GM's don't edit their characters(they don't have commands).",bc_all,0xFFFF00; end;
       case 5: announce "Please Speak in English in the Maintown or suffer the consequences.",bc_all,0xFFFF00; end;
       case 6: announce "Remember: Your Account and Items is your responsibility.",bc_all,0xFFFF00; end;
       case 7: announce "Welcome to your RO!!",bc_all,0xFFFF00; end;
       case 8: announce "Whoever counquers the Opened Castles will get 30 Mithril Coins Per Guild",bc_all,0xFFFF00; end;
       case 9: announce "No More Salary to the Losing Guilds, You now Support your own Guild",bc_all,0xFFFF00; end;
   }
   end;
}

Edited by Lelouch
  • Upvote 3
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  62
  • Topics Per Day:  0.01
  • Content Count:  137
  • Reputation:   0
  • Joined:  04/07/12
  • Last Seen:  

Try this one i edit it into simplier form

-	script	News	-1,{
end;
OnMinute01:
OnMinute02:
switch(rand(1,9)) {
	case 1: announce "Respect all the players of the server especially the GMs.",bc_all,0xFFFF00; end;
	case 2: announce "Please report all bugs that you find immediately by using @request.",bc_all,0xFFFF00; end;
	case 3: announce "Do not impersonate any player or GMs on the server.",bc_all,0xFFFF00; end;
	case 4: announce "Reminder: GM's don't edit their characters(they don't have commands).",bc_all,0xFFFF00; end;
	case 5: announce "Please Speak in English in the Maintown or suffer the consequences.",bc_all,0xFFFF00; end;
	case 6: announce "Remember: Your Account and Items is your responsibility.",bc_all,0xFFFF00; end;
	case 7: announce "Welcome to your RO!!",bc_all,0xFFFF00; end;
	case 8: announce "Whoever counquers the Opened Castles will get 30 Mithril Coins Per Guild",bc_all,0xFFFF00; end;
	case 9: announce "No More Salary to the Losing Guilds, You now Support your own Guild",bc_all,0xFFFF00; end;
}
end;
}

for what is the end on the TOP??

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  351
  • Reputation:   52
  • Joined:  11/15/11
  • Last Seen:  

No real purpose, however if you were to ever make this a visible npc in prontera for instance then nobody would be able to talk to it because the first line it executes is a finish line telling it to gtfo. In your current case however, the npc now showing up due to no location or sprite it isn't necessary or even important. could as well just remove it.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  36
  • Reputation:   0
  • Joined:  03/18/12
  • Last Seen:  

@Lelouch

That announcement just on first and second minute right?

so if i want it broadcast every 5 minute it'll be like this

OnMinute00:

OnMinute05:

OnMinute10:

OnMinute15:

OnMinute20:

OnMinute25:

OnMinute30:

OnMinute35:

OnMinute40:

OnMinute45:

OnMinute50:

OnMinute55:

CMIIW..

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

If you need something to loop for short periods of time, use "sleep <ms>", i.e.

OnInit:
while(1) {
 setarray .@messages$[0],
"your first message",
"second message",
"etc.";
 announce .@messages$[rand(getarraysize(.@messages$))],0;
 sleep 300000; }
end;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  131
  • Topics Per Day:  0.03
  • Content Count:  371
  • Reputation:   3
  • Joined:  11/14/11
  • Last Seen:  

Sorry. I'm kinda confused.. Can someone please help me with the sleep and stuff?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  50
  • Reputation:   4
  • Joined:  12/05/11
  • Last Seen:  

Basically all the code between the curly brackets of while(1) are looped infinitively.

If we look at the script snippet Euphy posted, you'll just have to add new messages to the .@messages$ array by adding a new line as shown.

Just make sure the last message ends in a semi-colon (;) instead of a comma (,).

Before:

while(1) {
setarray .@messages$[0],
      "your first message",
      "your second message",
      "etc";
 announce .@messages$[rand(getarraysize(.@messages$))],0;
 sleep 300000; }
end;

After:

while(1) {
setarray .@messages$[0],
      "your first message",
      "your second message",
      "etc",
      "more etc";
 announce .@messages$[rand(getarraysize(.@messages$))],0;
 sleep 300000; }
end;

Notice how the semi-colon needs to move to the end of the last message? Just keep this form and you'll have no problems. ---

The sleep <time in milliseconds>; command makes the script execution hold for a designated time in milliseconds.

Just to give you an idea of its purpose: if we were to remove the sleep <ms>; command, you'd theoretically

have announcements showing up in-game with crazy speeds as there is nothing to delay the endless loop.

Edited by Neblim
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.00
  • Content Count:  58
  • Reputation:   0
  • Joined:  06/14/12
  • Last Seen:  

-	   script  News    -1,{
    end;
    OnInit:
 while(1) {
 setarray .@messages$[0],
    "Welcome",
    "Support Us By Writing Review About Us On RMS",
 "Double Exp And Double Drops Going On";
 announce .@messages$[rand(getarraysize(.@messages$))],0;
 sleep 300000; }
end;

what is wrong with this i am getting error on 1st line

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  107
  • Reputation:   91
  • Joined:  01/19/12
  • Last Seen:  

-	   script  News	-1,{
	end;
	OnInit:
 while(1) {
 setarray .@messages$[0],
	"Welcome",
	"Support Us By Writing Review About Us On RMS",
 "Double Exp And Double Drops Going On";
 announce .@messages$[rand(getarraysize(.@messages$))],0;
 sleep 300000; }
end;

what is wrong with this i am getting error on 1st line

You should use something like this:

http://upaste.me/17b962711f0ecf9

The script fail when the header uses spaces instead tabs, btw, test this script.

Uh I got a auto broadcast npc script but when I reloaded the script and restart the server (added to script_custom) nothing happens.. can someone help me edit it or tell me what's wrong? Do I need src edits and stuff?

- script News -1,{
OnInit:
set .Time,180;  // Announce every x Seconds.
setarray .News$[0], // Random Message to be Announced
 "Respect all the players of the server especially the GMs.",
 "Please report all bugs that you find immediately by using @request.",
 "Do not impersonate any player or GMs on the server.",
 "Reminder: GM's don't edit their characters(they don't have commands).",
 "Please Speak in English in the Maintown or suffer the consequences.",
 "Remember: Your Account and Items is your responsibility.",
		  "Welcome to your RO!!",
 "Whoever counquers the Opened Castles will get 30 Mithril Coins Per Guild",
 "No More Salary to the Losing Guilds, You now Support your own Guild",
while(1)
{
announce .News$[ rand( getarraysize( .News$ ) ) ],0;
sleep ( .Time * 1000 );
}
end;
}

Test this version:

http://upaste.me/b5f7628232f67f3

Edited by Myzter
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.00
  • Content Count:  58
  • Reputation:   0
  • Joined:  06/14/12
  • Last Seen:  

Thanks :) Its Working Fine :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  131
  • Topics Per Day:  0.03
  • Content Count:  371
  • Reputation:   3
  • Joined:  11/14/11
  • Last Seen:  

Thank you mates.

Link to comment
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
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.

×
×
  • Create New...