Jump to content
  • 0

Additional Feature for my own Broadcaster NPC


Gidz Cross

Question


  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.03
  • Content Count:  640
  • Reputation:   82
  • Joined:  04/07/14
  • Last Seen:  

Hello rathena folks. Ive been using this broadcaster npc of mine way back year 2014. Now i would like to update its feature.

prontera,187,210,3	script	Broadcaster#1::BC	894,{
	
	set @npcname$, "^FF9300 Broadcaster ^000000";
	set @header$,"[^0000ff" + @npcname$ + "^000000]";
	set broadcastfee, 3000000;

	mes @header$;
	mes "Hi, I'm the Broadcaster.";
	mes "I can Broadcast a message for you.";
	mes " ";
	mes " ";
	mes " ";
	mes "It costs ^ff0000"+ broadcastfee +"^000000 zeny.";
	next;
	mes @header$;
	mes "Would you like to Broadcast?";
	next;
	switch (select("Yes","Nevermind")){
	case 1:
		if(Broadcast> gettimetick(2)) {
		mes @header$;
		mes "Sorry you have to wait for 1 min.";
		close;
		}
		mes @header$;
		if(Zeny<3000000) goto $nozenybc;
		set Zeny,zeny - broadcastfee;
		mes "Please input your message.";
		next;
		input broadcast$;
		announce "Shout from "+strcharinfo(0)+": "+broadcast$+"",0,0x5AFF00; // Edit 5AFF00 for color code HTML Color Code
		close2;
		set Broadcast, gettimetick(2)+60; //Timer 60 = 1 minute/s
		dispbottom "Broadcaster: Please wait for 1min until next broadcast to avoid flooding.";
		end;
	case 2:
		mes @header$;
		mes "Suit yourself.";
		close;
}

	$nozenybc:
		mes "You don't have enough zeny.";
		close;
}

^ This is the script. Simple Broadcaster NPC with a fee for every broadcast.

Now there's this Ragnarok Server that using somehow similar NPC. Yet, they have 3rd option. Its called Automated Broadcast. Check my screenies below.
image.png.48331fa720cfb1a85e64e1b783cc8120.png

