Gaming
 

MCom.addSlashSubCom

From WoWWiki

This article is a part of the documentation of the MCom function library

 --[[
   addSlashSubCom ( [string/{string, ...}] basecommand, [string/{string, ...}] subcommand, function comfunc, string comhelp, string comtype, string uisec, string uivar, string comvar, string comvarmulti, number commin, number commax, number commul, number cominmul, bool hasbool, {string = string, ...} choices, bool multichoice, bool hasopacity)
     This is like addSlashCom, but it registers a sub command to be used with a super command.
     A sub command is one that is entered after the super command is entered.
     Example:
     Normal command: "/modcommand on"
     Sub command, with super command of mod: "/mod command on"
     
     Using super and sub commands allows you to register only one actual real command, which helps to clean up the listing of slash
     commands, and helps to prevent using a slash command that may already be there.  It also makes it easier for the user to remember
     and use, as if the user simply types the super command by itself they will get a listing of all sub commands, and usage.
     
     If the slash command is already registered with MCom, nothing will happen.
   
   Args:
     basecommand - The super command that this sub command goes with.  Can be a single command or a list of commands.
     subcommand -  The sub command(s) you want to register. Ex: "command". This can be a string or a table of strings if you
               want more than one command.
     comfunc - The function that the should be called when the slash command is used, and valid.  If the function returns a value
               that value will be used to update a cosmos variable, if uivar has been passed.  You don't have to return a value
               to do this, but if you don't then you need to use comvar, and comvarmulti(for multi type).  For multi type it
               should return the bool then the value, like so: "return enabled, value;"
               BOOL - function (bool enabled)
               NUMBER - function (number value)
               MULTI - function (bool enabled, number value)
               STRING - function (string value)
               SIMPLE - function ()
 
   Optional: 
     comhelp - What message to display next to the sub command when listing sub commands in the help output.
               NOTE: if this is an MCOM_CHOICET then if you put a %s in this string, it will be replaces with a list of
               the choices you passed.
     comtype - the type of data you are expecting from this slash command
               MCOM_BOOLT - Expects boolean data, an on, off, 1, or 0
               MCOM_NUMT - Expects a number value
               MCOM_MULTIT - Expects a boolean and then a number value, Ex: "/command on 3"
               MCOM_STRINGT - Expects any string
               MCOM_SIMPLET - No input needed, just calls the function
     commin - the minimum value the number variable can be set to, for help display only
     commax - the maximum value the number variable can be set to, for help display only
     commul - the value to multiply the number by when showing it's status
     cominmul - A value to multiply the number passed in by the user(for number types only)
     hasbool - If this option has a boolean part, set this to true
     multichoice - Set this true if this is a choice type and can have multiple choices selected
     hasopacity - Set this true if this is a color type that should also have an opacity setting
     
   These are required if you want to update a Cosmos variable:
     uivar - The Cosmos variable that should be updated, if you want this slash command to update a cosmos variable
   These are required if you want to update a Cosmos variable, and your function doesn't return the updated value:
     comvar -  The variable that the cosmos variable should be set by, if you want this slash command to update a cosmos variable
               This should be a string containing the name of the variable to update, this can include .'s for tables, Ex: "Something.Value"
               When type is MULTI, this specifies the bool variable
     comvarmulti - The same as comvar, but used to specify the number variable when type is MULTI, only used for MULTI type
     
   This is required if you want to update a Khaos variable:
     uisec - The option set ID that the uivar is found in
     
   This is required is you are using a MCOM_CHOICET type:
     choices - The list of choices
 ]]--