Jump to content
  • 0
Sign in to follow this  
Zirius

Which should I use "break" / "continue" ? Snapping out of while and check var again

Question

Hello! I got this script:

 

prontera,155,180,4	script	This eynt working#2	1_ETC_01,{	if (da_var < 3 ) {			while (da_var < 3) {			switch(da_var) {				case 0:										mes "you hit 0";					da_var = 1;					next;					break;				case 1:										mes "you hit 1";					da_var = 2;					next;					break;				case 2:										mes "you hit 2";					da_var = 3;					mes "Do you want to proceed?";					next;					break;				case 3:										mes "you hit 3";					da_var = 4;					next;					break;			}		}	} else {		mes "you hit rock bottom";		close;	}}
basically, what it does is: a player talks to it and sets the variable "da_var" window by window until it reach "da_var" = 4. What I wish is once it goes to "da_var =4", the NPC would say: "you hit rock bottom" without re-talking to it again. If you test the script, it would get stuck at "you hit 3" and will never go to "you hit rock bottom", unless you re-talk to it.

 

Hope somebody can help.

Thanks!

Edited by Zirius

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

how about get ride of the swtich-case like this

 

prontera,155,180,4	script	This eynt working#2	1_ETC_01,{while(da_var <= 4) {	if(da_var < 4 ) {	 		mes "you hit "+da_var;		next;	} else		mes "you hit rock bottom";	da_var++;}close;   }

Share this post


Link to post
Share on other sites
  • 0

how about get ride of the swtich-case like this

 

 

prontera,155,180,4	script	This eynt working#2	1_ETC_01,{while(da_var <= 4) {	if(da_var < 4 ) {	 		mes "you hit "+da_var;		next;	} else		mes "you hit rock bottom";	da_var++;}close;   }

 

 

I think I need sleep now. My coding is getting very bad. LOL. Thank you very much!

Share this post


Link to post
Share on other sites
  • 0

while isn't needed

prontera,155,180,4	script	This eynt working#2	1_ETC_01,{	da_var++;	if ( da_var < 4 ) 		mes "you hit "+da_var;	else		mes "you hit rock bottom";	close;}

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.