<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://wiki.lostsouls.org/w/skins/common/feed.css"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.lostsouls.org/w/index.php?action=history&amp;feed=atom&amp;title=Man_input</id>
		<title>Man input - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.lostsouls.org/w/index.php?action=history&amp;feed=atom&amp;title=Man_input"/>
		<link rel="alternate" type="text/html" href="http://wiki.lostsouls.org/w/index.php?title=Man_input&amp;action=history"/>
		<updated>2026-05-03T11:38:59Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.8.2</generator>

	<entry>
		<id>http://wiki.lostsouls.org/w/index.php?title=Man_input&amp;diff=3994&amp;oldid=prev</id>
		<title>Laine at 22:08, 11 June 2007</title>
		<link rel="alternate" type="text/html" href="http://wiki.lostsouls.org/w/index.php?title=Man_input&amp;diff=3994&amp;oldid=prev"/>
				<updated>2007-06-11T22:08:01Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Files==&lt;br /&gt;
&lt;br /&gt;
 /lib/input.h&lt;br /&gt;
 /daemon/input.c&lt;br /&gt;
 /std/def/input.c&lt;br /&gt;
 /def/input&lt;br /&gt;
 /def/descriptor/dialog.c&lt;br /&gt;
 /lib/descriptors/dialog.h&lt;br /&gt;
 /def/descriptor/menu_item.c&lt;br /&gt;
 /lib/descriptors/menu_item.h&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
The input system is a set of mechanics for handling input dialogs with&lt;br /&gt;
users.  It uses the input_to() function at its core, but greatly extends and&lt;br /&gt;
refines the capabilities of that routine.&lt;br /&gt;
&lt;br /&gt;
Input dialogs are defined using dialog descriptors, documented in 'man&lt;br /&gt;
dialog'.  Much of what you need to know to use the input system is in that&lt;br /&gt;
file; this document concentrates on describing the various input types from a&lt;br /&gt;
user perspective.  If you are a core systems developer who needs to maintain&lt;br /&gt;
the input system, you will want to be familiar with this document and then&lt;br /&gt;
proceed to 'man input_core'.&lt;br /&gt;
&lt;br /&gt;
A reasonably good starting example of the input system in action can be&lt;br /&gt;
found in /daemon/mudlib_change.c, which uses a series of text dialogs followed&lt;br /&gt;
by a single-character-input menu.  The example is simple enough not to be&lt;br /&gt;
too overwhelming but exercises the system's features well.  Other prominent&lt;br /&gt;
examples of input system usage include /obj/interfaces/login.c, /std/atman.c,&lt;br /&gt;
and /daemon/more.c.&lt;br /&gt;
&lt;br /&gt;
===Input Types===&lt;br /&gt;
&lt;br /&gt;
The input types are listed in /lib/input.h, and are as follows.  Comments&lt;br /&gt;
relevant to particular dialog fields and flags are noted below the type.&lt;br /&gt;
&lt;br /&gt;
Input_Text: A simple line-of-text input.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Input: Will be set to the text line received (without newline),&lt;br /&gt;
    or the default value if appropriate.&lt;br /&gt;
&lt;br /&gt;
Input_Password: Similar to Input_Text, but specialized for passwords.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Input: Will be set to the text line received (without newline),&lt;br /&gt;
    or the default value if appropriate.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flags:&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_Hidden: Automatically turned on.&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_No_Override: Automatically turned on.&lt;br /&gt;
