Register to post in forums, or Log in to your existing account
 

 Related 
Contents
See also:
  Introduction to Classes
  Editing Classes
Feature Reference
  Aliases
  Macros
  Variables
  Functions
  Classes
  Triggers
  Buttons
  Gauges
  Paths
  Menus
  Events
  Modules
  Windows
  Packages
  Shared Package Library
  Package Editor
  Docked Windows
  Customizeable Toolbars
  Sessions
  Expressions
  Automapper Module
  Database Module
  Syntax Checking
  Tab Completion
  Status items
  Preferences
  Simutronics Support
  Pueblo Emulation
  Keyboard shortcuts
  MXP
  Threads
  ATCP
  Script Debugger
  Timestamps
  Lua Scripting
Related Links:
  #T+
  #TRIGGER
  Create/Modify Settings
  Terminology
  Modules
  Windows
  Editing a package
  Editing Classes
  Menus
Classes [[cmud_classes]] 
A Class holds a collection of other script objects, such as aliases, macros, triggers, variables, etc. A Class is similar to a "folder" that holds a collections of files on your hard disk.

In addition to helping to organize your scripts into groups, classes also perform some important functions within scripts. Classes can be formed into a "tree hierarchy", similar to file folders. For example, a top-level Class can contain a sub-class.

When you reference an Alias or Variable, CMUD first looks within the current class. If the alias or variable is not found within the current class, then CMUD looks in the Parent class. This continues until CMUD reaches the top level of your package. If the alias or variable still hasn't been found, then CMUD starts looking within other global modules within your package, or other published modules within other packages.

If you think about Classes as if they were nested file folders, then you will find them easy to use. CMUD uses the same syntax for specifying a specific folder as Unix. Simply place a "/" character between the sub folder names. For example:

#SHOW @TopClass/SubClass/Varname

will access the @Varname variable within the SubClass folder that is nested within the TopClass folder.

To refer to the current class, use ./ and to refer to the Parent class, use ../ just like with Unix filenames.

Classes can also be enabled and disabled using the #CLASS command or the #T+ and #T- commands. When a class is disabled, then the aliases, variables, triggers, macros, etc within the class cannot be accessed normally.

This feature allows you to create multiple scripts with the same names, but stored in different classes. For example, you might have a class called "Combat" and a class called "NonCombat". In each class you place a macro for the F5 key. Now you disable one class, and enable the other. When you press the F5 key, the macro in the enabled class will be executed.
Viewer Comments [0 - Post your comments]

Jump to:  

© 2009 Zugg Software. Hosted by Wolfpaw.net