This is the broadcaster NPC with Auto Broadcast menu. (see the rest of the screenshot below to see how the NPC's behavior)

image.png.b08ec525bfe2cc9dbead08259aa60fed.png
 

image.png.c395a6b4e718b944b8f2becbd6bda25e.png

image.png.1fcdf56518310cfafa8f75589f31bd58.png
After you input your desired number you can review it to proceed or not.

image.png.40b87b2bb10961ae3423e12de683f725.png
 

Annie made me a script which is similar to this one. Can be used as a case 3. But i dont know how to link it to my current script. Also, its asking for item. I cant make it to ask for zeny. Here's what annie wrote.
 

prontera,155,185,5    script    sjdfsdlf    1_F_MARIA,{
    mes "input your broadcast message";
    mes "each broadcast use 1 "+ F_MesItemInfo(Poring_Coin);
    if (!countitem(Poring_Coin))
        close;
    next;
    input .@text$;
    mes "input how many times to broadcast";
    next;
    input .@num;
    if (countitem(Poring_Coin) < .@num) {
        mes "you don't have enough "+ F_MesItemInfo(Poring_Coin);
        close;
    }
    mes "after closing this dialog box I'll start broadcast";
    close2;
    if (countitem(Poring_Coin) < .@num) { // hacking recheck
        mes "you don't have enough "+ F_MesItemInfo(Poring_Coin);
        close;
    }
    delitem Poring_Coin, .@num;
    while (.@loop++ < .@num) {
        announce .@text$, bc_all;
        sleep 1000;
    }
    end;
}



Thank you so much!

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  658
  • Reputation:   663
  • Joined:  11/12/12
  • Last Seen:  

Your initial script has some oddities (regarding variable scope). Hmm, I see a few things you'd probably to worry about with the proposed solution:

  • A player can do multiple auto announces.
  • There is no way of tracking the active announcements.
  • Once the auto announce is bought, it is fully detached from the player and cannot be linked back to him.
  • The announces will get lost on script reload/server reboots. You'd probably want to use global arrays and have the announces displayed with a OnTimer1000 checks instead.

With that being said, the following is probably what you're looking for. I personally prefer to have the loop on a separate event, but the end result is very similar in this case.

prontera,187,210,3	script	Broadcaster#1::BC	894,{
	.@npcname$ = "^FF9300 Broadcaster ^000000";
	.@header$ = "[^0000ff" + .@npcname$ + "^000000]";

	mes .@header$;
	mes "Hi, I'm the Broadcaster.";
	mes "I can Broadcast a message for you.";
	mes " ";
	mes " ";
	mes " ";
	mes "It costs ^ff0000" + .broadcastfee + "^000000 zeny.";
	next;
	mes .@header$;
	mes "Would you like to Broadcast?";
	next;
	
	switch (select("Yes:Nevermind:Auto-broadcast")) {
		case 1:
			if (Broadcast > gettimetick(2)) {
				mes .@header$;
				mes "Sorry you have to wait for 1 min.";
				close;
			}
			
			if (Zeny < .broadcastfee) {
				goto L_NotEnoughZeny;
			}
			
			mes .@header$;
			mes "Please input your message.";
			next;
			input .@broadcast$;
			Zeny -= .broadcastfee;
			announce "Shout from " + strcharinfo(0) + ": " + .@broadcast$ + "", 0, 0x5AFF00; // Edit 5AFF00 for color code HTML Color Code
			Broadcast = gettimetick(2) + 60; //Timer 60 = 1 minute/s
			dispbottom "Broadcaster: Please wait for 1min until next broadcast to avoid flooding.";
			end;
		case 2:
			mes .@header$;
			mes "Suit yourself.";
			close;
		case 3:
			mes .@header$;
			mes "Hi, I can automatically broadcast messages for you!";
			mes "It will cost you ^ff0000" + .auto_broadcastfee + "^000000 zeny per broadcast.";
			next;
			
			switch(select("Proceed:Check status:Exit")) {
				case 1:
					mes .@header$;
					mes "Please input your message.";
					next;
					input .@broadcast$;
					mes .@header$;
					mes "How many times do you want to broadcast?";
					mes "Min: 1";
					mes "Max: 100";
					next;
					input .@repeat, 1, 100;
					
					if (.@repeat < 1 || .@repeat > 100) {
						mes .@header$;
						mes "Suit yourself.";
						close;
					}
					
					.@cost = .auto_broadcastfee * .@repeat;
					
					mes .@header$;
					mes "You want to broadcast:";
					mes "^ff0000" + .@broadcast$ + "^000000";
					mes "Every 3 minutes for ^00ff00" + .@repeat + "^000000 time(s)?";
					mes "It will cost you a total of ^ff0000" + .@cost + "^000000 zeny.";
					next;
					
					switch(select("Proceed:Cancel")) {
						case 2:
							mes .@header$;
							mes "Suit yourself.";
							close;
					}
					
					if (Zeny < .@cost) {
						goto L_NotEnoughZeny;
					}
					
					Zeny -= .@cost;
					$@bc_announce$ = "Shout from " + strcharinfo(0) + ": " + .@broadcast$;
					$@repeat = .@repeat;
					donpcevent strnpcinfo(3) + "::OnAutoAnnounce";
					close;
				case 2:
					// ??
					end;
				case 3:
					mes .@header$;
					mes "Suit yourself.";
					close;
			}
			
			close;
	}
	
	end;
L_NotEnoughZeny:
	mes .@header$;
	mes "You don't have enough zeny.";
	close;
OnAutoAnnounce:
	.@repeat = $@repeat;
	.@broadcast$ = $@bc_announce$;
	
	while (.@repeat > 0) {
		announce .@broadcast$, 0, 0x5AFF00; // Edit 5AFF00 for color code HTML Color Code
		sleep 180000;
		.@repeat--;
	}
	
	end;
OnInit:
	.broadcastfee = 3000000;
	.auto_broadcastfee = 500000;
	end;
}

 

Edited by Tokei
  • Love 1
  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

1 hour ago, Tokei said:
  • A player can do multiple auto announces.
  • There is no way of tracking the active announcements.
  • Once the auto announce is bought, it is fully detached from the player and cannot be linked back to him.
  • The announces will get lost on script reload/server reboots. You'd probably want to use global arrays and have the announces displayed with a OnTimer1000 checks instead.

 

