Title: Z-Menu
Version: 1.11
Author: Zed  .. with help from Caretaker. Thanks Vid :)
Contact: Archy at http://archysportal.com

Credits: The menu mask option idea was inspired by work done by Parrothead.
         The Double Tap idea was inspired by LoneStar's Load Menu.
         The Comms On and Comms Off idea came from Caretaker.
         Thanks fellas.

ZeD's Unlimited Menu System
----------------------------

Allows you to create a menu system for your scripts and macros.
Menus are activated using a 2-digit alphanumeric code and therefore can be very large.
Also any menu option can lead to another page of menu options making it unlimited.

FEATURES LIST
-------------
* Unlimited Number of Menu Pages.
* Up to 1296 Menu Options per page.
* Automatic Menu creation using filemasks.
* Easy manual menu creation using a text editor.
* Menu Options can be Scripts, Macros, Other Menu Pages, or Comments.
* Up to 26 Hotkeys can run macros or scripts without activating the menu.
* Macro Looper allows for multiple macro runs from 1 activation.
* Macro Variables stored in game config file for isolating 1 game's variables from another.
* Comms deactivation for uninterrupted displays.
* Hotkey deactivation toggle.
* User configurable optional features such as sound, activation key, and more.
* Menu resides in memory as a system script.
* Double Tap Menu activation.
* Menu returns to last menu viewed when activated.
* Can be run as an automatic script before actually entering a game. (good for logins)
* Comments can be used to explain script or macro use at the point of activation.
* Categorising scripts and macros is easy using a multi-level menu system.
* Default and example menus created automatically when first run.
* Tidy, colourful presentation.

INSTALLATION
------------
Place the Z-Menu.cts file in your scripts folder and create a hotkey for it if you have that facility.
The ding.wav file goes in the TWX Root.
The z-mask.cfg goes in the TWX Root.

UPGRADING AN EXISTING INSTALLATION
----------------------------------
Move ALL z-*.* files out of the TWX Root and into a temporary folder.
Install Z-Menu as stated above in INSTALLATION.
Run Z-Menu to create the initial files.
Move all the Z-*.* files back into the TWX Root except for the z-menu.cfg, z-main.mnu, z-help.mnu and
z-help2.mnu files. The z-menu.cfg can be edited to suit, and the z-main.mnu will need to be edited to
restore any alterations you made to it originally.

CREATING MENUS
--------------
When you first run the script it will create 13 sample menus in your TWX root folder called 
z-*.mnu. Most of the samples only have 1 menu option to bring you back to the Main Menu, but 
the Pack 1 and Pack 2 Menus are filled out with the scripts that come with TWX.
They are simple text files which can be edited with any text editor.
You can use these files as they are.. or you can edit them to suit your own needs. Also you can add 
more, as many as you like. The only restriction is that the first menu loaded (the Main Menu) must 
be named z-main.mnu.

The format for the menu files is as follows.
* The first line is the Menu Title to be displayed at the top of the menu.

Each line after that is 1 line per menu option divided up into 4 sections as follows.

* The first section is the Option type, 
  Either an S (for script) or an M (for Menu) or an A (for Macro) or a C (for Comment).

* The second section is the 2-digit code to activate the option. Any 2 digits (0-9 A-Z) will do. 
  These should be unique for each menu page.

* The third section is the filename of the script or menu file to load.
  (NO SPACES IN THE FILENAME PLEASE)
  If this is a macro (Type A) then this field contains the macro.
  The macro MUST be surrounded by !MACROSTART!   and   !MACROEND!
  example: !MACROSTART!f1*cd!MACROEND!  where f1*cd  is the actual macro.  
  Use an * or ^M to denote a press of the ENTER key.
  Z-Menu will also recognise ^(08) as the backspace key.

* The fourth section is the title of the option to appear in the menu.

Note that the Comment type (C) does not need a 2-digit code entry or a filename entry. 
The title acts as the comment. If you leave the line blank after the C you will get a blank line.

Here is an example script menu option (Type S).

S EC 1_ecol.ts E-Coloniser

