crazyarashi Posted August 1, 2017 Group: Developer Topic Count: 50 Topics Per Day: 0.02 Content Count: 776 Reputation: 239 Joined: 02/11/17 Last Seen: Yesterday at 07:27 AM Share Posted August 1, 2017 Hi Good Day Rathena, Im Still in the midst of studying C++ and want to ask a question about making a menu/switch select using an array. Maybe an example will do im a bit confused reading old posts about it :)) 1 Quote Link to comment Share on other sites More sharing options...
0 Emistry Posted August 1, 2017 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Thursday at 04:49 PM Share Posted August 1, 2017 you can try like .. setarray .@menu_item$, "Menu 1", "Menu 2", "Menu 3"; .@menu_item_size = getarraysize(.@menu_item$); for (.@i = 0; .@i < .@menu_item_size; .@i++) { .@menu$ = .@menu$ + (.@i > 0 ? ":" : "") + .@menu_item$[.@i]; } .@i = select( .@menu$ ) - 1; mes "You selected menu : "+ .@menu_item$[.@i]; or setarray .@menu_item$, "Menu 1", "Menu 2", "Menu 3"; .@menu$ = implode(.@menu_item$, ":"); .@i = select( .@menu$ ) - 1; mes "You selected menu : "+ .@menu_item$[.@i]; 2 Quote Link to comment Share on other sites More sharing options...
0 kkeong Posted August 1, 2017 Group: Members Topic Count: 2 Topics Per Day: 0.00 Content Count: 8 Reputation: 5 Joined: 02/17/12 Last Seen: February 21, 2023 Share Posted August 1, 2017 little example setarray A_menu[0],"menu 02","menu 03","menu 04"; set .@menu,"menu 01";//Build First Item on Menu, cant put in <for>, it will looping for(set .@i,0; .@i < getarraysize(A_menu[0]);.@i++) {// add array item to menu set .@menu,.@menu+":"+A_menu[.@i]; } select(.@menu);//menu list show out 2 Quote Link to comment Share on other sites More sharing options...
0 crazyarashi Posted August 1, 2017 Group: Developer Topic Count: 50 Topics Per Day: 0.02 Content Count: 776 Reputation: 239 Joined: 02/11/17 Last Seen: Yesterday at 07:27 AM Author Share Posted August 1, 2017 13 minutes ago, Emistry said: you can try like .. setarray .@menu_item$, "Menu 1", "Menu 2", "Menu 3"; .@menu_item_size = getarraysize(.@menu_item$); for (.@i = 0; .@i < .@menu_item_size; .@i++) { .@menu$ = .@menu$ + (.@i > 0 ? ":" : "") + .@menu_item$[.@i]; } .@i = select( .@menu$ ) - 1; mes "You selected menu : "+ .@menu_item$[.@i]; or setarray .@menu_item$, "Menu 1", "Menu 2", "Menu 3"; .@menu$ = implode(.@menu_item$, ":"); .@i = select( .@menu$ ) - 1; mes "You selected menu : "+ .@menu_item$[.@i]; May I ask what is the use of implode. I haven't studied that yet nor i haven't seen it yet Quote Link to comment Share on other sites More sharing options...
0 Tokei Posted August 1, 2017 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 696 Reputation: 721 Joined: 11/12/12 Last Seen: 15 hours ago Share Posted August 1, 2017 You can check out the script commands over here: https://github.com/rathena/rathena/blob/master/doc/script_commands.txt Search for *implode. 1 Quote Link to comment Share on other sites More sharing options...
0 crazyarashi Posted August 1, 2017 Group: Developer Topic Count: 50 Topics Per Day: 0.02 Content Count: 776 Reputation: 239 Joined: 02/11/17 Last Seen: Yesterday at 07:27 AM Author Share Posted August 1, 2017 5 minutes ago, Tokei said: You can check out the script commands over here: https://github.com/rathena/rathena/blob/master/doc/script_commands.txt Search for *implode. Wokie didn't know it's in there Quote Link to comment Share on other sites More sharing options...
Question
crazyarashi
Hi Good Day Rathena, Im Still in the midst of studying C++ and want to ask a question about making a menu/switch select using an array.
Maybe an example will do im a bit confused reading old posts about it :))
Link to comment
Share on other sites
5 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.