&lt;br /&gt;
Input_Character: A special mode for single-character input, intended for&lt;br /&gt;
situations where a complex interface is being controlled by character-mode&lt;br /&gt;
input.  Usually, when you want single-character input, all you really need&lt;br /&gt;
is to turn on Dialog_Flag_Single_Character in a yes-or-no or menu dialog,&lt;br /&gt;
rather than using this input type.  This type the special behavior that, if&lt;br /&gt;
multiple characters are received (as will occur if character mode cannot be&lt;br /&gt;
engaged), the system will attempt to process the characters as individual&lt;br /&gt;
responses.  It will only be able to do so as long as the action triggered&lt;br /&gt;
by each character continues to keep the current dialog engaged, however.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Input: Will be set to the *integer* character value received.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flags:&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_Single_Character: Automatically turned on.&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_No_Override: Automatically turned on.&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_Default: Automatically turned on.&lt;br /&gt;
&lt;br /&gt;
Input_Yes_No: A dialog requiring a yes/no response.  The Dialog_Input&lt;br /&gt;
&lt;br /&gt;
    Dialog_Input: Will be set to True for a &amp;quot;yes&amp;quot; response and False for&lt;br /&gt;
    a &amp;quot;no&amp;quot; response.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Default: Should be set to True for a &amp;quot;yes&amp;quot; default and False&lt;br /&gt;
    for a &amp;quot;no&amp;quot; default.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flags:&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_Full_Word: Causes a requirement that the entire word&lt;br /&gt;
        &amp;quot;yes&amp;quot; or &amp;quot;no&amp;quot; to be input rather than simply &amp;quot;y&amp;quot; or &amp;quot;n&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_Match_Case: Causes a requirement that the response be&lt;br /&gt;
        &amp;quot;Y&amp;quot; or &amp;quot;N&amp;quot;, without Dialog_Flag_Full_Word, or &amp;quot;Yes&amp;quot; or &amp;quot;No&amp;quot; with&lt;br /&gt;
        Dialog_Flag_Full_Word.&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_Suppress_Prompt_Add: The input type normally appends&lt;br /&gt;
        a &amp;quot;response guide&amp;quot; to the prompt, which will look like &amp;quot;[y/n]&amp;quot;,&lt;br /&gt;
        varying depending on the dialog settings; for example, if there&lt;br /&gt;
        is a default, it will be capitalized.  This flag prevents this&lt;br /&gt;
        from occurring.&lt;br /&gt;
&lt;br /&gt;
Input_Yes_No_Other: A dialog requiring a response of yes, no, or a third&lt;br /&gt;
option.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Input: Will be set to True for a &amp;quot;yes&amp;quot; response, False for a&lt;br /&gt;
    &amp;quot;no&amp;quot; response, and Null for an &amp;quot;other&amp;quot; response.  &lt;br /&gt;
&lt;br /&gt;
    Dialog_Default: Should be set to True for a &amp;quot;yes&amp;quot; default, False for&lt;br /&gt;
    a &amp;quot;no&amp;quot; default, and Null for an &amp;quot;other&amp;quot; default.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Content: Defines the word for the &amp;quot;other&amp;quot; response; defaults&lt;br /&gt;
    to &amp;quot;Quit&amp;quot;.  Your setting should use the same capitalization pattern&lt;br /&gt;
    and not begin with &amp;quot;Y&amp;quot; or &amp;quot;N&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flags:&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_Full_Word: Causes a requirement that the entire&lt;br /&gt;
        word of the response be typed in rather than merely the first&lt;br /&gt;
        character of it.&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_Match_Case: Requires case matching; the case patterns&lt;br /&gt;
        for the yes and no choices are &amp;quot;Yes&amp;quot; and &amp;quot;No&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_Suppress_Prompt_Add: The input type normally appends a&lt;br /&gt;
        &amp;quot;response guide&amp;quot; to the prompt, which will look like &amp;quot;[y/n/q]&amp;quot;,&lt;br /&gt;
        varying depending on the dialog settings; for example, if there is&lt;br /&gt;
        a default, it will be capitalized.  This flag prevents this from&lt;br /&gt;
        occurring.&lt;br /&gt;
&lt;br /&gt;
Input_Option: A dialog with valid responses limited to a specific list.&lt;br /&gt;
Though this input type is available, be aware that often an Input_Menu is&lt;br /&gt;
a better way to handle situations it is applicable to.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Input: Will be set to the string selected from the option list.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Content: A string array of the valid options.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flags:&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_Match_Case: Specifies case-sensitive matching; normally&lt;br /&gt;
        matching is case insensitive.&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_Suppress_Prompt_Add: Normally, if a default is present,&lt;br /&gt;
        the input type will append to the prompt an indication of the&lt;br /&gt;
        default; for example, if the default is &amp;quot;N&amp;quot;, the prompt add will&lt;br /&gt;
        look like &amp;quot;[N]&amp;quot;.  This flag prevents this from occurring.&lt;br /&gt;