yes originally I was also thinking about storing it on SQL table or using a $PERMANENT_GLOBAL_ARRAY so can GM can track which announcement are still being queue
or deny the same player from using auto-broadcast over and over,
but somehow I went for the easier route and do things that is easier to be made ... probably because he didn't pay me to do it so I made it easy hahaha

initnpctimer and sleep doesn't persist after server reboots, I think the only way is use OnMinute00: OnMinute03: ... OnMinute57: ... ?

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.03
  • Content Count:  640
  • Reputation:   82
  • Joined:  04/07/14
  • Last Seen:  

7 hours ago, Tokei said:

Your initial script has some oddities (regarding variable scope). Hmm, I see a few things you'd probably to worry about with the proposed solution:

  • A player can do multiple auto announces.
  • There is no way of tracking the active announcements.
  • Once the auto announce is bought, it is fully detached from the player and cannot be linked back to him.
  • The announces will get lost on script reload/server reboots. You'd probably want to use global arrays and have the announces displayed with a OnTimer1000 checks instead.

With that being said, the following is probably what you're looking for. I personally prefer to have the loop on a separate event, but the end result is very similar in this case.


prontera,187,210,3	script	Broadcaster#1::BC	894,{
	.@npcname$ = "^FF9300 Broadcaster ^000000";
	.@header$ = "[^0000ff" + .@npcname$ + "^000000]";

	mes .@header$;
	mes "Hi, I'm the Broadcaster.";
	mes "I can Broadcast a message for you.";
	mes " ";
	mes " ";
	mes " ";
	mes "It costs ^ff0000" + .broadcastfee + "^000000 zeny.";
	next;
	mes .@header$;
	mes "Would you like to Broadcast?";
	next;
	
	switch (select("Yes:Nevermind:Auto-broadcast")) {
		case 1:
			if (Broadcast > gettimetick(2)) {
				mes .@header$;
				mes "Sorry you have to wait for 1 min.";
				close;
			}
			
			if (Zeny < .broadcastfee) {
				goto L_NotEnoughZeny;
			}
			
			mes .@header$;
			mes "Please input your message.";
			next;
			input .@broadcast$;
			Zeny -= .broadcastfee;
			announce "Shout from " + strcharinfo(0) + ": " + .@broadcast$ + "", 0, 0x5AFF00; // Edit 5AFF00 for color code HTML Color Code
			Broadcast = gettimetick(2) + 60; //Timer 60 = 1 minute/s
			dispbottom "Broadcaster: Please wait for 1min until next broadcast to avoid flooding.";
			end;
		case 2:
			mes .@header$;
			mes "Suit yourself.";
			close;
		case 3:
			mes .@header$;
			mes "Hi, I can automatically broadcast messages for you!";
			mes "It will cost you ^ff0000" + .auto_broadcastfee + "^000000 zeny per broadcast.";
			next;
			
			switch(select("Proceed:Check status:Exit")) {
				case 1:
					mes .@header$;
					mes "Please input your message.";
					next;
					input .@broadcast$;
					mes .@header$;
					mes "How many times do you want to broadcast?";
					mes "Min: 1";
					mes "Max: 100";
					next;
					input .@repeat, 1, 100;
					
					if (.@repeat < 1 || .@repeat > 100) {
						mes .@header$;
						mes "Suit yourself.";
						close;
					}
					
					.@cost = .auto_broadcastfee * .@repeat;
					
					mes .@header$;
					mes "You want to broadcast:";
					mes "^ff0000" + .@broadcast$ + "^000000";
					mes "Every 3 minutes for ^00ff00" + .@repeat + "^000000 time(s)?";
					mes "It will cost you a total of ^ff0000" + .@cost + "^000000 zeny.";
					next;
					
					switch(select("Proceed:Cancel")) {
						case 2:
							mes .@header$;
							mes "Suit yourself.";
							close;
					}
					
					if (Zeny < .@cost) {
						goto L_NotEnoughZeny;
					}
					
					Zeny -= .@cost;
					$@bc_announce$ = "Shout from " + strcharinfo(0) + ": " + .@broadcast$;
					$@repeat = .@repeat;
					donpcevent strnpcinfo(3) + "::OnAutoAnnounce";
					close;
				case 2:
					// ??
					end;
				case 3:
					mes .@header$;
					mes "Suit yourself.";
					close;
			}
			
			close;
	}
	
	end;
