Quantcast MCom.addSlashCom - WoWWiki - Your guide to the World of Warcraft
Recent changes Random page
GAMING
Gaming
 
StarCraft Wiki
Super Smash Wiki
Halopedia
Diablo Wiki
FFXIclopedia
Grand Theft Wiki
See more...

MCom.addSlashCom

From WoWWiki

Jump to: navigation, search

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

 --[[
   addSlashCom ( [string/{string, ...}] command, function comfunc, string comaction, bool comsticky, 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, {string, ...} extrahelp )
     Registers a standard slash command.  This will register with Sky, if it exists.
     addSlashCom makes its own chat handler function.  The function expects a particular kind of input, specified by comtype.
     
     For boolean input, it will require that the user pass on, off, 1, or 0, to consider the command valid. It will then call
     the function you pass, and will pass a 1, 0, or a -1, standing for True, False, and no input(I suggest you make it invert
     the current value in this case).  If Cosmos is loaded, and you have passed uivar and comvar, it will update the cosmos
     variable after the function has completed.
     
     If the slash command is already registered with MCom, nothing will happen.
   
   Args:
     command - The slash 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: 
     comaction - The action to perform, see Sky documentation for further details
     comsticky - Whether the command is sticky or not(1 or 0), see Sky documentation for further details
     comhelp - What message to display as help in Sky for this command, see Sky documentation for further details
     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
     extrahelp - A table of extra help messages to display, each line is printed on a separate line
     
   These are required if you want to update a Cosmos or Khaos 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 or Khaos 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
 ]]--
Rate this article:
Share this article: