Available choice select inputs: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 10: Line 10:
|code1={{CodeSample
|code1={{CodeSample
   |title=Code Samples
   |title=Code Samples
   |description= Running the following Code on the Exploaded Battlefield choice:
   |description= Running the following Code on the [https://kol.coldfront.net/thekolwiki/index.php/The_Exploaded_Battlefield Exploaded Battlefield] choice:
   |code=
   |code=
     <syntaxhighlight lang="d">
     <syntaxhighlight lang="d">
Line 62: Line 62:
|more_info=
|more_info=
|special=
|special=
|needscode=yes
|{{{1|}}}
|{{{1|}}}
}}</onlyinclude>
}}</onlyinclude>
[[Category:Adventuring]]
[[Category:Adventuring]]

Latest revision as of 10:08, 23 April 2023

Function Syntax

string[string, string] available_choice_select_inputsint 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

See Also

available_choice_options() | available_choice_text_inputs()