Jump to content
  • 0

Query_SQL Help


REKT

Question


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  206
  • Reputation:   11
  • Joined:  12/06/11
  • Last Seen:  

Hello, it's me again! i just wanted to confirm the following script that i edit? if this one is correct.

Uhm? if possible? could you add also the Logo for the Emblem and the following name of the guild?

Ex:

[LOGO] Hello Kitty Guild.

Could you fix it below the script?

I just stole it from 'Chris' sorry! :)

and i don't have any idea how to fix the query_sql properly.

query_sql "SELECT `char_num` , `name` , `class` , `base_level` , `job_level`

mes "Character Name: ^0000FF" + @name$[0] + "^000000";
mes "Base/Job Level: ^993333" + @base_level[@a] + " / " + @job_level[@a] + "^000000";
mes "Class: ^993333" + jobname(@class[@a]) + "^000000";
mes "Guild: [LOGO] and the Name of the [GUILD]";

Don't know what else i could explain about this script since, i'm not familiar with query_sql.

Thank you and much appreciated for those who help me here.

Regards,

Melody :D

Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

Hi Melody.

We have to know what you want to display, the filter :

-> All character in a specify account ?

-> One character in a party based on the party id ?

-> ...

Specify.

It's not possible to display an emblem in the npc dialog (or is it a new feature I'm missing ?).

Here the code, just missing the "what do we need to select" thing in the sql query.

	set .@n, query_sql(
	"SELECT " +
		"c.`name`, c.`base_level`, c.`job_level`, c.`class`, " +
		"g.`name` " +
	"FROM " +
		"`char` AS c " +
	"LEFT JOIN " +
		"`guild` AS g " +
	"ON " +
		"c.`guild_id` = g.`guild_id` " +
	"WHERE " +
	    "<don't know what to write here, missing some informations>",
	.@name$, .@base_level, .@job_level, .@class, .@guild_name$
);

for ( set .@i, 0; .@i<.@n; set .@i, .@i+1 ) {
	mes(
		"Character Name: ^0000FF" + .@name$[.@i] + "^000000",
		"Base/Job Level: ^993333" + .@base_level[.@i] + " / " + .@job_level[.@i] + "^000000",
		"Class: ^993333" + jobname(.@class[.@i]) + "^000000",
		"Guild: ^993333" + .@guild_name$[.@i] + "^000000",
		""
	);
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  206
  • Reputation:   11
  • Joined:  12/06/11
  • Last Seen:  

Oh my 'GOSH' seems i can't read this professional scripting tricks, could you make it more 'BASICS' i don't need something like this, i can't even read some of the 'DETAILS' :) Please?

Regards,

Melody :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

I can't really make it more simple... It's just a basic SQL request.

As I said below, we just have to know what the script is supposed to do to complete it (display players in your party ? display members in your guild ? display all players of a map ?)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

I guess she could display an emblem using cutin function and put it in the good location and format.

Take a look at (*cutin) on doc/script_command.txt.

KeyWorld query is a good exemple to learn, (even if "as" may be trouble), but first you need to knoww what you wanna get from that query and what do you already have. It's like searching in a big array you need an index to found what u want.

If I get it right you wanted an sql query to load the emblem from a specified guild right ? Dunno if it's possible like that but take a look at cutin as I said.

Last from your and Keyworld actual query, you could have all those value via npc already.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  626
  • Reputation:   188
  • Joined:  11/19/11
  • Last Seen:  

Hmm, looks like from my InGame CP D:, to specify the source more ;O.

Don't got a problem with so don't worry.

About the guild.

Instead of getting the guild name via SQL wouldn't that be more better:?

getguildname(getcharid(2,.@name$[.@i]))

So in this case you won't the "JOIN" part :) in the sql query.

Regards,

Chris

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  206
  • Reputation:   11
  • Joined:  12/06/11
  • Last Seen:  

Hmm, looks like from my InGame CP D:, to specify the source more ;O.

Don't got a problem with so don't worry.

About the guild.

Instead of getting the guild name via SQL wouldn't that be more better:?

getguildname(getcharid(2,.@name$[.@i]))

So in this case you won't the "JOIN" part :) in the sql query.

Regards,

Chris

Hello, Chris the 'CODE' is working but, few Suggestion? EX: what if the player has no 'GUILD'?

Could you also put "None Guild"? please understand me here, i'm still new in 'query_sql' sorry for stealing your 'CODE' @_@?

@Keyworld, thanks a lot! but sorry, i can't understand that good 'query_sql' code of yours, maybe i should messing around with /doc.txt

Melody /no1

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  626
  • Reputation:   188
  • Joined:  11/19/11
  • Last Seen:  

In that case this code would be the correct one:

mes ( (!getcharid(2,.@name$[.@i]))?"No Guild":getguildname(getcharid(2,.@name$[.@i])));

This is a called a short-if.

completed it would be look like this:

if(!getcharid(2,.@name$[.@i])) // Player doesn't have an guild.
   mes "No Guild";
else // Player has one D:
   mes getguildname(getcharid(2,.@name$[.@i]));

So with an short-if you can make the script shorter /no1.

Regards,

Chris

Note: I'm pretty sure "short-if" has an another term, I saw somewhere o.o. Can't remember though where.

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