Recent changes Random page
GAMING
Gaming
 
StarCraft Wiki
Super Smash Wiki
Halopedia
Diablo Wiki
FFXIclopedia
Grand Theft Wiki
See more...

Satellite

From WoWWiki

Jump to: navigation, search

Satellite is a tool for slash command enhancement, and more. It makes Slash Command registration and management easy with simple table registration and advanced features like ChatType emulation, color and visibility management and sticky status.

Available from WoWInterface.

Satellite ChangeLog

Contents

Features

  • Register Slash Commands with a simple table format
  • Optional ChatType support for enhanced features
  • Add your slash command to the /chathelp printout
  • Make your slash commands sticky
  • Have the header change in the editbox after typing the /command
  • Emulate incoming chat messages using your custom ChatType in the frames and color customizable by the player
  • Save color and frame visibility across sessions on a per character basis
  • Optional function handlers for onSpace, onTab, onColorChange and onVisibleChange

Built-in Slash Commands

  • /print var - Print executed code. Short for /script Satellite.GenerateChatEvent('PRINT', table.concat( { msg } ) );
  • /printComma var, var - Print multiple executed variables separated by ", ". Short for /script Sea.io.printComma(msg);
  • /z - Execute code. Short for /script or /run
(If you're using this addon as an embedded library feel free to comment out the registration of these commands)

Quick Start Example

Minimal Required Example

Satellite.registerSlashCommand(
	{
		id="TELL_TRACK";
		commands = { "/telltrack","/ttrack" };
		onExecute = function(msg) ... end;
	}
);

Maximum Usage

Satellite.registerSlashCommand(
	{
		id = "PRINT";
		commands = {"/print"};
		onExecute = function(msg, cmd)
			RunScript('Satellite.GenerateChatEvent("PRINT", table.concat( {'..msg..'} ) )')
		end;
		header = "Print: ";
		printHeader = "[Print]: ";
		hideMenuOption = false;
		menuText = "Print";
		helpText = "Print executed code. Short for /script Satellite.GenerateChatEvent('PRINT', table.concat( { msg } ) ); ";
		sticky = true;
		defaultColor = { r = 1.0, g = 1.0, b = 0.3 };
		defaultFrames = { DEFAULT_CHAT_FRAME:GetID() };
		onSpace = function(msg, cmd) ... end;
		onTab = function(msg, cmd) ... end;
		onColorChange = function(r, g, b) ... end;
		onVisibleChange = function(frameID, isVisible) ... end;
	}
);

Slash Command Table Object

Syntax

{
	-- 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;
	hideMenuOption = false;
	menuText = "Command";
	header = "Command: ";
	printHeader = "[Command]: "; -- or { "header1 ", "header2 " };
	defaultFrames = { 1, 2, 3 };
	defaultColor = { r = 1.0, g = 1.0, b = 1.0 };
	onColorChange = SomeFunction;
	onVisibleChange = SomeFunction;
}
-Satellite.registerSlashCommand allows you to pass multiple slash command table objects:
Satellite.registerSlashCommand( { ... }, { ... } )

Required Members

  • id - some unique ID (used in various variable generation and as the ChatType, all upper case)
  • commands - a table of /commands to check for (all lower case)
  • 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 ")
    lastCommandUsed - the slash command as typed into the editbox (or last one used in the case of a sticky command)

Optional Members

  • onSpace - a function called when a space bar is pressed
    args:
    msg - the chat message as currently seen in the editbox (excluding the "/command ")
    lastCommandUsed - the slash command as typed into the editbox (or last one used in the case of a sticky 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 ")
    lastCommandUsed - the slash command as typed into the editbox (or last one used in the case of a sticky 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 or table of text seen in the left of the edit box after entering the slash command (defaults to commands[1])
    If in table form it should have the same amount of entries as the 'commands' table, implying direct relation.
    ex: If command 1 is used header 1 will be seen, etc.
  • printHeader - text seen in the left of the chat frame message when using GenerateChatEvent
  • defaultFrames - a table of the #'s of chat frames this ChatType will by visible in by default
  • defaultColor - the default color table 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)
  • onVisibleChange
    args:
    frameID - (1-7) chat frame that visibility has been modified on
    isVisible - boolean value for if the chatType is visible or not

Emulate Chat Messages

Syntax

Satellite.GenerateChatEvent( chatType, msg );

Result

  • An event "CHAT_MSG_"..chatType will be sent to the ChatFrame_OnEvent of each chat frame that chatType is visible in. arg1 will be the msg and all other args will be the empty string. This will print the msg prefixed with the printHeader (or "" if unspecified).

Embedding

To embed Satellite in your addon:

1) Drop the Satellite folder in your addon folder
2) Either add the following to your xml file:
<Include file="Satellite\Satellite.xml"/>
Or add this line to your toc file:
Satellite\Satellite.xml
3) Add the following line to your toc:
SavedVariablesPerCharacter: Satellite_Config

Screen Shots

ChatType Headers

Image:PrintHeaders.jpg

Extra ChatTypes in the "Other Messages" Menu

Image:ExtraChatTypes.jpg

Rate this article:
Share this article: