Jump to content
  • 0
eKoh

I have a dought with @var .@var

Question

I don't know in what scenarios I am supposed to use these kind of variables.

 

In script_commands.txt I get this:

 

@ <- A temporary variable attached to the character.

 

so if I do

 

set @newtag,1;

 

The player will have that tag, right?

 

And also How temporary is the variable?

 

.@ <- A scope variable.

 

I just don't understand the description. I have read it like 10 times...

 

Is this variable attached to the player and also the Npc? If so, which scenarios I would use a .@variable?

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0
prontera,150,150,5    script    TempSet    999,{@var = 1;.@var = 1;mes "Value has been Set";close;}prontera,148,148,5    script    TempGet    999,{mes ".@var:"+.@var;mes "@var:"+@var;close;}

Above is example.

 

@var will be set till the character logs off(as said temporary)

.@var is set until the script execution,(i.e for that instance), that is if the script execution is stopped, .@var will be set to 0 again.

If you click on TempSet First(NPC Above), it will set both vars to 1.

then Click on TempGet, it will show @var as 1 and not .@var, since its new script been executed.

Share this post


Link to post
Share on other sites
  • 0

Oh I see, thank you man, your explanation was so easy to understand.
 
But I have another dought, currently I am working on a script, and I want to make a "Back" option like:
 
 

 

mes "What you want to do";switch ( select ("Thing 1:Thing 2")){  case 1:  mes "You selected thing 1";  next;    mes "What you want to do?";    switch ( select ("Thing 3:Back")){	   case 1:	    mes "You selected thing 3";	    close;	    end; //<- Also I don't know if I have to put end; instruction, because I already have a close; above. Do I?	    case 2:		 "Go back instruction" // Is there an instruction that makes this??		 end;end; case 2: mes "You selectend thing 2"; close; end;} 

 


 
Sorry for my noobness, how do I put code box here?:S

Edited by Dastgir
codebox

Share this post


Link to post
Share on other sites
  • 0

 

Sorry for my noobness, how do I put code box here?:S

There's button before Quote, to put a codebox

 

 

end; //<- Also I don't know if I have to put end; instruction, because I already have a close; above. Do I? 

Nope, you are not required to put end; after close; since close will stop the script execution.

 

About Back, Something Like THis:

L_SomeLabel:mes "What you want to do";switch ( select ("Thing 1:Thing 2")){	case 1:		mes "You selected thing 1";		next;		mes "What you want to do?";		switch ( select ("Thing 3:Back")){			case 1:				mes "You selected thing 3";				close;			case 2:								next;				goto L_SomeLabel;				end;		}		 	case 2:		mes "You selectend thing 2";		close;} 

Share this post


Link to post
Share on other sites
  • 0

Ohh, thank you man. And I will test that Label function to make it work, I really appreciate all your help.

 

Update.

 

It works!! thank you a lot ;D! the sample:

 

			mes ""+.npc$+"";			mes "Ok, so ^0000FFautoloot^000000 it is";			mes "Please input the ^0000FF%^000000 you want";			goto L_Alootrate;			L_Alootrate:				input #alootrate;					mes "Great so is ^FF0000"+#alootrate+"%^000000 is fine?";					if ( select("Yes:No") == 1 ){						mes "There you go!";						atcommand "@autoloot "+#alootrate+"";						close;					}	else goto L_Alootrate;
Edited by eKoh

Share this post


Link to post
Share on other sites
  • 0
mes ""+.npc$+"";			mes "Ok, so ^0000FFautoloot^000000 it is";			mes "Please input the ^0000FF%^000000 you want";			L_Alootrate:				input #alootrate;					mes "Great so is ^FF0000"+#alootrate+"%^000000 is fine?";					if ( select("Yes:No") == 1 ){						mes "There you go!";						atcommand "@autoloot "+#alootrate+"";						close;					}	else goto L_Alootrate;

you don't need "goto L_Alootrate;" before the label, since the script is not ending there, even if (AnyLabel:) is found, it continues to execute.

the script ends if there's "close;" "close2;" or "end;" function.

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

×
×
  • Create New...

Important Information

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