-
Notifications
You must be signed in to change notification settings - Fork 758
Select
Haru edited this page Oct 19, 2016
·
1 revision
- select("<option></option>"{,"<option></option>",...});
- select("<op></op>{:<option></option>:<option></option>}");
- prompt("<option></option>"{,"<option></option>",...});
- prompt("<option></option>{:<option></option>:<option></option>}");
This function is a handy replacement for 'menu' for some specific cases where you don't want a complex label structure - like, for example, asking simple yes-no questions. It will return the number of menu option picked, starting with 1. Like 'menu', it will also set the variable @menu to contain the option the user picked.
And like 'menu', the selected option is consistent with grouped options and empty options.
'prompt' works almost the same as 'select', except that when a character clicks the Cancel button, this function will return 255 instead.
[[select]]("21","22","23"); [[set]] .@opt,20+@menu; [[set]] .@choice$,"Apple:Banana:Lemon"; [[select]](.@choice$); [[explode]](.@option$,.@choice$,":"); [[mes]] "You have chosen "+.@option$[@menu-1];