<?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_dialog</id>
		<title>Man dialog - 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_dialog"/>
		<link rel="alternate" type="text/html" href="http://wiki.lostsouls.org/w/index.php?title=Man_dialog&amp;action=history"/>
		<updated>2026-05-07T01:17:23Z</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_dialog&amp;diff=3963&amp;oldid=prev</id>
		<title>Laine at 20:11, 11 June 2007</title>
		<link rel="alternate" type="text/html" href="http://wiki.lostsouls.org/w/index.php?title=Man_dialog&amp;diff=3963&amp;oldid=prev"/>
				<updated>2007-06-11T20:11:54Z</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;
 /daemon/input.c&lt;br /&gt;
 /def/descriptor/dialog.c&lt;br /&gt;
 /lib/descriptors/dialog.h&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
Dialog descriptors are used by the input system to manage the data&lt;br /&gt;
associated with input dialogs.  See 'man input' for documentation on the&lt;br /&gt;
input system itself; see 'man descriptors' for a general overview of the&lt;br /&gt;
descriptor system.  One type of dialog, menu dialogs, also use menu item&lt;br /&gt;
descriptors, documented in 'man menu_item'.&lt;br /&gt;
&lt;br /&gt;
The header file for dialog descriptors is /lib/descriptors/dialog.h;&lt;br /&gt;
however, for working with them, it is generally preferable to #include&lt;br /&gt;
&amp;lt;input.h&amp;gt;, since that file automatically includes dialog.h and contains&lt;br /&gt;
the input type macros you will also need.&lt;br /&gt;
&lt;br /&gt;
===Dialog Colorization===&lt;br /&gt;
&lt;br /&gt;
Dialog descriptors support a specialization of the color system based on&lt;br /&gt;
a generic color and a highlight color.  Practically anything that winds up&lt;br /&gt;
being displayed via a dialog descriptor can be defined as any of the below:&lt;br /&gt;
&lt;br /&gt;
    A string: Will be colorized with the generic color.&lt;br /&gt;
&lt;br /&gt;
    An array: String elements at the first level of the array will be&lt;br /&gt;
    colorized with the generic color, those at the second level of the&lt;br /&gt;
    array will be colored with the highlight color, and the entirety will&lt;br /&gt;
    be joined together.  A simple example will illustrate the principle:&lt;br /&gt;
    the array ({ &amp;quot;A &amp;quot;, ({ &amp;quot;highlighted&amp;quot; }), &amp;quot; message&amp;quot; }) will be resolved&lt;br /&gt;
    to &amp;quot;A highlighted message&amp;quot;, with the word &amp;quot;highlighted&amp;quot; in the&lt;br /&gt;
    highlight color and the rest in the generic color.&lt;br /&gt;
&lt;br /&gt;
    A closure: Will be called with the dialog descriptor as argument, and&lt;br /&gt;
    is expected to return 0 (resulting in no display) or one of the above&lt;br /&gt;
    options.&lt;br /&gt;
