Jump to content
  • 0

Creating an option box thats from SQL


Question

Posted

Hi guys, does anyone knows how to make an option box that is taken from the SQL. Example under the char table of SQL. When I click an npc dialog will be "Please choose the player that you want." then an option box will appear that has all the player in it, this is in order for me to choose a player.

In the dialog box:

Zeus

Poseidon

Hades

Then the option or menu box should be same as in the dialog box

Zeus

Poseidon

Hades

Now if theres a new player named Hermes. This should be added in the dialog box and in the menu bix automatically.

Note all players that will appear in the dialog box and menu box should be online players only. If they are offline. There name will be removed automatically and once that player went online there name should appear again automatically.

I hope someone understand what I am trying to say. Please help with this. Thanks

2 answers to this question

Recommended Posts

Posted

poring_w01,100,100,0	script	test	910,{

query_sql "SELECT `char`.`name` FROM `char` WHERE `online` ORDER BY `name` ASC", .@name$;

for (set .@i,0; .@i < getarraysize(.@name$); set .@i,.@i+1) {

set .@menu$, .@menu$ + .@name$[.@i]+":";

}

mes "Please choose the player that you want:";

set .@num, select(.@menu$);

mes "You picked " + .@name$[.@num-1];

// do other stuff here

close;

}

I think there's a limit to how long a menu string can be, but I'm not sure what that length is.
Posted
poring_w01,100,100,0	script	test	910,{
	query_sql "SELECT `char`.`name` FROM `char` WHERE `online` ORDER BY `name` ASC", .@name$;
	
	for (set .@i,0; .@i < getarraysize(.@name$); set .@i,.@i+1) {
		set .@menu$, .@menu$ + .@name$[.@i]+":";
	}
	
	mes "Please choose the player that you want:";
	set .@num, select(.@menu$);
	mes "You picked " + .@name$[.@num-1];
	// do other stuff here
	close;
}
I think there's a limit to how long a menu string can be, but I'm not sure what that length is.

 

 

100 items ... or 4096 length limit  if not mistaken ( depend on diff size )

  • Upvote 1

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...