Jump to content
  • 0
Sign in to follow this  
gidzdlcrz

Additional Feature for my own Broadcaster NPC

Question

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

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.929155f8470b66beb0ba7def6ac0fb6b.pngimage.png.079fe4d8b783b3d02d9be294b0f45473.png

 

image.png.0f7ee56258feaca323493bd6862adc18.png
 

image.png.1a4ebe0e2ff52659d0fd9981ece63dda.png

 

image.png.5078163237c9e71b40328f2ef664b783.png


After you input your desired number you can review it to proceed or not.

 

image.png.1d22dfde8d468f416a0bd03fc97c9816.png


 

Annie made me a script which is similar to this one. Can be used as a case 3 for my script. 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 instead. 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;
}

Good Script indeed.

Thank you so much!

Edited by gidzdlcrz
Typos

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

https://rathena.org/board/topic/126404-additional-feature-for-my-own-broadcaster-npc/?do=findComment&comment=388123

after Tokei posted that I'm a bit fire up hahaha

 

https://gist.github.com/AnnieRuru/cf56174c4bbbd3a61d4dd0c11100c425

well, yes I didn't do the stuffs he said, but its do-able with SQL table or using storing them in array

reply again if you want this feature

Share this post


Link to post
Share on other sites
  • 0
On 11/5/2020 at 7:11 AM, AnnieRuru said:

https://rathena.org/board/topic/126404-additional-feature-for-my-own-broadcaster-npc/?do=findComment&comment=388123

after Tokei posted that I'm a bit fire up hahaha

 

https://gist.github.com/AnnieRuru/cf56174c4bbbd3a61d4dd0c11100c425

well, yes I didn't do the stuffs he said, but its do-able with SQL table or using storing them in array

reply again if you want this feature

is a working broadcaster npc still available? i used the one from Tokei and i get stuck after broadcasting.

 

prontera,157,180,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 "Broadcast 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;
}

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

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