&lt;br /&gt;
The purpose of all this is to provide a simple, easy-to-use format that&lt;br /&gt;
makes quick work of tweaking the color &amp;quot;style&amp;quot; of a set of input dialogs.&lt;br /&gt;
Ordinary color codes may still be used when neither the generic nor the&lt;br /&gt;
highlight color is what you want.&lt;br /&gt;
&lt;br /&gt;
===Dialog Actions===&lt;br /&gt;
&lt;br /&gt;
Dialogs define actions which are to take place upon receiving a response&lt;br /&gt;
from the user.  Most typically, this is done by supplying a closure that&lt;br /&gt;
receives the dialog descriptor as argument, analyzes the response, and&lt;br /&gt;
provides a return value that indicates what action should be taken.&lt;br /&gt;
However, any of those return values could also simply be given as the&lt;br /&gt;
action itself, without involving the closure.  (This makes more sense&lt;br /&gt;
when dealing with menu dialogs, where each menu item can define its own&lt;br /&gt;
action.)  The list below defines the valid actions which can be specified&lt;br /&gt;
as the return value of a closure action or as the action itself.&lt;br /&gt;
&lt;br /&gt;
Dialog_Action_None: Take no further action; effectively terminates the&lt;br /&gt;
dialog.&lt;br /&gt;
&lt;br /&gt;
Dialog_Action_Redisplay: Re-request input, redisplaying the entire&lt;br /&gt;
descriptive content for the dialog.&lt;br /&gt;
&lt;br /&gt;
Dialog_Action_Reprompt: Re-request input, displaying only the prompt.&lt;br /&gt;
&lt;br /&gt;
Dialog_Action_Attach: Send the user to a sub-dialog.  The dialog to attach&lt;br /&gt;
is specified by setting the Dialog_Next field in the current dialog.  The&lt;br /&gt;
attached dialog will automatically have its Dialog_Attached field set to&lt;br /&gt;
the current dialog, its Dialog_User set the same as in the current dialog,&lt;br /&gt;
and its Dialog_Extra field set the same as in the current dialog if it&lt;br /&gt;
does not already have a setting for that field.  The Dialog_Next field in&lt;br /&gt;
the current dialog will be cleared when this action is carried out.&lt;br /&gt;
&lt;br /&gt;
Dialog_Action_Return: Return to a previous dialog, found in the&lt;br /&gt;
Dialog_Attached field, displaying the entire descriptive content for that&lt;br /&gt;
dialog.  The Dialog_User field in the dialog being returned to will be set&lt;br /&gt;
the same as in the current dialog.&lt;br /&gt;
&lt;br /&gt;
Dialog_Action_Return_Prompt: The same as Dialog_Action_Return, except only&lt;br /&gt;
the prompt for the dialog being returned to is displayed.&lt;br /&gt;
&lt;br /&gt;
Dialog_Action_Transfer: Transfer to the dialog in the Dialog_Next field.&lt;br /&gt;
This differs from Dialog_Action_Attach in that the new dialog is not&lt;br /&gt;
considered a sub-dialog of this one; it is a &amp;quot;lateral&amp;quot; transfer.  The&lt;br /&gt;
dialog being transferred to will have its Dialog_Attached and Dialog_User&lt;br /&gt;
fields set the same as in the current dialog, as well as its Dialog_Extra&lt;br /&gt;
unless it already has a value for that field.  The Dialog_Next field in&lt;br /&gt;
the current dialog will be cleared when this action is carried out.&lt;br /&gt;
&lt;br /&gt;
A dialog descriptor: As an action specification, places the dialog&lt;br /&gt;
specified in the current dialog's Dialog_Next field and acts as if&lt;br /&gt;
Dialog_Action_Attach had been returned.&lt;br /&gt;
&lt;br /&gt;
===Fields===&lt;br /&gt;
&lt;br /&gt;
Dialog descriptors essentially have three kinds of fields: public fields,&lt;br /&gt;
internal fields which are intended for your use in some fashion, and&lt;br /&gt;
internal fields that should be left alone.&lt;br /&gt;
&lt;br /&gt;
====Public Fields====&lt;br /&gt;
&lt;br /&gt;
Dialog_Type: Sets the type of input dialog, generally using one of the type&lt;br /&gt;
macros from input.h, such as Input_Text, Input_Yes_No, or Input_Menu.&lt;br /&gt;
The characteristic behavior of each of the input types is described in&lt;br /&gt;
'man input'.&lt;br /&gt;
&lt;br /&gt;
Dialog_Action: Specifies the action to be taken on receiving input, as&lt;br /&gt;
described under Dialog Actions.  For menu dialogs, this is the default&lt;br /&gt;
action to be taken if the menu item selected does not define one.&lt;br /&gt;
&lt;br /&gt;
Dialog_Flags: Sets the flags for the dialog.  Dialog flags are bitmasks,&lt;br /&gt;
added using bitwise or.  The flag values are:&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flag_No_Override: Do not allow the user to override the input&lt;br /&gt;
    dialog with ! commands.  This will be ignored if not permitted for a&lt;br /&gt;
    given user.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flag_No_Player_Override: As Dialog_Flag_No_Override, but does&lt;br /&gt;
    not apply to developers.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flag_Hidden: Attempt to signal the user's terminal to hide his&lt;br /&gt;
    or her input, as with passwords.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flag_Single_Character: Attempt to signal the user's terminal to&lt;br /&gt;
    enter single-character mode.  If any prompt is set for the dialog,&lt;br /&gt;
    causes a * to be added to the prompt.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flag_Default: Allow the input to default or return an empty&lt;br /&gt;
    result.  Normally, a lack of input results in the user being given&lt;br /&gt;
    a message regarding valid responses and being re-prompted.  You do not&lt;br /&gt;
    need to specify this flag if you set the Dialog_Default field; setting&lt;br /&gt;
    that field also sets this flag automatically.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flag_Unknown_Defaults: For input types which restrict the valid&lt;br /&gt;
    responses to a specific set, this flag causes responses which do not&lt;br /&gt;
    match any element of the set to act as if the default were selected.&lt;br /&gt;
    Normally, an unknown response causes the user to be given a message&lt;br /&gt;
    regarding valid responses and then re-prompted.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flag_Match_Case: For input types which restrict the valid&lt;br /&gt;
    responses to a specific set, causes matching to be case-sensitive,&lt;br /&gt;
    where normally it is not.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flag_Center_Desc: Center the content from the Dialog_Desc field&lt;br /&gt;
    on the user's screen.  (Only applies to the Dialog_Desc, not to any&lt;br /&gt;
    additions to it.)&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flag_Suppress_Prompt_Add: Suppress additions to the prompt.&lt;br /&gt;
    There are two kinds of prompt adds: those defined by the input type,&lt;br /&gt;
    and the * added by Dialog_Flag_Single_Character, as described above.&lt;br /&gt;
    This flag suppresses both of these additions.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flag_Suppress_Desc_Add: Suppress additions to the dialog&lt;br /&gt;
    descriptive content.  For menu dialogs, this suppresses the menu&lt;br /&gt;
    generation, including the blank line normally generated between the&lt;br /&gt;
    dialog descriptive content and the prompt.  For block and edit&lt;br /&gt;
    dialogs, this suppresses the interface description.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flag_Full_Word: For yes/no dialogs, requires the entire word&lt;br /&gt;
    &amp;quot;yes&amp;quot; or &amp;quot;no&amp;quot; to be input; similarly for yes/no/other dialogs.  Not&lt;br /&gt;
    used by any other input types.&lt;br /&gt;
