"goto" alternative?

Nebraskka

New member
Messages
44
Points
0
Heya!

While legacy commands like goto being deprecated,

is there any other way to achieve this?

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

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


 
Last edited by a moderator:
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!
default_lv.gif


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
default_tongue.png
Oh c'mon, that was an abstract example!
default_ani_meow.gif


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

Anyway, thanks for contributing!

 
Last edited by a moderator:
Back
Top