Available choice select inputs: Difference between revisions
Jump to navigation
Jump to search
Undo revision 9195 by Eliteofdelete (talk) Tag: Undo |
No edit summary |
||
Line 1: | Line 1: | ||
<onlyinclude>{{{{{format|Function2}}} | <onlyinclude>{{{{{format|Function2}}} | ||
|name=available_choice_select_inputs | |name=available_choice_select_inputs | ||
|function1.return_type={{type|string}} | |function1.return_type={{type|string}}{{opt|{{type|string}}, {{type|string}}}} | ||
|function1.description= | |function1.description=For the specified decision, returns a map from NAME to a map from VALUE to DESCRIPTION. | ||
|function1.param1= | |function1.param1=decision | ||
|function1.param1.type=int | |function1.param1.type=int | ||
|function1.param1.default= | |function1.param1.default= | ||
|function1.param1.description= | |function1.param1.description= | ||
|description=This was added in | |description=This function was added in [https://sourceforge.net/p/kolmafia/code/19543 r19543] and explained by Veracity in the [https://kolmafia.us/threads/allow-property-choiceadventurexxx-url.24195/#post-154288 following post]. | ||
|code1={{CodeSample | |code1={{CodeSample | ||
|title=Code Samples | |title=Code Samples | ||
|description= | |description= Running the following Code on the Exploaded Battlefield choice: | ||
|code= | |code= | ||
|moreinfo= | <syntaxhighlight lang="d"> | ||
foreach decision, description in available_choice_options() { | |||
print( "Choice " + decision + ": " + description ); | |||
string[string][string] selects = available_choice_select_inputs( decision ); | |||
foreach name in selects { | |||
string[string] mapping = selects[name]; | |||
print( " select = " + name + " (" + count(mapping) + " options)" ); | |||
foreach value, desc in mapping { | |||
print( " " + value + " => " + desc ); | |||
} | |||
} | |||
string[string] texts = available_choice_text_inputs( decision ); | |||
foreach text, desc in texts { | |||
print( " text = " + text ); | |||
} | |||
} | |||
</syntaxhighlight>| | |||
|moreinfo= Will give the following output: <pre>Choice 1: Toss! | |||
select = tossid (24 options) | |||
0 => --- select an item --- | |||
10179 => plain snowcone (12) (5 casualties) | |||
161 => ghuol egg (2) (5 casualties) | |||
1769 => fricasseed brains (5 casualties) | |||
1776 => stale baguette (5 casualties) | |||
1778 => ancient frozen dinner (6 casualties) | |||
1952 => desiccated apricot (5 casualties) | |||
1954 => dehydrated caviar (5 casualties) | |||
2063 => blackberry (2) (5 casualties) | |||
2843 => dire fudgesicle (2) (5 casualties) | |||
330 => glass of goat's milk (5 casualties) | |||
3555 => sea carrot (5 casualties) | |||
471 => hot wing (6) (5 casualties) | |||
6416 => mana curds (10 casualties) | |||
6422 => vampire chowder (10 casualties) | |||
669 => ghuol guolash (18 casualties) | |||
6705 => jungle floor wax (6 casualties) | |||
672 => cranberries (3) (5 casualties) | |||
7368 => extra-flat panini (2) (8 casualties) | |||
7375 => actual tapas (5 casualties) | |||
8412 => succulent marrow (3) (6 casualties) | |||
8413 => salacious crumbs (5) (6 casualties) | |||
8526 => pink slime (2) (5 casualties) | |||
9953 => PB&J with the crusts cut off (4) (5 casualties) | |||
Choice 2: Never Mind</pre> | |||
}} | }} | ||
|see_also={{SeeAlso|}} | |see_also={{SeeAlso|available_choice_options|available_choice_text_inputs}} | ||
|cli_equiv= | |cli_equiv= | ||
|more_info= | |more_info= |
Revision as of 10:00, 23 April 2023
needs(code_samples);
Function Syntax
string[string, string] available_choice_select_inputs( int decision )
- For the specified decision, returns a map from NAME to a map from VALUE to DESCRIPTION.
- decision:
This function was added in r19543 and explained by Veracity in the following post.
Code Samples
Running the following Code on the Exploaded Battlefield choice:
foreach decision, description in available_choice_options() {
print( "Choice " + decision + ": " + description );
string[string][string] selects = available_choice_select_inputs( decision );
foreach name in selects {
string[string] mapping = selects[name];
print( " select = " + name + " (" + count(mapping) + " options)" );
foreach value, desc in mapping {
print( " " + value + " => " + desc );
}
}
string[string] texts = available_choice_text_inputs( decision );
foreach text, desc in texts {
print( " text = " + text );
}
}
Will give the following output:
Choice 1: Toss! select = tossid (24 options) 0 => --- select an item --- 10179 => plain snowcone (12) (5 casualties) 161 => ghuol egg (2) (5 casualties) 1769 => fricasseed brains (5 casualties) 1776 => stale baguette (5 casualties) 1778 => ancient frozen dinner (6 casualties) 1952 => desiccated apricot (5 casualties) 1954 => dehydrated caviar (5 casualties) 2063 => blackberry (2) (5 casualties) 2843 => dire fudgesicle (2) (5 casualties) 330 => glass of goat's milk (5 casualties) 3555 => sea carrot (5 casualties) 471 => hot wing (6) (5 casualties) 6416 => mana curds (10 casualties) 6422 => vampire chowder (10 casualties) 669 => ghuol guolash (18 casualties) 6705 => jungle floor wax (6 casualties) 672 => cranberries (3) (5 casualties) 7368 => extra-flat panini (2) (8 casualties) 7375 => actual tapas (5 casualties) 8412 => succulent marrow (3) (6 casualties) 8413 => salacious crumbs (5) (6 casualties) 8526 => pink slime (2) (5 casualties) 9953 => PB&J with the crusts cut off (4) (5 casualties) Choice 2: Never Mind