crazyarashi Posted August 1, 2017 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
0 Emistry Posted August 1, 2017 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
0 kkeong Posted August 1, 2017 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
0 crazyarashi Posted August 1, 2017 Author 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
0 Tokei Posted August 1, 2017 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
0 crazyarashi Posted August 1, 2017 Author 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
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 :))
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.