L_NotEnoughZeny:
	mes .@header$;
	mes "You don't have enough zeny.";
	close;
OnAutoAnnounce:
	.@repeat = $@repeat;
	.@broadcast$ = $@bc_announce$;
	
	while (.@repeat > 0) {
		announce .@broadcast$, 0, 0x5AFF00; // Edit 5AFF00 for color code HTML Color Code
		sleep 180000;
		.@repeat--;
	}
	
	end;
OnInit:
	.broadcastfee = 3000000;
	.auto_broadcastfee = 500000;
	end;
}

 

Wow! Its somehow close to what im looking for. Good job! Ive tested the script. It works alright. I could care less to check status as long as the auto broadcast works. I wanna keep it simple  as much as possible. I have an idea. Ofcourse i cannot execute it alone. Hehehe! You know how to get the delay of single broadcast?
 

Broadcast = gettimetick(2) + 60; //Timer 60 = 1 minute/s

can we somehow put it to auto broadcast like you are trying to auto broadcast for 5 times you will be charged 3 x 5 = 15m automatically right? How about that getiitemtick should add as well depends on the input times. So lets say you opt to have it auto broadcast for 5 times. you will get 15 minutes delay. Is it possible? Thanks @Tokei

5 hours ago, AnnieRuru said:

yes originally I was also thinking about storing it on SQL table or using a $PERMANENT_GLOBAL_ARRAY so can GM can track which announcement are still being queue
or deny the same player from using auto-broadcast over and over,
but somehow I went for the easier route and do things that is easier to be made ... probably because he didn't pay me to do it so I made it easy hahaha

initnpctimer and sleep doesn't persist after server reboots, I think the only way is use OnMinute00: OnMinute03: ... OnMinute57: ... ?

Wow! An advance classic broadcaster where GM can track which announcement are being queued. Thank you ~cute~cute~scripter~ ?  wishful thinking. HAHAHAHA!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  658
  • Reputation:   663
  • Joined:  11/12/12
  • Last Seen:  

Well in that case it'd probably be best to limit the amount of announces to 1 per account. You'd avoid a whole bunch of issues with that. The following resolves your server restart issues, though I'm... too lazy to make a GM handling of those announces.

