Jump to content
  • 0

Searching something on sql [global_reg_value]


ays297

Question


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  49
  • Reputation:   0
  • Joined:  11/30/11
  • Last Seen:  

input .@player$;
next;
mes ""+.@player$+" has been reborn for "+.@count+" times";

So, is there a way for me to make a script that allows a player to search for someone's statistic?

Where he inputs in the NPC the name of a player and the NPC will display information? :)

Link to comment
Share on other sites

5 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   152
  • Joined:  02/21/12
  • Last Seen:  

Here is an example for showing how often you died:

prontera,160,168,3	script	Statistic NPC	101,{

input @char_name$;
query_sql "SELECT `char_id` FROM `char` WHERE `name`='"+@char_name$+"'", @char_id;
query_sql "SELECT `value` FROM `global_reg_value` WHERE `str`='PC_DIE_COUNTER' AND `char_id`="+@char_id, @die_counter;
mes @char_name$+" died "+@die_counter+" times.";
close;
}

I hope it helps you to understand how sql works here.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  118
  • Reputation:   6
  • Joined:  01/25/12
  • Last Seen:  

tr0n global_reg_value can still be checked without querying in sql with just using the variable name only

EDIT here's my code btw assuming you are using reborncount variable:

input .@player$;
if(!getcharid(0,.@player$)) {
mes "Player is not found!";
close;
}
attachrid(getcharid(0,.@player$));
mes strcharinfo(0)+" has been reborn for "+reborncount+" times";
close;

btw ays you can refer also here:

Prefix: scope and extent
nothing  - A permanent variable attached to the character, the default variable
	   type. They are stored with all the account data in "saveathena.txt"
	   in TXT versions and in the SQL versions in the `global_reg_value`
	   table using type 3.
"@"	  - A temporary variable attached to the character.
	   SVN versions before 2094 revision and RC5 version will also treat
	   'l' as a temporary variable prefix, so beware of having variable
	   names starting with 'l' if you want full backward compatibility.
"$"	  - A global permanent variable.
	   They are stored in "savemapreg.txt" or database table `mapreg`,
	   depending on server type.
"$@"	 - A global temporary variable.
	   This is important for scripts which are called with no RID
	   attached, that is, not triggered by a specific character object.
"."	  - A NPC variable.
	   They exist in the NPC and disappear when the server restarts or the
	   NPC is reloaded. Can be accessed from inside the NPC or by calling
	   'getvariableofnpc'. Function objects can also have .variables which
	   are accessible from inside the function, however 'getvariableofnpc'
	   does NOT work on function objects.
".@"	 - A scope variable.
	   They are unique to the instance and scope. Each instance has it's
	   own scope that ends when the script ends. Calling a function with
	   callsub/callfunc starts a new scope, returning from the function
	   ends it. When a scope ends, it's variables are converted to values
	   ('return .@var;' returns a value, not a reference).
"'"	  - An instance variable
	   These are used with the instancing system, and are unique to each
	   party's instance.
"#"	  - A permanent local account variable.
	   They are stored with all the account data in "saveaccreg.txt" in
	   TXT versions and in the SQL versions in the 'global_reg_value'
	   table using type 2.
"##"	 - A permanent global account variable stored by the login server.
	   They are stored in "saveaccount.txt" and in the SQL versions in the
	   'global_reg_value' table, using type 1. The only difference you will
	   note from normal # variables is when you have multiple char-servers
	   connected to the same login server. The # variables are unique to
	   each char-server, while the ## variables are shared by all these
	   char-servers.
Postfix: integer or string
nothing - integer variable, can store positive and negative numbers, but only
	  whole numbers (so don't expect to do any fractional math)
'$'	 - string variable, can store text
Examples:
 name  - permanent character integer variable
 name$ - permanent character string variable
@name  - temporary character integer variable
@name$ - temporary character string variable
$name  - permanent global integer variable
$name$ - permanent global string variable
$@name  - temporary global integer variable
$@name$ - temporary global string variable
.name  - NPC integer variable
.name$ - NPC string variable
.@name  - scope integer variable
.@name$ - scope string variable
#name  - permanent local account integer variable
#name$ - permanent local account string variable
##name  - permanent global account integer variable
##name$ - permanent global account string variable

Edited by deathscythe13
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  49
  • Reputation:   0
  • Joined:  11/30/11
  • Last Seen:  

Thanks a lot guys. And yes, I'm a total noob in this and I'm really thankful for your guys help. :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   152
  • Joined:  02/21/12
  • Last Seen:  

tr0n global_reg_value can still be checked without querying in sql with just using the variable name only

EDIT here's my code btw assuming you are using reborncount variable:

input .@player$;
if(!getcharid(0,.@player$)) {
mes "Player is not found!";
close;
}
attachrid(getcharid(0,.@player$));
mes strcharinfo(0)+" has been reborn for "+reborncount+" times";
close;

But the attachrid would effect that the message would be send to the other player and not you.

He will see the information if he is online. not you.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  49
  • Reputation:   0
  • Joined:  11/30/11
  • Last Seen:  

@deathscythe, just like what tr0n said. I can't view it if it's offline.

@tr0n, thanks a lot. It worked!

Anyway, do you guys have any idea and willing to tell me how to put this thing in my site? and also the ladder? :)

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