mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Added count_chosen function;
Added I_DUP instruction git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1007 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -15,3 +15,6 @@ Is the given choice selected in the [[type:value#multiple_choice|multiple choice
|
||||
> chosen(choice: "red", "blue") == false
|
||||
> chosen(choice: "red", "red, blue") == true
|
||||
> chosen(choice: "blue", "red, blue") == true
|
||||
|
||||
--See also--
|
||||
| [[fun:count_chosen]] Count then number of choices selected in a multiple choice value.
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
Function: count_chosen
|
||||
|
||||
DOC_MSE_VERSION: since 0.3.7
|
||||
|
||||
--Usage--
|
||||
> count_chosen(choices: some_string, some_multiple_choice_value)
|
||||
|
||||
Coint the number of choices that are selected in a [[type:value#multiple_choice|multiple choice value]].
|
||||
|
||||
If the @choices@ parameter is given then only choices from that list are counted.
|
||||
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @input@ [[type:string]] Multiple choice value to look in.
|
||||
| @choices@ optional [[type:string]] A comma separated list of choices to look for.
|
||||
|
||||
--Examples--
|
||||
> count_chosen("") == 0
|
||||
> count_chosen("red") == 1
|
||||
> count_chosen("red, green") == 2
|
||||
> count_chosen("red, green", choices: "red,blue") == 1
|
||||
|
||||
--See also--
|
||||
| [[fun:chosen]] Is a given choice selected in a multiple choice value?
|
||||
@@ -56,6 +56,7 @@ These functions are built into the program, other [[type:function]]s can be defi
|
||||
| [[fun:combined_editor]] Use one field to edit multiple others.
|
||||
| [[fun:primary_choice]] Return the top level choice chosen from a choice field.
|
||||
| [[fun:chosen]] Is the given choice selected in a multiple choice value?
|
||||
| [[fun:count_chosen]] Count then number of choices selected in a multiple choice value.
|
||||
| [[fun:require_choice]] Require that at least one of the given choices is selected.
|
||||
| [[fun:exclusive_choice]] Require that at most one of the given choices is selected.
|
||||
| [[fun:require_exclusive_choice]] Require that exactly one of the given choices is selected.
|
||||
|
||||
@@ -10,18 +10,26 @@ If non of the choices is selected, selects the first one.
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @input@ [[type:string]] Multiple choice value to look update.
|
||||
| @choice@ [[type:string]] Choice to require.
|
||||
| @choices@ [[type:string]] Comma separated list of choices of which one is required.
|
||||
|
||||
For backwards compatability the following form is also supported:
|
||||
|
||||
DOC_MSE_VERSION: until 0.3.6
|
||||
|
||||
! Parameter Type Description
|
||||
| @input@ [[type:string]] Multiple choice value to look update.
|
||||
| @choice@ [[type:string]] Single choice to require.
|
||||
| @choice1@ [[type:string]] Require multiple choices.
|
||||
| @choice2@ [[type:string]] ''etc.''
|
||||
|
||||
--Examples--
|
||||
> require_choice(choice: "red", "red") == "red"
|
||||
> require_choice(choice: "red", "blue") == "blue, red"
|
||||
> require_choice(choice: "red", "red, blue") == "red, blue"
|
||||
> require_choice(choice1: "red", choice2: "green", "red, blue") == "red, blue"
|
||||
> require_choice(choice1: "red", choice2: "green", "red, green") == "red, blue"
|
||||
> require_choice(choice1: "red", choice2: "green", "green, blue") == "green, blue"
|
||||
> require_choice(choice1: "red", choice2: "green", "black, blue") == "black, blue, red"
|
||||
> require_choice(choices: "red", "red") == "red"
|
||||
> require_choice(choices: "red", "blue") == "blue, red"
|
||||
> require_choice(choices: "red", "red, blue") == "red, blue"
|
||||
> require_choice(choices: "red,green", "red, blue") == "red, blue"
|
||||
> require_choice(choices: "red,green", "red, green") == "red, blue"
|
||||
> require_choice(choices: "red,green", "green, blue") == "green, blue"
|
||||
> require_choice(choices: "red,green", "black, blue") == "black, blue, red"
|
||||
|
||||
--See also--
|
||||
| [[fun:exclusive_choice]] Require that ''at most one'' of the given choices is selected.
|
||||
|
||||
Reference in New Issue
Block a user