Jump to content
  • 0

Creating an option box thats from SQL


Reborn

Question


  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.02
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

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

Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

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.
Link to comment
Share on other sites


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

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