The S means its a script.
EC is the 2-digit code that activates the option.
1_ecol.ts is the script to run.
E-Coloniser is the option title displayed on the menu.

Here is an example macro menu option (Type A).

A F1 !MACROSTART!f1*cd!MACROEND! Put 1 Corp Defensive Fig

If the option you choose from the menu is a macro then you will be asked how many times to loop the macro.

AUTOMATIC MENU CREATION (Filemasks).
------------------------------------
You can now create menus automatically using a filemask.
Edit the z-mask.cfg file to reflect the types of filenames to include in the menus created.
The folder and filenames are CASE-SENSITIVE.
Ensure that the word "scripts" does NOT appear in any subfolder name in the scripts folder.
"EG: "scripts\Wildstar's_scripts" would not work correctly because of the second occurrence of 
the word :scripts". You should rename this to scripts\Wildstar's_pack for instance.

Use the tilde [~] button to activate the automatic menu creation option.

Z-Menu will create a Menu called Author Scripts Menu which will have options leading to the menus 
created by the mask. An entry will be made in the Main Menu to allow you to reach this menu.

The format of the mask file is as follows:
1 line per Menu created.
Each line is divided into 3 sections.
* The first section is the 2-digit code used to activate the menu.
* The second section is the filemask (use wildcards * and ? to filter multiple files).
* The third section is the Title of the menu.

Here is an example.

CK scripts\_ck*.cts CK Public Scripts

CK - is the 2-digit code to activate the menu of Cherokee's scripts.
scripts\_ck*.cts - is the mask. Only files starting with _ck and ending with .cts will be included.

CK Public Scripts - will be the title of the menu.

PLEASE NOTE that the filenames SHOULD NOT have spaces in them. If your scripts filenames have spaces you
            should replace the spaces with underscores before running the filemask option.

ALSO NOTE that folders should be no more than 1 level deep. scripts\*.* is ok. scripts\combat\*.* is ok.
          scripts\combat\attack\*.* is NOT ok.

ACTIVATING THE MENU
-------------------
When you run z-menu it will sit in memory and await activation with a double tap of the comma key.
You can change the ACTIVATION KEY to a key of your choice by editing the z-menu.cfg file created in
the TWX Root when Z-Menu is first run.
While the menu is running you can press ENTER to exit. (It stays in memory until you double tap again)

COMMS
-----
Z-Menu will turn off Comms while displaying the menu by default. This behaviour can be changed by editing the
z-menu.cfg file created in the TWX Root when Z-Menu is first run.

MACRO VARIABLES
---------------
Z-Menu allows variables for use in macros.
Press the [!] key from the menu to go to the Macro Variables page.
Here you can see what variables are available and change their values.
Use them within a macro by simply entering the variable tag shown on the Macro Variables page.
EG: !MACROSTART!'mow <BASE> 1^M!MACROEND!
This would cause Mombot to mow back to base if you had the <BASE> variable set to your home sector.
NOTE that these variables are saved in the CFG file created with your TWX Database in the data folder.

HOTKEYS
-------
Hotkeys are available at the various game prompts. SHIFT A to SHIFT Z can be
used. They are stored in a file called z-hotkey.cfg found in your TWX root
folder. The format of the z-hotkey.cfg is the same as the menu files (z-*.mnu)
except only 2 option types are available, the Macro type A and the Script
type S. A list of the currently available Hotkeys can be viewed from the Main
Menu by pressing the [@] key (SHIFT 2). You can turn the Hotkey feature off
in the z-menu.cfg file or toggle it on and off at the Hotkey List.

Z-Menu.cfg
----------
This file holds the configuration options and is created the first time Z-Menu is run.

ACTIVATION_KEY: ,    - This is the double-tap key used to activate Z-Menu. Default is the comma key.
SETCOMMS: YES        - This controls whether or not the comms are toggled on and off during Z-Menu use.
COMMSDELAY: YES      - This controls whether or not there is a 30 second delay before turning comms on 
                       when running a script.
HOTKEYS: ON          - This activates/deactivates the use of Hotkeys.
SOUND: ON            - This turns the use of sound on and off.
