Jump to content
  • 0

[ query_sql ] How to create a data like this


hakuren

Question


  • Group:  Members
  • Topic Count:  120
  • Topics Per Day:  0.03
  • Content Count:  295
  • Reputation:   6
  • Joined:  12/02/11
  • Last Seen:  

how can mysql receive data like char.sql i like to make a npc that has a sql function

ex. npc has categories like "Jumping, Pushing, Hiding"

when player A talks to that npc all the chosen categories will record to sql

can someone help me with this

 

sql table must like this char_id | selections

 

or tell me if this can be done or not :(

thank you in advance :)

Edited by hakuren
Link to comment
Share on other sites

6 answers to this question

Recommended Posts


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

/*
create table npc_categories (
char_id int(11),
categories varchar(20)
) engine = innodb;
*/

prontera,156,189,6	script	kjdhfksdjf	100,{
	mes "blah";
	next;
	.@s = select(.menu$) -1;
	mes .string$[.@s];
	query_sql "insert into npc_categories values ( "+ getcharid(0) +", '"+ escape_sql( .string$[.@s] ) +"' )";
	close;
OnInit:
	setarray .string$, "Jumping", "Pushing", "Hiding";
	for ( .@i = 0; .@i < 3; .@i++ )
		.menu$ = .menu$ + .string$[.@i] +":";
	end;
}
start learn sql from here

http://www.w3schools.com/sql/

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:  

Refer to query_sql command

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  120
  • Topics Per Day:  0.03
  • Content Count:  295
  • Reputation:   6
  • Joined:  12/02/11
  • Last Seen:  

Refer to query_sql command

yes sir but how can i create a data like that can you make me one for example purposes please?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  142
  • Reputation:   8
  • Joined:  02/11/13
  • Last Seen:  

query_sql "<your sql commandline>",<your output variable>;

...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  120
  • Topics Per Day:  0.03
  • Content Count:  295
  • Reputation:   6
  • Joined:  12/02/11
  • Last Seen:  

query_sql "<your sql commandline>",<your output variable>;

...

so sir how can i make a sql table? can you make me that example please :(

Edited by hakuren
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  120
  • Topics Per Day:  0.03
  • Content Count:  295
  • Reputation:   6
  • Joined:  12/02/11
  • Last Seen:  

/*
create table npc_categories (
char_id int(11),
categories varchar(20)
) engine = innodb;
*/

prontera,156,189,6	script	kjdhfksdjf	100,{
	mes "blah";
	next;
	.@s = select(.menu$) -1;
	mes .string$[.@s];
	query_sql "insert into npc_categories values ( "+ getcharid(0) +", '"+ escape_sql( .string$[.@s] ) +"' )";
	close;
OnInit:
	setarray .string$, "Jumping", "Pushing", "Hiding";
	for ( .@i = 0; .@i < 3; .@i++ )
		.menu$ = .menu$ + .string$[.@i] +":";
	end;
}
start learn sql from here

http://www.w3schools.com/sql/

 

wow it works! thank you!

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