Beret Posted June 7, 2013 Group: Members Topic Count: 60 Topics Per Day: 0.01 Content Count: 174 Reputation: 3 Joined: 06/19/12 Last Seen: September 18, 2024 Share Posted June 7, 2013 (edited) I have an npc as follows. switch(select(("name1:name2:cancel")) { case 1: mes "....."; close; case 2: switch(select(("name1:name2:back")) { case 1: mes "....."; close; case 2: mes "....."; close; case 3: // How to return to the main menu case 3: mes "....."; close; Edited June 7, 2013 by Beret Quote Link to comment Share on other sites More sharing options...
DeadlySilence Posted June 7, 2013 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 181 Reputation: 53 Joined: 04/07/13 Last Seen: August 23, 2014 Share Posted June 7, 2013 As far as I know you either have to put your main menu into a function or into a label. A function would be better as labels are not very good... Quote Link to comment Share on other sites More sharing options...
Beret Posted June 7, 2013 Group: Members Topic Count: 60 Topics Per Day: 0.01 Content Count: 174 Reputation: 3 Joined: 06/19/12 Last Seen: September 18, 2024 Author Share Posted June 7, 2013 Example of how can I do ? Quote Link to comment Share on other sites More sharing options...
Euphy Posted June 8, 2013 Group: Members Topic Count: 72 Topics Per Day: 0.02 Content Count: 2997 Reputation: 1132 Joined: 05/27/12 Last Seen: June 1, 2017 Share Posted June 8, 2013 You need to loop the main menu and break out of submenus. For examples, see the trunk/npc/re/guides/ directory. Quote Link to comment Share on other sites More sharing options...
Beret Posted June 8, 2013 Group: Members Topic Count: 60 Topics Per Day: 0.01 Content Count: 174 Reputation: 3 Joined: 06/19/12 Last Seen: September 18, 2024 Author Share Posted June 8, 2013 (edited) You need to loop the main menu and break out of submenus. For examples, see the trunk/npc/re/guides/ directory. Then would be as follows? while (1) { switch(select(("name1:name2:cancel")) { case 1: mes "....."; close; case 2: set .@loop,1; while (.@loop) { switch(select(("name1:name2:back")) { case 1: mes "....."; close; case 2: mes "....."; close; case 3: set .@loop,0; break; case 3: mes "....."; close; Edited June 8, 2013 by Beret Quote Link to comment Share on other sites More sharing options...
Capuche Posted June 8, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted June 8, 2013 You have some curly errors but yeah something like that while (1) { switch( select( "name1:name2:cancel" ) ) { case 1: mes "....."; close; case 2: while ( .@loop == 0 ) { switch( select( "name1:name2:back" ) ) { case 1: mes "....."; close; case 2: mes "....."; close; case 3: set .@loop,1; break; } } break; case 3: mes "....."; close; } } 1 Quote Link to comment Share on other sites More sharing options...
Beret Posted June 8, 2013 Group: Members Topic Count: 60 Topics Per Day: 0.01 Content Count: 174 Reputation: 3 Joined: 06/19/12 Last Seen: September 18, 2024 Author Share Posted June 8, 2013 (edited) You have some curly errors but yeah something like that while (1) { switch( select( "name1:name2:cancel" ) ) { case 1: mes "....."; close; case 2: while ( .@loop == 0 ) { switch( select( "name1:name2:back" ) ) { case 1: mes "....."; close; case 2: mes "....."; close; case 3: set .@loop,0; break; } } break; case 3: mes "....."; close; } } Now a bit more complicated as would be. switch( select( "name1:name2:cancel" ) ) { case 1: mes "....."; close; } case 2: set .@x, select( "name1:name2:back" ); switch(.@x){ case 1: break; case 2: break; case 3: // How to return to the main menu break; } next; mes "......."; close; case 3: mes "....."; close; Edited June 8, 2013 by Beret Quote Link to comment Share on other sites More sharing options...
Emistry Posted June 8, 2013 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted June 8, 2013 do{ mes "Main Menu ..."; next; switch( select( "Menu1","Menu2","Menu3" ) ){ Case 1: do{ switch( select( "Menu1-1","Menu1-2","Menu1-3" ) ){ Case 1: mes "Menu1-1"; break; Case 2: mes "Menu1-2"; break; Case 3: mes "Menu1-3"; break; default: break; } next; }while( select( "select menu1 again","return to main menu" ) == 1 ); break; Case 2: do{ switch( select( "Menu2-1","Menu2-2","Menu2-3" ) ){ Case 1: mes "Menu2-1"; break; Case 2: mes "Menu2-2"; break; Case 3: mes "Menu2-3"; break; default: break; } next; }while( select( "select menu2 again","return to main menu" ) == 1 ); break; Case 3: do{ switch( select( "Menu3-1","Menu3-2","Menu3-3" ) ){ Case 1: mes "Menu3-1"; break; Case 2: mes "Menu3-2"; break; Case 3: mes "Menu3-3"; break; default: break; } next; }while( select( "select menu3 again","return to main menu" ) == 1 ); default: break; } mes "Redirecting...."; }while( select( "Continue","Close" ) == 1 ); close; just add a "loop" at every menu ....and check the selection made by users to decide whether return to main menu or not... there are also other way like...using goto ... and etc... Quote Link to comment Share on other sites More sharing options...
Beret Posted June 8, 2013 Group: Members Topic Count: 60 Topics Per Day: 0.01 Content Count: 174 Reputation: 3 Joined: 06/19/12 Last Seen: September 18, 2024 Author Share Posted June 8, 2013 do{ mes "Main Menu ..."; next; switch( select( "Menu1","Menu2","Menu3" ) ){ Case 1: do{ switch( select( "Menu1-1","Menu1-2","Menu1-3" ) ){ Case 1: mes "Menu1-1"; break; Case 2: mes "Menu1-2"; break; Case 3: mes "Menu1-3"; break; default: break; } next; }while( select( "select menu1 again","return to main menu" ) == 1 ); break; Case 2: do{ switch( select( "Menu2-1","Menu2-2","Menu2-3" ) ){ Case 1: mes "Menu2-1"; break; Case 2: mes "Menu2-2"; break; Case 3: mes "Menu2-3"; break; default: break; } next; }while( select( "select menu2 again","return to main menu" ) == 1 ); break; Case 3: do{ switch( select( "Menu3-1","Menu3-2","Menu3-3" ) ){ Case 1: mes "Menu3-1"; break; Case 2: mes "Menu3-2"; break; Case 3: mes "Menu3-3"; break; default: break; } next; }while( select( "select menu3 again","return to main menu" ) == 1 ); default: break; } mes "Redirecting...."; }while( select( "Continue","Close" ) == 1 ); close; just add a "loop" at every menu ....and check the selection made by users to decide whether return to main menu or not... there are also other way like...using goto ... and etc... more would I do as in the model that the Capuche made Emistry? the problem is only in set @ x, select ("name1 name2: back:"); switch (@ x) { Quote Link to comment Share on other sites More sharing options...
Emistry Posted June 8, 2013 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted June 8, 2013 while (.@loop) { switch(select(("name1:name2:back")) { case 1: mes "....."; break; case 2: mes "....."; break; case 3: set .@loop,0; } } break; Quote Link to comment Share on other sites More sharing options...
Beret Posted June 8, 2013 Group: Members Topic Count: 60 Topics Per Day: 0.01 Content Count: 174 Reputation: 3 Joined: 06/19/12 Last Seen: September 18, 2024 Author Share Posted June 8, 2013 (edited) can close, got it. Edited June 8, 2013 by Beret Quote Link to comment Share on other sites More sharing options...
Question
Beret
I have an npc as follows.
Link to comment
Share on other sites
10 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.