Open main menu

AGI/Predictive Dialog

< AGI
Revision as of 16:19, 10 June 2007 by Md5 (talk | contribs) (Added info about the pred.dic file, fixed a typo)

The Predictive Input Dialog is a ScummVM aid for running AGI engines games (which notoriously have command line input) on devices with limited keyboard input. The dialog is fully usable with the mouse, but a few provisions have been made to make its use more comfortable by naturally mapping the functionality to the keypad.

In order to enable predictive input in AGI games, you need to copy the pred.dic file in the ScummVM extras folder or the folder of the game you wish to play.

Input Methods

The predictive input dialog works in three modes, switchable by the Pre/123/Abc button:

The primary input method implemented by the predictive input dialog - predictive mode - resembles the way "fast typing" is done in phones: The alphabet is divided into 9 sets which naturally map to the 9 number keys of the numeric keypad (0 is space). The dialog utilizes a dictionary of words which has been created by parsing through all known agi games and creating the maximum set of common words. At runtime, the dictionary is searched each time the user presses a numeric key for words matching the numeric prefix up to that point. The user can press the next button when there are multiple matches for the same prefix. The matching operation and the way of putting together the dictionary have been designed so as to not hint the user for words (e.g. pressing random keys and seeing what word the prediction converges to). Also, when a user OKs the dialog, or presses space and if there are multiple matches for the same prefix, the word finally chosen is brought to the front of the list, essentially implementing a Most Recently Used approach.

The second input method is numeric: Each key the user presses is shown as a number.

The third input method is the Multi-tap Alpha input mode: The user presses a numeric key and uses the next button to cycle through the corresponding key's assigned letters.


How the user brings up the dialog

The user must have a dictionary and can either click on the command line or (optionally if the backend supports it) when the backend emits a Common::EVENT_PREDICTIVE_DIALOG event, returning it from its OSystem::pollEvent method. The latter is used by the WinCE port so that the user does not have to drag the -potentially keyboard emulated- cursor up and down the screen, but rather hit a 'Predictive dialog' hotkey.


Additional Feature

In the case of the WinCE port, the user is free to map Actions to arbitrary keys on the device. This potentially clashes with the Predictive Dialog (or more accurately, its intended use scheme). When the dialog is shown, the backend needs to be notified to turn off any key filtering it is performing (action mapping) so that all numeric keystrokes reach the predictive dialog unspressed. This is accomplished by the following mechanism: When the dialog starts up, it uses OSystem's setFeatureState to se the kFeatureDisableKeyFiltering feature to true. Respectively, when it closes it sets it to false. By observing this features, the backends can allocate a flag which indicates when it would be best to suppress mapping from the numeric (and *, #) keys to actions.