prontera,187,210,3	script	Broadcaster#1::BC	894,{
	.@npcname$ = "^FF9300 Broadcaster ^000000";
	.@header$ = "[^0000ff" + .@npcname$ + "^000000]";

	mes .@header$;
	mes "Hi, I'm the Broadcaster.";
	mes "I can Broadcast a message for you.";
	mes " ";
	mes " ";
	mes " ";
	mes "It costs ^ff0000" + .broadcastfee + "^000000 zeny.";
	next;
	mes .@header$;
	mes "Would you like to Broadcast?";
	next;
	
	switch (select("Yes:Nevermind:Auto-broadcast:")) {
		case 1:
			if (Broadcast > gettimetick(2)) {
				mes .@header$;
				mes "Sorry you have to wait for 1 min.";
				close;
			}
			
			if (Zeny < .broadcastfee) {
				goto L_NotEnoughZeny;
			}
			
			mes .@header$;
			mes "Please input your message.";
			next;
			input .@broadcast$;
			Zeny -= .broadcastfee;
			announce "Shout from " + strcharinfo(0) + ": " + .@broadcast$ + "", 0, 0x5AFF00; // Edit 5AFF00 for color code HTML Color Code
			Broadcast = gettimetick(2) + 60; //Timer 60 = 1 minute/s
			dispbottom "Broadcaster: Please wait for 1min until next broadcast to avoid flooding.";
			end;
		case 2:
			mes .@header$;
			mes "Suit yourself.";
			close;
		case 3:
			mes .@header$;
			mes "Hi, I can automatically broadcast messages for you!";
			mes "It will cost you ^ff0000" + .auto_broadcastfee + "^000000 zeny per broadcast.";
			next;
			
			.@aid = getcharid(3);
			
			switch(select("Proceed:Check status:Exit")) {
				case 1:
					if ($bc_announces_delay[.@aid]) {
						mes .@header$;
						mes "You already have an auto announce for this account.";
						close;
					}
					
					mes .@header$;
					mes "Please input your message.";
					next;
					input .@broadcast$;
					mes .@header$;
					mes "How many times do you want to broadcast?";
					mes "Min: 1";
					mes "Max: 100";
					next;
					input .@repeat, 1, 100;
					
					if (.@repeat < 1 || .@repeat > 100) {
						mes .@header$;
						mes "Suit yourself.";
						close;
					}
					
					.@delay = 3;
					//mes .@header$;
					//mes "Delay between announces?";
					//mes "Min: 3";
					//mes "Max: 20";
					//next;
					//input .@delay, 3, 20;
					//
					//if (.@delay < 3 || .@delay > 20) {
					//	mes .@header$;
					//	mes "Suit yourself.";
					//	close;
					//}
					
					.@cost = .auto_broadcastfee * .@repeat;
					
					mes .@header$;
					mes "You want to broadcast:";
					mes "^ff0000" + .@broadcast$ + "^000000";
					mes "Every 3 minutes for ^00ff00" + .@repeat + "^000000 time(s)?";
					mes "It will cost you a total of ^ff0000" + .@cost + "^000000 zeny.";
					next;
					
					switch(select("Proceed:Cancel")) {
						case 2:
							mes .@header$;
							mes "Suit yourself.";
							close;
					}
					
					if (Zeny < .@cost) {
						goto L_NotEnoughZeny;
					}
					
					Zeny -= .@cost;
					
					$bc_announces_timer[.@aid] = 0;
					$bc_announces_repeat[.@aid] = .@repeat;
					$bc_announces_delay[.@aid] = .@delay * 60;
					$bc_announces_mes$[.@aid] = "Shout from " + strcharinfo(0) + ": " + .@broadcast$;
					$bc_announces_aid2idx[.@aid] = $bc_announces_count;
					$bc_announces_idx2aid[$bc_announces_count] = .@aid;
					$bc_announces_count++;
					close;
				case 2:
					if ($bc_announces_delay[.@aid] == 0) {
						mes .@header$;
						mes "You currently have no auto announces.";
						close;
					}
					
					mes .@header$;
					mes "Your current announce is as follow:";
					mes "^ff0000" + $bc_announces_mes$[.@aid] + "^000000";
					mes "It will be announced again in " + $bc_announces_timer[.@aid] + " second(s).";
					mes "It will repeat " + $bc_announces_repeat[.@aid] + " more time(s).";
					next;
					
					switch(select("Okay:Cancel announce:")) {
						case 1:	
							mes .@header$;
							mes "...";
							close;
						case 2:
							mes .@header$;
							mes "Your zeny will not be refunded, are you sure you want to cancel?";
							next;
							
							switch(select("No:Yes")) {
								case 1:
									mes .@header$;
									mes "Suit yourself.";
									close;
							}
							
							if ($bc_announces_delay[.@aid] == 0) {	// It already ended?
								end;
							}
							
							callsub L_RemoveAutoAnnounce, .@aid;
							mes .@header$;
							mes "All done.";
							close;
					}
					
					end;
				case 3:
					mes .@header$;
					mes "Suit yourself.";
					close;
				case 4:
					
					close;
			}
			
			close;
	}
	
	end;
L_NotEnoughZeny:
	mes .@header$;
	mes "You don't have enough zeny.";
	close;
OnTimer1000:
	freeloop(1);
	
	for (.@i = 0; .@i < $bc_announces_count; .@i++) {
		.@aid = $bc_announces_idx2aid[.@i];
		$bc_announces_timer[.@aid]--;
		
		if ($bc_announces_timer[.@aid] <= 0 && .@didannounce == false) {
			announce $bc_announces_mes$[.@aid], 0, 0x5AFF00;
			
			$bc_announces_repeat[.@aid]--;
			$bc_announces_timer[.@aid] = $bc_announces_delay[.@aid];
			
			if ($bc_announces_repeat[.@aid] <= 0) {
				callsub L_RemoveAutoAnnounce, .@aid;
				.@i--;
			}
			
			.@didannounce = true;	// Prevents overlapping of announces
		}
	}
	
	freeloop(0);
	initnpctimer;
	end;
