Jump to content
  • 0

Messenger NPC using dispbottom function


Pink Guy

Question


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

Can someone please make me an npc that only lvl 60 GMs and above can talk to and what happens when you talk to it, it will give you 3 options + close/cancel. The three choices will be "pvp1" , "gvg", and "bg".

 

When you choose pvp1, the npc will send a dispbottom message to all online players saying "A GM wishes to observe the PVP, proceed there if you wish to join."

if you choose gvg, the npc will send a dispbottom message to all online players saying "A GM is calling all guilds wishing to fight in the GVG arena."

if you choose bg, the npc will send a dispbottom message to all online players saying "A GM wishes to start the Battlegrounds, proceed to BG arena if you wish to participate."

^Also, if it's possible, can the dispbottom message be in the "6600CC" color?

Thank you in advance to whoever will help me.

Link to comment
Share on other sites

16 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Try :

prontera,150,150,0    script    Sample    100,{

    function Display;

    if ( getgmlevel() < 60 ) end;
    set .@npc$, "[ " +strnpcinfo(1)+ " ]";
    
    mes .@npc$;
    mes "What do you want, " + (Sex ? "Sir" : "Maam") + " " +strcharinfo(0)+ "?";
    next;
    
    switch( select("PVP1:GVG:BG:Cancel") ) {
        case 1: addrid(0); Display("A GM wishes to observe the PVP, proceed there if you wish to join."); break;
        case 2: addrid(0); Display("A GM is calling all guilds wishing to fight in the GVG arena."); break;
        case 3: addrid(0); Display("A GM wishes to start the Battlegrounds, proceed to BG arena if you wish to participate."); break;
        case 4: close; break;
        default: break;
    }
    
    end;
    
    function    Display    {
        dispbottom getarg(0);
        return;
    }
}
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:  

Thanks for the quick reply. :D

Btw, I tried to use it and it doesn't do anything I get this error:

B8GRtgi.png

Edited by Instinct
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

update your rathena to latest .... only rathena have addrid ....

 

^Also, if it's possible, can the dispbottom message be in the "6600CC" color?

it should be

announce ""+getarg(0),bc_self,0x6600CC;
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:  

I can't change the server to rathena because it's not my server I'm just helping with basic stuffs. Is there any possible way to do this?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

I can't change the server to rathena because it's not my server I'm just helping with basic stuffs. Is there any possible way to do this?

What emulator are you using?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

eAthena

 

Didn't test :

prontera,150,150,0    script    Sample    100,{

    function Display;

    if ( getgmlevel() < 60 ) end;
    set .@npc$, "[ " +strnpcinfo(1)+ " ]";
    
    mes .@npc$;
    mes "What do you want, " + (Sex ? "Sir" : "Maam") + " " +strcharinfo(0)+ "?";
    next;
    
    switch( select("PVP1:GVG:BG:Cancel") ) {
        case 1: Display("A GM wishes to observe the PVP, proceed there if you wish to join."); break;
        case 2: Display("A GM is calling all guilds wishing to fight in the GVG arena."); break;
        case 3: Display("A GM wishes to start the Battlegrounds, proceed to BG arena if you wish to participate."); break;
        case 4: close; break;
        default: break;
    }
    
    function    Display    {
        query_sql "SELECT `char`.`account_id` FROM `char` JOIN `login` ON `char`.`account_id` = `login`.`account_id` WHERE `login`.`level` = 0 AND `char`.`online` = 1",.@aid;
        set .@size, getarraysize(.@aid);
        while ( .@i < .@size ) {
            if ( attachrid( .@aid[.@i] ) )
                dispbottom getarg(0);
            detachrid;
            set .@i, .@i + 1;
        }
        return;
    }
}
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:  

eAthena

 

Didn't test :

prontera,150,150,0    script    Sample    100,{

    function Display;

    if ( getgmlevel() < 60 ) end;
    set .@npc$, "[ " +strnpcinfo(1)+ " ]";
    
    mes .@npc$;
    mes "What do you want, " + (Sex ? "Sir" : "Maam") + " " +strcharinfo(0)+ "?";
    next;
    
    switch( select("PVP1:GVG:BG:Cancel") ) {
        case 1: Display("A GM wishes to observe the PVP, proceed there if you wish to join."); break;
        case 2: Display("A GM is calling all guilds wishing to fight in the GVG arena."); break;
        case 3: Display("A GM wishes to start the Battlegrounds, proceed to BG arena if you wish to participate."); break;
        case 4: close; break;
        default: break;
    }
    
    function    Display    {
        query_sql "SELECT `char`.`account_id` FROM `char` JOIN `login` ON `char`.`account_id` = `login`.`account_id` WHERE `login`.`level` = 0 AND `char`.`online` = 1",.@aid;
        set .@size, getarraysize(.@aid);
        while ( .@i < .@size ) {
            if ( attachrid( .@aid[.@i] ) )
                dispbottom getarg(0);
            detachrid;
            set .@i, .@i + 1;
        }
        return;
    }
}

The message thing works but when I choose an option, it doesn't do anything and the message box will stay there so I have to close my client or warp somewhere else.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  764
  • Reputation:   220
  • Joined:  11/14/11
  • Last Seen:  

@Patskie:

1. "break;" after "close;" is pointless since "close;" already terminated the script.

2. *Athena has a limit of 128 entries per array. So you'll only select the first 128 online players with that query.

 

 

