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

Zirius

New member
Messages
261
Points
0
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!

 
Last edited by a moderator:
how about get ride of the swtich-case like this

Code:
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;   }
 
how about get ride of the swtich-case like this

Code:
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!
 
while isn't needed

Code:
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;}
 
Back
Top