L_RemoveAutoAnnounce:
	.@aid = getarg(0);
	.@idx = $bc_announces_aid2idx[.@aid];
	
	$bc_announces_timer[.@aid] = 0;
	$bc_announces_repeat[.@aid] = 0;
	$bc_announces_delay[.@aid] = 0;
	$bc_announces_mes$[.@aid] = "";
	
	.@last_aid = $bc_announces_idx2aid[$bc_announces_count - 1];
	$bc_announces_idx2aid[.@idx] = .@last_aid;
	$bc_announces_idx2aid[$bc_announces_count - 1] = 0;
	$bc_announces_aid2idx[.@last_aid] = .@idx;
	$bc_announces_count--;
	return;
OnInit:
	.broadcastfee = 3000000;
	.auto_broadcastfee = 500000;
	initnpctimer;
	end;
}

 

  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.03
  • Content Count:  640
  • Reputation:   82
  • Joined:  04/07/14
  • Last Seen:  

13 hours ago, Tokei said:

Well in that case it'd probably be best to limit the amount of announces to 1 per account. You'd avoid a whole bunch of issues with that. The following resolves your server restart issues, though I'm... too lazy to make a GM handling of those announces.


prontera,187,210,3	script	Broadcaster#1::BC	894,{
	.@npcname$ = "^FF9300 Broadcaster ^000000";
	.@header$ = "[^0000ff" + .@npcname$ + "^000000]";

	mes .@header$;
	mes "Hi, I'm the Broadcaster.";
	mes "I can Broadcast a message for you.";
	mes " ";
	mes " ";
	mes " ";
	mes "It costs ^ff0000" + .broadcastfee + "^000000 zeny.";
	next;
	mes .@header$;
	mes "Would you like to Broadcast?";
	next;
	
	switch (select("Yes:Nevermind:Auto-broadcast:")) {
		case 1:
			if (Broadcast > gettimetick(2)) {
				mes .@header$;
				mes "Sorry you have to wait for 1 min.";
				close;
			}
			
			if (Zeny < .broadcastfee) {
				goto L_NotEnoughZeny;
			}
			
			mes .@header$;
			mes "Please input your message.";
			next;
			input .@broadcast$;
			Zeny -= .broadcastfee;
			announce "Shout from " + strcharinfo(0) + ": " + .@broadcast$ + "", 0, 0x5AFF00; // Edit 5AFF00 for color code HTML Color Code
			Broadcast = gettimetick(2) + 60; //Timer 60 = 1 minute/s
			dispbottom "Broadcaster: Please wait for 1min until next broadcast to avoid flooding.";
			end;
		case 2:
			mes .@header$;
			mes "Suit yourself.";
			close;
		case 3:
			mes .@header$;
			mes "Hi, I can automatically broadcast messages for you!";
			mes "It will cost you ^ff0000" + .auto_broadcastfee + "^000000 zeny per broadcast.";
			next;
			
			.@aid = getcharid(3);
			
			switch(select("Proceed:Check status:Exit")) {
				case 1:
					if ($bc_announces_delay[.@aid]) {
						mes .@header$;
						mes "You already have an auto announce for this account.";
						close;
					}
					
					mes .@header$;
					mes "Please input your message.";
					next;
					input .@broadcast$;
					mes .@header$;
					mes "How many times do you want to broadcast?";
					mes "Min: 1";
					mes "Max: 100";
					next;
					input .@repeat, 1, 100;
					
					if (.@repeat < 1 || .@repeat > 100) {
						mes .@header$;
						mes "Suit yourself.";
						close;
					}
					
					.@delay = 3;
					//mes .@header$;
					//mes "Delay between announces?";
					//mes "Min: 3";
					//mes "Max: 20";
					//next;
					//input .@delay, 3, 20;
					//
					//if (.@delay < 3 || .@delay > 20) {
					//	mes .@header$;
					//	mes "Suit yourself.";
					//	close;
					//}
					
					.@cost = .auto_broadcastfee * .@repeat;
					
					mes .@header$;
					mes "You want to broadcast:";
					mes "^ff0000" + .@broadcast$ + "^000000";
					mes "Every 3 minutes for ^00ff00" + .@repeat + "^000000 time(s)?";
					mes "It will cost you a total of ^ff0000" + .@cost + "^000000 zeny.";
					next;
					
					switch(select("Proceed:Cancel")) {
						case 2:
							mes .@header$;
							mes "Suit yourself.";
							close;
					}
					
					if (Zeny < .@cost) {
						goto L_NotEnoughZeny;
					}
					
					Zeny -= .@cost;
					
					$bc_announces_timer[.@aid] = 0;
					$bc_announces_repeat[.@aid] = .@repeat;
					$bc_announces_delay[.@aid] = .@delay * 60;
					$bc_announces_mes$[.@aid] = "Shout from " + strcharinfo(0) + ": " + .@broadcast$;
					$bc_announces_aid2idx[.@aid] = $bc_announces_count;
					$bc_announces_idx2aid[$bc_announces_count] = .@aid;
					$bc_announces_count++;
					close;
				case 2:
					if ($bc_announces_delay[.@aid] == 0) {
						mes .@header$;
						mes "You currently have no auto announces.";
						close;
					}
					
					mes .@header$;
					mes "Your current announce is as follow:";
					mes "^ff0000" + $bc_announces_mes$[.@aid] + "^000000";
					mes "It will be announced again in " + $bc_announces_timer[.@aid] + " second(s).";
					mes "It will repeat " + $bc_announces_repeat[.@aid] + " more time(s).";
					next;
					
					switch(select("Okay:Cancel announce:")) {
						case 1:	
							mes .@header$;
							mes "...";
							close;
						case 2:
							mes .@header$;
							mes "Your zeny will not be refunded, are you sure you want to cancel?";
							next;
							
							switch(select("No:Yes")) {
								case 1:
									mes .@header$;
									mes "Suit yourself.";
									close;
							}
							
							if ($bc_announces_delay[.@aid] == 0) {	// It already ended?
								end;
							}
							
							callsub L_RemoveAutoAnnounce, .@aid;
							mes .@header$;
							mes "All done.";
							close;
					}
					
					end;
				case 3:
					mes .@header$;
					mes "Suit yourself.";
					close;
				case 4:
					
					close;
			}
			
			close;
	}
	
	end;
