------------------------------------------------------------------------------ --[[ User Functions: Slash Commands ]]-- ------------------------------------------------------------------------------ --[[ -- registerSlashCommand ( {slashCommand} [, {slashCommand}] ...) -- -- See the slashCommand definition for more information. -- -- (Should be at the end of this file) -- -- Example: -- Satellite.registerSlashCommand( -- { -- id = "SNOOPY"; -- commands = {"/snoop", "/snoopy"}; -- onExecute = function( msg ) Sea.io.print("You're snoopy, ", msg , "!" ); end; -- sticky = false; -- helpText = "Shows the world you're nuts!" -- } -- ); -- -- /snoop Belldandy -- -- Would print "You're snoopy, Belldandy!" -- -- Sticky: -- true - The command will be saved so that when you bring up the -- edit box the next time the command will already be loaded -- false or nil - The command will not be saved. -- -- returns: -- true - success! -- false - a command failed! -- --]] --[[ ------------------------------------------------------------------------------- slashCommand: { -- Required members id = Identifier; commands = { "/command1", "/command2" }; onExecute = SomeFunction; -- Optional members onSpace = SomeFunction; onTab = SomeFunction; helpText = "This does something cool."; -- ChatType members -- Using any of the following options will make the slash command a full fledged Chat Type. -- Chat Types are shown in the Chat Tab menus and can have their color and visibility controlled by the player. -- You can send emulated messages as a ChatType (registered Satellite ID) using GenerateChatEvent. sticky = false; menuText = "Command"; header = "Command: "; printHeader = "[Command]: "; defaultFrames = { 1, 2, 3 }; defaultColor = { r = 1.0, g = 1.0, b = 1.0 }; onColorChange = SomeFunction } Allows you to register one or more /commands Arg Members: ID - some unique ID (mostly for unregistering later) slashCommands - a table of /commands to check for onExecute - a function which is called when the user runs the command args: msg - the chat message as typed into the editbox (excluding the "/command ") Optional: onSpace - a function called when a spacebar is pressed args: msg - the chat message as currently seen in the editbox (excluding the "/command ") onTab - a function call when a tab key is pressed args: msg - the chat message as currently seen in the editbox (excluding the "/command ") helpText - a string explaining what the command does ChatType members sticky - boolean value determining if the command should be sticky menuText - text seen in the "Other Messages" menu of the Chat Tab Menu (used to generate printHeader is absent) header - text seen in the left of the edit box after entering the slash command (defaults to commands[1]) printHeader - text seen in the left of the chat frame message when using GenerateChatEvent defaultFrames - the #'s of chat frames this ChatType will by visible in by default defaultColor - the default color of this ChatType in the editbox and chat frame messages onColorChange - function called when the color is changed args: r - red value (0-1) g - green value (0-1) b - blue value (0-1) ]]--