&lt;br /&gt;
    Dialog_Flag_Suppress_Extra_Line: In menu dialogs, prevents a blank line&lt;br /&gt;
    from being inserted between the dialog descriptive content and the&lt;br /&gt;
    prompt.&lt;br /&gt;
&lt;br /&gt;
Dialog_Prompt: The basic prompt for the dialog, which may be modified&lt;br /&gt;
in various ways.  Dialog colorization applies.&lt;br /&gt;
&lt;br /&gt;
Dialog_Default: Specifies the default value to be substituted for input&lt;br /&gt;
if the user provides none.  If this field is specified, Dialog_Flag_Default&lt;br /&gt;
is automatically set.&lt;br /&gt;
&lt;br /&gt;
Dialog_User: Sets the user to interact with the dialog.  Expected to be&lt;br /&gt;
an interactive object; if not, the input system will attempt to handle it&lt;br /&gt;
by processing dialogs as if defaults had been selected, erroring if no&lt;br /&gt;
default is available.  Though you can set this field in the specification,&lt;br /&gt;
it is more usual to provide it as argument to the Dialog_Enter() function&lt;br /&gt;
(see below) when activating the dialog.&lt;br /&gt;
&lt;br /&gt;
Dialog_Extra: A space in the descriptor for arbitrary user-defined data to&lt;br /&gt;
be stored.  Put whatever you like in here and use it however you like.&lt;br /&gt;
&lt;br /&gt;
Dialog_Color: Sets the generic color for the dialog, as described in Dialog&lt;br /&gt;
Colorization.  Specified as a bare color code, e.g. &amp;quot;blue&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Dialog_Highlight: Sets the highlight color for the dialog, as described in&lt;br /&gt;
Dialog Colorization.  Specified as a bare color code, e.g. &amp;quot;white&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Dialog_Desc: A description or message regarding what the dialog is asking.&lt;br /&gt;
Dialog colorization applies.&lt;br /&gt;
&lt;br /&gt;
Dialog_Content: For option dialogs, this is a string array list of the&lt;br /&gt;
valid input responses.  For edit dialogs, this is a string defining&lt;br /&gt;
starting content to be edited.  For menu dialogs, this is an array of the&lt;br /&gt;
menu item descriptors for the menu.  For yes/no/other dialogs, this is the&lt;br /&gt;
string text of the third choice, which defaults to &amp;quot;Quit&amp;quot;; a custom option&lt;br /&gt;
should use the same capitalization pattern, and should not begin with Y or&lt;br /&gt;
N.&lt;br /&gt;
&lt;br /&gt;
Dialog_Init: A closure that will be called when the dialog is first&lt;br /&gt;
entered via Dialog_Enter().  The dialog descriptor will be passed as&lt;br /&gt;
argument.  Return values are ignored.&lt;br /&gt;
&lt;br /&gt;
Dialog_Run: A closure that will be called every time the dialog is&lt;br /&gt;
processed -- that is, any time input is requested from the user, whether&lt;br /&gt;
with a full display of descriptive content or not.  The closure will&lt;br /&gt;
receive the dialog descriptor as argument.  Return values are ignored.&lt;br /&gt;
&lt;br /&gt;
Dialog_Exit: A closure that will be called whenever the dialog is exited,&lt;br /&gt;
including Dialog_Action_None, Dialog_Action_Attach, Dialog_Action_Return,&lt;br /&gt;
Dialog_Action_Return_Prompt, and Dialog_Action_Transfer actions.  The&lt;br /&gt;
closure receives the dialog descriptor as argument; its return value is&lt;br /&gt;
ignored.&lt;br /&gt;
&lt;br /&gt;
Dialog_Done: A closure that will be called when the dialog is exited&lt;br /&gt;
without an expectation that it is likely to be returned to; that is, the&lt;br /&gt;
same as Dialog_Exit, except it is not called for Dialog_Attach actions.&lt;br /&gt;
The closure receives the dialog descriptor as argument; its return value&lt;br /&gt;
is ignored.&lt;br /&gt;
&lt;br /&gt;
Dialog_Max_Length: Used by block and edit dialogs.  If specified, this is&lt;br /&gt;
the maximum number of lines the user is allowed to have in the final&lt;br /&gt;
result.&lt;br /&gt;
&lt;br /&gt;
====User-Serviceable Internal Fields====&lt;br /&gt;
&lt;br /&gt;
Dialog_Input: This is the field where the input received from the user&lt;br /&gt;
will be placed in the dialog descriptor for you to examine.  It should&lt;br /&gt;
be accessed using Dialog_Query(dialog, Dialog_Input).  You should not&lt;br /&gt;
set this field.  The input result will be processed in different ways by&lt;br /&gt;
different input types; see 'man input' for details.&lt;br /&gt;
&lt;br /&gt;
Dialog_Argument: Menu dialogs can be set to allow an &amp;quot;argument&amp;quot; to a menu&lt;br /&gt;
choice; that is, additional information provided after the menu item key.&lt;br /&gt;
If this has been enabled for a menu item and the user provided an argument,&lt;br /&gt;
the argument will appear in this field.  It should be accessed using&lt;br /&gt;
Dialog_Query(dialog, Dialog_Argument).  You should not set this field.&lt;br /&gt;
&lt;br /&gt;
Dialog_Source: The string object name of the object which requested the&lt;br /&gt;
creation of the dialog.  It should be accessed using Dialog_Query(dialog,&lt;br /&gt;
Dialog_Source).  You should not set this field.&lt;br /&gt;
&lt;br /&gt;
Dialog_Next: Used to specify the next dialog to send the user to, for&lt;br /&gt;
Dialog_Action_Attach and Dialog_Action_Transfer actions.  It should be set&lt;br /&gt;
using Dialog_Set(dialog, Dialog_Next, other_dialog).  You should not need&lt;br /&gt;
to query this field, but if you do, use Dialog_Query(dialog, Dialog_Next).&lt;br /&gt;
This field is automatically cleared when actions using it are carried out.&lt;br /&gt;
&lt;br /&gt;
Dialog_Feedback: Used to specify feedback to be displayed to the user&lt;br /&gt;
before carrying out its next action.  Dialog colorization applies.  It&lt;br /&gt;
should be set using Dialog_Set(dialog, Dialog_Feedback, feedback).  You&lt;br /&gt;
should not need to query this field, but if you do, do so using&lt;br /&gt;
Dialog_Query(dialog, Dialog_Feedback).&lt;br /&gt;
&lt;br /&gt;
====Non-User-Serviceable Fields====&lt;br /&gt;
&lt;br /&gt;
Dialog_Attached: Used for storing a dialog that the current dialog is&lt;br /&gt;
&amp;quot;attached&amp;quot; to.  The dialog stored here comes into play when&lt;br /&gt;
Dialog_Action_Return and Dialog_Action_Return_Prompt actions are taken.&lt;br /&gt;
&lt;br /&gt;
Dialog_Info: A space for individual input types to store information for&lt;br /&gt;
their own use.  The meaning of anything here is defined by the individual&lt;br /&gt;
input type.&lt;br /&gt;
&lt;br /&gt;
Dialog_Tag: The tag value for the descriptor system.&lt;br /&gt;
&lt;br /&gt;
===Support Functions===&lt;br /&gt;
&lt;br /&gt;
Dialog descriptors also define several support functions for working with&lt;br /&gt;
them.  As usual with descriptor support functions, these are handled via&lt;br /&gt;
macros.  The definitions below are given using the macro names, but with&lt;br /&gt;
function-style type information to make the arguments and return values&lt;br /&gt;
clear.&lt;br /&gt;
&lt;br /&gt;
'''void Dialog_Enter(descriptor dialog, object user)'''&lt;br /&gt;
&lt;br /&gt;
Sets the dialog's user to the object given as the second argument and&lt;br /&gt;
processes the dialog, calling Dialog_Init if present.&lt;br /&gt;
&lt;br /&gt;
'''varargs void Dialog_Process(descriptor dialog, status suppress_desc)'''&lt;br /&gt;
&lt;br /&gt;
Processes the specified dialog.  If the optional second argument is true,&lt;br /&gt;
the full descriptive content for the dialog will be suppressed, so that&lt;br /&gt;
only the prompt is shown.  This is mostly intended for internal system&lt;br /&gt;
use, but is available in case you need it; you should generally use&lt;br /&gt;
Dialog_Enter() to start your dialogs.&lt;br /&gt;
&lt;br /&gt;
'''void Dialog_Display(descriptor dialog, mixed message)'''&lt;br /&gt;
&lt;br /&gt;
Displays a message to the dialog's user, with dialog colorization applying&lt;br /&gt;
to the message.  This is useful when setting dialog feedback or a dialog&lt;br /&gt;
description doesn't do exactly what you want.&lt;br /&gt;
&lt;br /&gt;
'''descriptor Dialog_Active(object|mixed array what)'''&lt;br /&gt;
&lt;br /&gt;
Requests information on a user's current active dialog.  If an object is&lt;br /&gt;
given, this is the user you are requesting information on.  If a dialog&lt;br /&gt;
descriptor is given, information is requested on that dialog's user.&lt;br /&gt;
The return value is the current input dialog the user is engaged in,&lt;br /&gt;
if any (only applying to dialogs managed via the input system, not other&lt;br /&gt;
uses of input_to()).&lt;br /&gt;
&lt;br /&gt;
'''void Dialog_Show_Prompt(object|mixed array what)'''&lt;br /&gt;
&lt;br /&gt;
Displays a dialog's prompt to its user without actually processing the&lt;br /&gt;
dialog.  If an object is given, the prompt for that user's active dialog,&lt;br /&gt;
if any, is shown, and as a special case, if the user has no active dialog,&lt;br /&gt;
their normal prompt is shown.  If a dialog is given, the prompt for that&lt;br /&gt;
dialog is shown.&lt;br /&gt;
&lt;br /&gt;
'''status Dialog_Abort(object|mixed array what)'''&lt;br /&gt;
&lt;br /&gt;
Attempts to abort a user's input dialog.  If an object is given, the&lt;br /&gt;
user's current dialog, if any, is considered the dialog to be aborted.&lt;br /&gt;
If a dialog descriptor is given, that dialog will be aborted if and only&lt;br /&gt;
if it is the current dialog for its user.  Returns True if successful,&lt;br /&gt;
False otherwise.  This function should not be used without a good deal&lt;br /&gt;
of caution.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
[[man input|input(mechanisms)]], [[man menu item|menu_item(descriptors)]], [[man descriptors|descriptors(mechanisms)]]&lt;/div&gt;</summary>
		<author><name>Laine</name></author>	</entry>

	</feed>