&lt;br /&gt;
Input_Menu: A dialog where valid options are defined by a set of menu item&lt;br /&gt;
descriptors.  See 'man menu_item' for specifics on this type of descriptor.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Input: Will be set to the menu item descriptor which was&lt;br /&gt;
    selected.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Content: Is an array of the menu item descriptors for the menu.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Action: Is used only if the selected menu item descriptor&lt;br /&gt;
    defines no action.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flags:&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_Match_Case: Matching of input to menu item keys is case&lt;br /&gt;
        insensitive unless this flag is turned on.&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_Suppress_Desc_Add: Normally, a menu dialog will&lt;br /&gt;
        generate additional content to be added to the Dialog_Desc based&lt;br /&gt;
        on the menu items; this flag prevents this.&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_Suppress_Prompt_Add: Normally, if a default is present,&lt;br /&gt;
        the input type will append to the prompt an indication of the&lt;br /&gt;
        default; for example, if the default is &amp;quot;N&amp;quot;, the prompt add will&lt;br /&gt;
        look like &amp;quot;[N]&amp;quot;.  This flag prevents this from occurring.&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_Suppress_Extra_Line: The input type normally adds a&lt;br /&gt;
        blank line between the dialog descriptive content and the prompt,&lt;br /&gt;
        unless this flag is present.  (Dialog_Flag_Suppress_Desc_Add makes&lt;br /&gt;
        this flag superfluous.)&lt;br /&gt;
&lt;br /&gt;
Input_Block: A dialog for input of multiple lines of text.  The user is&lt;br /&gt;
provided with a simple interface that allows arbitrary lines of text to be&lt;br /&gt;
entered, but has no editing capability.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Input: Will be set to the final text block.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Action: Is only carried out once the user is finished.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Max_Length: If specified, this is the maximum number of lines&lt;br /&gt;
    that may be entered.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flags:&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_Suppress_Desc_Add: Normally, a block dialog will&lt;br /&gt;
        generate an introductory message requesting input and giving the&lt;br /&gt;
        basic options for the dialog.  This flag prevents this.&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_No_Abort: Disallows the user from aborting the dialog.&lt;br /&gt;
&lt;br /&gt;
Input_Simple_Edit: A dialog form that encapsulates editing a text document&lt;br /&gt;
with a simple non-modal editor reasonably suitable for players.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Input: Will be set to the final document.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Action: Is only carried out once the user is finished.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Content: If set, specifies the initial content of the document.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Max_Length: If specified, this is the maximum number of lines&lt;br /&gt;
    that may be entered.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flags:&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_Suppress_Desc_Add: Normally, the input type will&lt;br /&gt;
        generate an introductory message requesting input and giving an&lt;br /&gt;
        overview of a few editor commands.  This flag prevents this.&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_No_Abort: Disallows the user from aborting the dialog.&lt;br /&gt;
&lt;br /&gt;
Input_Line_Edit: A dialog form that encapsulates editing a text document&lt;br /&gt;
with a modal line editor, designed to resemble Unix's ed and ex, generally&lt;br /&gt;
only suitable for developer use.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Input: Will be set to the final document.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Action: Is only carried out once the user is finished.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Content: If set, specifies the initial content of the document.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Max_Length: If specified, this is the maximum number of lines&lt;br /&gt;
    that may be entered.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flags:&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_Suppress_Desc_Add: Normally, the input type will&lt;br /&gt;
        generate an introductory message requesting input and giving an&lt;br /&gt;
        overview of a few editor commands.  This flag prevents this.&lt;br /&gt;
&lt;br /&gt;
        Dialog_Flag_No_Abort: Disallows the user from aborting the dialog.&lt;br /&gt;
&lt;br /&gt;
Input_Screen_Edit: Unimplemented.  Intended to be used for a screen-based&lt;br /&gt;
non-modal editor suitable for player use.&lt;br /&gt;
&lt;br /&gt;
Input_Visual_Edit: Unimplemented.  Intended to be used for a screen-based&lt;br /&gt;
modal editor resembling Unix's vi, suitable for developer use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
[[man dialog|dialog(descriptors)]], [[man menu item|menu_item(descriptors)]], [[man descriptors|descriptors(mechanisms)]], [[man input core|input_core(mechanisms)]], [[man input to|input_to(efun)]]&lt;/div&gt;</summary>
		<author><name>Laine</name></author>	</entry>

	</feed>