The message thing works but when I choose an option, it doesn't do
anything and the message box will stay there so I have to close my
client or warp somewhere else.

That's because there is an "end;" missing behind the switch block. The function "Display" return into the switch-block - "break;" is executed and nothing more happens; no "close;" no "end;"....

 

Updated script (untested, because I'm at work):

prontera,150,150,0    script    Sample    100,{

    function Display;

    if ( getgmlevel() < 60 ) end;
    set .@npc$, "[ " +strnpcinfo(1)+ " ]";
    
    mes .@npc$;
    mes "What do you want, " + (Sex ? "Sir" : "Maam") + " " +strcharinfo(0)+ "?";
    next;
    
    switch( select("PVP1:GVG:BG:Cancel") ) {
        case 1: Display("A GM wishes to observe the PVP, proceed there if you wish to join."); break;
        case 2: Display("A GM is calling all guilds wishing to fight in the GVG arena."); break;
        case 3: Display("A GM wishes to start the Battlegrounds, proceed to BG arena if you wish to participate."); break;
        case 4: close;
        default: break;
    }
	end;
    
    function    Display    {
		set .@query_i, 0;
		while(1)
		{
			query_sql "SELECT `char`.`account_id` FROM `char` JOIN `login` ON `char`.`account_id` = `login`.`account_id` LIMIT .@query_i, 128 WHERE `login`.`level` = 0 AND `char`.`online` = 1", .@aid;
			set .@query_i, .@query_i + 128;
			set .@size, getarraysize(.@aid);
			for(set .@i, 0; .@i < .@size; set .@i, .@i + 1)
			{
				if (attachrid(.@aid[.@i]))
					dispbottom getarg(0);
				detachrid;
			}
			if(.@size < 128)
				break;
		}
        return;
    }
}
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Yaa miss that one >.<. 

query_sql "SELECT `char`.`account_id` FROM `char` JOIN `login` ON `char`.`account_id` = `login`.`account_id` LIMIT .@query_i, 128 WHERE `login`.`level` = 0 AND `char`.`online` = 1", .@aid;

Should be : 

query_sql "SELECT `char`.`account_id` FROM `char` JOIN `login` ON `char`.`account_id` = `login`.`account_id` WHERE `login`.`level` = 0 AND `char`.`online` = 1 LIMIT " +.@query_i+ ", 128", .@aid;

otherwise you will receive syntax error.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  764
  • Reputation:   220
  • Joined:  11/14/11
  • Last Seen:  

Did I honestly use a variable name inside of a string? Damn; I need a vacation.
Thanks for fixxing. :P

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:  

Still freezes after choosing an option. I also did what Patskie said, I replaced the query_sql thing.

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  


prontera,150,150,0 script Sample 100,{

if ( getgmlevel() < 60 ) end;

set .@npc$, "[ " +strnpcinfo(1)+ " ]";

mes .@npc$;

mes "What do you want, " + (Sex ? "Sir" : "Maam") + " " +strcharinfo(0)+ "?";

next;

switch( select("PVP1:GVG:BG:Cancel") ) {

case 1: announce "A GM wishes to observe the PVP, proceed there if you wish to join.",bc_all,0x6600CC; break;

case 2: announce "A GM is calling all guilds wishing to fight in the GVG arena.",bc_all,0x6600CC; break;

case 3: announce "A GM wishes to start the Battlegrounds, proceed to BG arena if you wish to participate.",bc_all,0x6600CC; break;

case 4:

mes "Good bye.";

close;

}

mes "Done.";

close;

}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

prontera,150,150,0	script	Sample	100,{
	if ( getgmlevel() < 60 ) end;
	set .@npc$, "[ " +strnpcinfo(1)+ " ]";
	
	mes .@npc$;
	mes "What do you want, " + (Sex ? "Sir" : "Maam") + " " +strcharinfo(0)+ "?";
	next;
	switch( select("PVP1:GVG:BG:Cancel") ) {
		case 1: announce "A GM wishes to observe the PVP, proceed there if you wish to join.",bc_all,0x6600CC; break;
		case 2: announce "A GM is calling all guilds wishing to fight in the GVG arena.",bc_all,0x6600CC; break;
		case 3: announce "A GM wishes to start the Battlegrounds, proceed to BG arena if you wish to participate.",bc_all,0x6600CC; break;
		case 4:
			mes "Good bye.";
			close;
	}
	mes "Done.";
	close;
}

He want a dispbottom approach 

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

prontera,150,150,0	script	Sample	100,{
	if ( getgmlevel() < 60 ) end;
	set .@npc$, "[ " +strnpcinfo(1)+ " ]";
	
	mes .@npc$;
	mes "What do you want, " + (Sex ? "Sir" : "Maam") + " " +strcharinfo(0)+ "?";
	next;
	switch( select("PVP1:GVG:BG:Cancel") ) {
		case 1: globalmes "A GM wishes to observe the PVP, proceed there if you wish to join."; break;
		case 2: globalmes "A GM is calling all guilds wishing to fight in the GVG arena."; break;
		case 3: globalmes "A GM wishes to start the Battlegrounds, proceed to BG arena if you wish to participate."; break;
		case 4:
			mes "Good bye.";
			close;
	}
	mes "Done.";
	close;
}

The message can't be in color then.

  • Upvote 1
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:  

Thanks for the replies. I'll just use the announce that Patskie made. Thanks for the help!

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