L_NotEnoughZeny:
	mes .@header$;
	mes "You don't have enough zeny.";
	close;
OnTimer1000:
	freeloop(1);
	
	for (.@i = 0; .@i < $bc_announces_count; .@i++) {
		.@aid = $bc_announces_idx2aid[.@i];
		$bc_announces_timer[.@aid]--;
		
		if ($bc_announces_timer[.@aid] <= 0 && .@didannounce == false) {
			announce $bc_announces_mes$[.@aid], 0, 0x5AFF00;
			
			$bc_announces_repeat[.@aid]--;
			$bc_announces_timer[.@aid] = $bc_announces_delay[.@aid];
			
			if ($bc_announces_repeat[.@aid] <= 0) {
				callsub L_RemoveAutoAnnounce, .@aid;
				.@i--;
			}
			
			.@didannounce = true;	// Prevents overlapping of announces
		}
	}
	
	freeloop(0);
	initnpctimer;
	end;
L_RemoveAutoAnnounce:
	.@aid = getarg(0);
	.@idx = $bc_announces_aid2idx[.@aid];
	
	$bc_announces_timer[.@aid] = 0;
	$bc_announces_repeat[.@aid] = 0;
	$bc_announces_delay[.@aid] = 0;
	$bc_announces_mes$[.@aid] = "";
	
	.@last_aid = $bc_announces_idx2aid[$bc_announces_count - 1];
	$bc_announces_idx2aid[.@idx] = .@last_aid;
	$bc_announces_idx2aid[$bc_announces_count - 1] = 0;
	$bc_announces_aid2idx[.@last_aid] = .@idx;
	$bc_announces_count--;
	return;
OnInit:
	.broadcastfee = 3000000;
	.auto_broadcastfee = 500000;
	initnpctimer;
	end;
}

 

Thank you so much @Tokei

 

Additional info.

 image.png.9d5e1f1d8b7e9cf3bd2a5ab400cf1bcc.png

This is the check status on that server.  I think i can live without the check status.

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...