Jump to content
  • 0
Sign in to follow this  
laylayzi

how can i add new parameter for my character.

Question

Hi! There is my problem.

I want to add a new parameter into the char table but I don't know how to work with it.

 

For example:

i add a new column "count" into the char table. (integer default: 0)

and i want every i type a command (ex: @count) or talk with NPC, it can show me the current value of "count" then +1 

so:

the first time i use @count (or talk with NPC) it will show me: 0

the secondtime i use @count it will show me: 1

...

 

Thats it.

Thank for your time!

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Why not use char-based variables? Those will be easier to set ingame, and they can be found in SQL as well via charID/name of variable.

Share this post


Link to post
Share on other sites
  • 0

what i am trying to do is put a flag for my charactor.

orthers variable have their using purpose (maybe, as i can see at the columname) that i cant modifier.

Im a newbie in scripting so maybe there is an other way to set a variable bind to character but i dont know.

Thank for your time!

Edited by laylayzi

Share this post


Link to post
Share on other sites
  • 0

@ doc/script_commands.txt

Variables are divided into and uniquely identified by the combination of:prefix  - determines the scope and extent (or lifetime) of the variablename    - an identifier consisting of '_' and alphanumeric characterspostfix - determines the type of the variable: integer or stringScope can be:global    - global to all serverslocal	 - local to the serveraccount   - attached to the account of the character identified by RIDcharacter - attached to the character identified by RIDnpc	   - attached to the NPCscope	 - attached to the scope of the instanceExtent can be:permanent - They still exist when the server resets.temporary - They cease to exist when the server resets.Prefix: scope and extentnothing  - A permanent variable attached to the character, the default		   variable type."@"	  - A temporary variable attached to the character.		   They disappear when the character logs out."$"	  - A global permanent variable.		   They are stored in database table `mapreg`."$@"	 - A global temporary variable.		   They are 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 character, script and scope. Each script		   execution has its 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, its		   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 instance."#"	  - A permanent local account variable."##"	 - A permanent global account variable stored by the login server.		   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 stringnothing - 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  - instance integer variable'name$ - instance 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 

:meow:

Share this post


Link to post
Share on other sites
  • 0

 

@ doc/script_commands.txt

:meow:

 

Thank a lot for your information!

From that i have a question, where can i assign charactor permanent variable? I want it to be assigned when my character first created.

Thank for your time!

Share this post


Link to post
Share on other sites
  • 0
-	script	PcLogin	-1,{OnPCLoginEvent:	if (!<variablename>)		<variablename> = <variablevalue>;	end;}

Where <variablename> is name of the variable, in the format of just name, without any prefixes or suffixes, and <variablevalue> is desired value, since it's a flag 1 should go here, mainly.

Run this script at the start of server via npc/scripts_custom.conf

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.