crazyarashi Posted August 1, 2017 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 Share Posted August 1, 2017 you can try like .. setarray [email protected]_item$, "Menu 1", "Menu 2", "Menu 3"; [email protected]_item_size = getarraysize([email protected]_item$); for ([email protected] = 0; [email protected] < [email protected]_item_size; [email protected]++) { [email protected]$ = [email protected]$ + ([email protected] > 0 ? ":" : "") + [email protected]_item$[[email protected]]; } [email protected] = select( [email protected]$ ) - 1; mes "You selected menu : "+ [email protected]_item$[[email protected]]; or setarray [email protected]_item$, "Menu 1", "Menu 2", "Menu 3"; [email protected]$ = implode([email protected]_item$, ":"); [email protected] = select( [email protected]$ ) - 1; mes "You selected menu : "+ [email protected]_item$[[email protected]]; 2 Quote Link to comment Share on other sites More sharing options...
0 kkeong Posted August 1, 2017 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 Author Share Posted August 1, 2017 13 minutes ago, Emistry said: you can try like .. setarray [email protected]_item$, "Menu 1", "Menu 2", "Menu 3"; [email protected]_item_size = getarraysize([email protected]_item$); for ([email protected] = 0; [email protected] < [email protected]_item_size; [email protected]++) { [email protected]$ = [email protected]$ + ([email protected] > 0 ? ":" : "") + [email protected]_item$[[email protected]]; } [email protected] = select( [email protected]$ ) - 1; mes "You selected menu : "+ [email protected]_item$[[email protected]]; or setarray [email protected]_item$, "Menu 1", "Menu 2", "Menu 3"; [email protected]$ = implode([email protected]_item$, ":"); [email protected] = select( [email protected]$ ) - 1; mes "You selected menu : "+ [email protected]_item$[[email protected]]; 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 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 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...
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