Jump to content
  • 0
Sign in to follow this  
Nebraskka

"goto" alternative?

Question

Heya!

 

While legacy commands like goto being deprecated,

is there any other way to achieve this?

 

prontera,149,266,5    script    Woman    650,{    if(@we_dont_like_her) {        mes "[Woman]";        mes "How about now?";        mes "Do you like me?";        next;        if(select("Yes.:No.")==1)            goto L_NiceGuy;        mes "[Woman]";        mes "Ugh... Bye then.";        close;    }    mes "[Woman]";    mes "Heya!";    next;    switch( select("Hi!:How are you?") ) {        case 1:            mes "[Woman]";            mes "Hello!";            close;        case 2:            mes "[Woman]";            mes "Fine, thanks!";            next;            if ( select("Nice! Bye!:I don't really like you.") == 2 ) {                set @we_dont_like_her;                mes "[Woman]";                mes "Oh. Fine then.";                close;            }L_NiceGuy:            mes "[Woman]";            mes "What a nice guy you are!";            close;    }}                                                                

 

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

In that case, you can insert the piece of code where the goto is; In other more complicated cases you could callsub that, which is basically a goto with the possibility of adding parameters and (to my understanding the reason of avoiding using goto) the ability of returning the control to where it was called when the subprogram execution has been finished.

Share this post


Link to post
Share on other sites
  • 0
	switch(select("Yes.:No."))	{		case 1:			mes "[Woman]";			mes "What a nice guy you are!";			close;		case 2:			mes "[Woman]";			mes "Ugh... Bye then.";			close;	}

 

easy thing xD I came here expecting something complex :P

Edited by evilpuncker

Share this post


Link to post
Share on other sites
  • 0

In

that case, you can insert the piece of code where the goto is; In other

more complicated cases you could callsub that, which is basically a

goto with the possibility of adding parameters and (to my understanding

the reason of avoiding using goto) the ability of returning the control

to where it was called when the subprogram execution has been finished.

 

Hey, callsub would perfectly solve my case!

Thanks for explanation! :lv:

 

 

	switch(select("Yes.:No."))	{		case 1:			mes "[Woman]";			mes "What a nice guy you are!";			close;		case 2:			mes "[Woman]";			mes "Ugh... Bye then.";			close;	}
 

 

easy thing xD I came here expecting something complex :P

 

Oh c'mon, that was an abstract example! :meow:

There probably could be not just 1 dialog, and I wondered about ways of avoiding duplication of code.

 

Anyway, thanks for contributing!

Edited by Nebraskka

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.