Celx menu

Description

This is a simple menu that can serve as an example for how to create a menu using Celx scripting. The example can be easily adjusted to your own needs.

The script displays a menu when the key M (Shift + M) is pressed and prints a message when one of the key's J, K or L (Uppercase !!!) is pressed in response to the menu.

The script uses lua's facility to create an (object oriented) type of object; in this case the menu object. As long as the script runs, the menu object is in one of two states:

    1. menu.display: waiting for the key "M" to be pressed
    2. - this is also the default state
    3. menu.choice: waiting for a menu-choice to be pressed
    4. - this state ends when any key is pressed

[Control]+[Key] combinations can not be used for this simple menu script! The reason for this is that Celestia reports these combinations as 3-character codes per keypress, whereas the script is limited to 1-character codes per menu choice. For details about the celx key event see: Key event

Downloads

History

Version 1, 16 Jan 2011

Initial version 1