The system had a simple, VT100 like, terminal (terminal.js). menuSystem.js is an, extreamly primative, 'web browser' that displays pages on the terminal.
The terminal is invoked:
The menus are represented as either:
Menus are handled as a 'stack'. It is possible to go 'back' to previously veiwed menus.
This is all at an early stage of development. If you think you can improve it feel free to do so. However please re-test/update existing menus so they still work.
Well 'because it's fun'.
Also eventually the game may be ported to non-keyboard device. So, whtever the menu system looks like, the interface needs to be accessible via just the flight contols (whatever they are on each system). i.e. 'left', 'right', 'up', 'down' and 'select' ... NOT mouse or other system dependant UIs.
Try to base new menus on the existing ones. Correct implementation of escape sequences can be complex.
Each menu doc contains something like the following:
All text can have the following attibutes.
Scripts invoke methods on the 'local' (not 'remote' like real HTML) machine that generate dynaamic pages.
They are executed (eval()ed) in the context if the MenuSystem. So have access to it's members and imports.
The script can have parameters. Again these are in the context of the MenuSystem and should be variable that are availabe to it.
Errors with class GameError are in game error conditions . These are caught and an error handling menu is bought up.
GameErrors should be thrown by scripts if they detect in game errors. (e.g. Out of money etc.)
Other errors relate to code issues. So are rethrown for normal handling.
Default 'Back' and 'Exit' items are automatically added to every menu.