WoW:Sky (AddOn): Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
m (Move page script moved page Sky (AddOn) to Sky (AddOn) without leaving a redirect)
 
(13 intermediate revisions by 9 users not shown)
Line 1: Line 1:
  --[[
{{addon|hosted=0|lib=1}}
  -- checkBandwidth()
{{tocright}}
-- Check the status of the bandwidth limit.
This page is for all documentation of [[Sky (AddOn)|Sky]].
-- returns:
 
-- A positive or negative number, the size of which indicates how
== Functions ==
-- much over (positive) or under (negative) the client is relative
=== isChannelActive ===
-- to the bandwidth limit.
<pre>
--]]
-- isChannelActive(channelID)
--
-- Tells you if a channel is active
-- (meaning you can use it)
--
-- e.g.
-- Sky.isChannelActive(SKY_CHANNEL)
-- will return true if the "Sky" channel
-- exists in your channel list.
--
-- args:
-- channelID - can be a string, a hard channel number or a SKY_IDENT
--
-- returns:
-- true - the channel is active and usable
-- false - the channel is inactive and unusable
</pre>
 
=== activate ===
<pre>
-- activate()
-- Turns Sky on
</pre>
 
=== deactivate ===
<pre>
-- deactivate()
-- Turns Sky off
</pre>
 
=== emptyMailbox ===
<pre>
--[[
--
-- emptyMailbox(mailboxID)
-- Empties a mailbox with id mailboxID
--
-- args:
-- mailboxID - string which is the mailbox's ID defined in Sky.registerChatWatch
--
-- returns:
-- nil
--]]
</pre>
 
=== getAllMessages ===
All messages will be returned in a number-indexed table in order recieved.
<pre>
--[[
-- getAllMessages(mailboxID)
-- Returns a table containing all of the messages in the mailbox.
-- It will then empty the mailbox.
--
-- returns:
-- table of mailbox entries
--]]
</pre>
 
=== getNextMessage ===
<pre>
--[[
-- getNextMessage(mailboxID)
-- Returns a table containing the next SkyEnvelope in that mailbox, or nil if no message exists
-- The message returned is removed from the mailbox.
--
-- See the SkyEnvelope definition for more information
--
-- returns:
-- table - the next message
-- nil - no message
--]]
</pre>
 
=== updateSlashCommand ===
<pre>
--[[
-- updateSlashCommand ( {slashCommandParts}, ... )
--
-- Updates a /command member if its valid.
--
-- e.g.
-- updateSlashCommand({id="myID";onExecute = fooFunc; } );
--
-- will change the onExecute function for myID.
--
-- arg members:
-- id - the ID matching the old slashCommand
-- member - onExecute | onSpace | onTab | commands | action | helpText
-- newvalue - the new value.
--
-- returns:
-- true - successfully replace.
-- false - validation failed
--]]
</pre>
 
=== registerSlashCommand ===
<pre>
--[[
-- registerSlashCommand ( {slashCommand} [, {slashCommand}] ...)
--
-- See the slashCommand definition for more information.
--
-- (Should be at the end of this file)
--
-- Example:
-- Sky.registerSlashCommand(
-- {
-- id = "SnoopyCommand";
-- commands = {"/snoop", "/snoopy"};
-- onExecute = function( msg, cmd ) Sea.io.print("You're snoopy, ", msg , "! You used: ", cmd ); end;
-- action = "before";
-- helpText = "Shows the world you're nuts!"
-- }
-- );
--
-- /snoop Belldandy
--
-- Would print "You're snoopy, Belldandy! You used /snoop"
--
-- Action:
-- "hide"
-- If you return true from the slash command, it will attempt to
-- call the default or previous slash command.
--
-- "before"
-- It will call your new function before the default command.
--
-- "after"
-- It will cally our new function after the default command.
--
-- Returns:
-- true - success!
-- false - a command failed!
--
--]]
</pre>
 
=== registerMailbox ===
<pre>
--[[
--
-- registerMailbox({mailboxRegistrant}, ...)
--
-- Registers a mailbox which will drop messages into a
-- mailbox matching id, if acceptTest(message) returns true.
--
-- See the mailboxRegistrant definition for more details
--
-- Returns:
-- true if successful
-- false if unable to register
--]]
</pre>
 
=== unregisterMailbox ===
<pre>
--[[
-- unregisterMailbox(id)
-- unregisters the mailbox with the specified id
--
-- args:
-- id - string id of the mailbox
--]]
</pre>
 
=== sendTable ===
<pre>
--[[
-- sendTable( table [, system, target, player])
--
-- Sends a lua object to the target using Sky.
-- See sendMessage for argument details
--
--]]
</pre>
 
=== sendMessage ===
* This can be used for regular chat, the only difference from SendChatMessage will be that it will be bound by the outbound character limit and chopped into pieces if it's too long.
* SAY, WHISPER, PARTY, GUILD, RAID and CHANNEL messages will not be parsed or have special characters encoded.
* SKY_CHANNEL, SKY_GROUP, SKY_GUILD, and SKY_PLAYER have line breaks, "s", "S" and "|" converted to invisible characters and back to their correct characters on the recieving end.
 
EX:
<pre>
Sky.sendMessage("Group Members Rock!", "PARTY")
Sky.sendMessage("Whispers Rock!", "WHISPER", nil, "PlayerName")
Sky.sendMessage("101101001 Blah", SKY_CHANNEL, "AddonID")
</pre>
<pre>
--[[
-- sendMessage(message [, system, target, player])
--
-- Sends a simple text message to a
-- specified target using Sky.
--
-- Args:
-- message - the text to be delivered
--
-- optional (Default is an unencoded "SAY" to no particular target):
--
-- system - channel/system used for transport
-- (Sky Encoded & Hidden Messages)
-- SKY_CHANNEL |"global" - sends to all Sky users
-- SKY_GROUP - sends to party/raid members using Sky
-- SKY_GUILD - sends to all guild members using Sky
-- SKY_PLAYER - sends to a player using Sky, through a hidden whisper
-- (Pure/Visible Messages)
-- "SAY" sends to the world regardless of Sky usage
-- "WHISPER" sends to a player regardless of Sky usage
-- "PARTY" sends to a party regardless of Sky usage
-- "GUILD" sends to a guild regardless of Sky usage
-- "RAID" sends to a raid regardless of Sky usage
-- "CHANNEL" sends to a particular channel (1, general, etc)
--
-- target - destination mailbox
-- This value will be the .target value of the envelope sent to acceptTest
--
-- player -
-- ( channel identifier for "CHANNEL" )
-- ( playername for SKY_PLAYER/"WHISPER" )
-- ( nil for everything else )
--
--]]
</pre>
 
=== isSkyUser ===
<pre>
-- isSkyUser ( username )
-- Checks if a username is a known sky user. If they are not, you get nil.
-- If they are, you get a list of the channels they have been seen in.
--
-- Due to the way the SkyUserList updates,
-- You should do this 20 seconds after the party changes.
--
-- Returns:
-- table - list of the channels they are in
-- nil - they are not known to be a sky user.
</pre>
 
=== flush ===
Warning:
 
Do not use this function recklessly. It will attempt to dump 30 messages at a time out of the SkyQueue. However, this may cause framerate drops if you have a lot of messaging going on.
 
A better solution is to use [[#sendAlert|Sky.sendFastMessage]]().
<pre>
-- flush()
-- Forces all timers to go off NOW
--
--
</pre>
 
=== sendAlert ===
<pre>
--[[
-- sendAlert (message [, system, alertid])
--
-- Sends a message instantly through Sky.
-- Alerts cannot be longer than SKY_MAX_DATAGRAM_LENGTH
-- and cannot contain anything but text.
--
-- Args:
-- message - message to be sent
-- system - SKY_CHANNEL|SKY_PARTY|SKY_PLAYER|SKY_ZONE|SKY_RAID
-- alertid - 2 character code to indicate who gets alerted
--
-- Returns:
-- true - message parsed and sent
-- false - unable to parse or unable to send
--
--]]
</pre>
 
=== registerAlert ===
<pre>
--[[
-- registerAlert ( {alertRegistrant} [, {alertRegistrant} ] ... )
--
-- Registers an alert watcher with Sky.
-- Alerts are called immediately, rather than stored.
-- This can cause lag if too many are sent.
-- You are warned!
--]]
</pre>
 
=== registerHostess ===
<pre>
--[[
-- registerHostess( {skyHostess} [, {skyHostess}] )
-- Registers a hostess who gets informed as channels are made available,
-- removed, or when players are joined/added.
--
-- args:
-- skyHostess - table
-- {
-- id - unique id for the hostess
-- callback - function called when a channel even occurs
-- (action, actionData)
-- action - string containing
-- SKY_PLAYER_JOIN|SKY_PLAYER_LEAVE|SKY_CHANNEL_LIST|SKY_CHANNEL_JOIN|SKY_CHANNEL_LEFT
--                                            NOTE: SkyLight seems to implement SKY_CHANNEL_LEAVE instead of SKY_CHANNEL LEFT,
--                                                  even though its comments don't reflect this. I don't know about regular Sky.
-- actionData - table
-- {
-- channel - channel name (SKY_CHANNEL or whatever)
--
-- (action dependent:)
-- username - string - username of the player who joined/left
-- list - table - users in channel
-- }
--
-- channels - table containing channels
-- SKY_CHANNEL, SKY_PARTY, "general", etc
-- description - short string describing the addon
-- }
--]]
</pre>
 
=== updateHostess ===
<pre>
--[[
-- updateHostess ( {skyHostess} [, {skyHostess}] )
-- Updates a hostess to have new values
--
-- args:
-- See registerHostess
--
-- returns:
-- true - success
-- false - failed to register
--]]
</pre>
 
=== unregisterHostess ===
<pre>
--[[
-- unregisterHostess(id)
-- unregisters the specified hostess by id
--
-- args:
-- id - string id
--]]
</pre>
 
=== unregisterSlashCommand ===
<pre>
--[[
-- unregisterSlashCommand(id)
-- Removes the slash commands associated with that id
--
-- args:
-- id - string id
--
--]]
</pre>
 
=== unregisterAlert ===
<pre>
--[[
-- unregisterAlert(id)
-- Unregisters an alert by its id
--
-- args:
-- id - string id
--
--]]
</pre>
 
=== unregisterMailbox ===
<pre>
--[[
-- unregisterMailbox(id)
-- unregisters the mailbox with the specified id
--
-- args:
-- id - string id of the mailbox
--]]
</pre>
 
=== checkBandwidth ===
<pre>
--[[
-- checkBandwidth()
-- Check the status of the bandwidth limit.
-- returns:
-- A positive or negative number, the size of which indicates how
-- much over (positive) or under (negative) the client is relative
-- to the bandwidth limit.
--]]
</pre>
 
=== isHostingByID ===
<pre>
--[[
-- isHostingByID(id)
-- retuns true if there's a hostess with that id
--
-- args:
-- id - string id
--
-- returns:
-- true - it exists
-- false - not exists
--]]
</pre>
[[Category:Cosmos AddOns]]

Latest revision as of 04:48, 15 August 2023

AddOn
WoW AddOn Library Page

This page is for all documentation of Sky.

Functions[edit]

isChannelActive[edit]

--	isChannelActive(channelID)
--
--		Tells you if a channel is active 
--		(meaning you can use it)
--
--		e.g. 
--			Sky.isChannelActive(SKY_CHANNEL) 
--			will return true if the "Sky" channel
--			exists in your channel list. 
--
--	args:
--		channelID - can be a string, a hard channel number or a SKY_IDENT
--
--	returns:
--		true - the channel is active and usable
--		false - the channel is inactive and unusable

activate[edit]

-- 	activate()
--		Turns Sky on

deactivate[edit]

--	deactivate()
--		Turns Sky off

emptyMailbox[edit]

--[[
--
--	emptyMailbox(mailboxID)
--		Empties a mailbox with id mailboxID
--
--	args:
--		mailboxID - string which is the mailbox's ID defined in Sky.registerChatWatch
--
--	returns: 
--		nil
--]]

getAllMessages[edit]

All messages will be returned in a number-indexed table in order recieved.

--[[
--	getAllMessages(mailboxID)
--		Returns a table containing all of the messages in the mailbox. 
--		It will then empty the mailbox.
--
--	returns:
--		table of mailbox entries
--]]

getNextMessage[edit]

--[[
--	getNextMessage(mailboxID)
--		Returns a table containing the next SkyEnvelope in that mailbox, or nil if no message exists
--		The message returned is removed from the mailbox.
--	
--		See the SkyEnvelope definition for more information
--			
--	returns:
--		table - the next message
--		nil - no message
--]]

updateSlashCommand[edit]

--[[
--	updateSlashCommand ( {slashCommandParts}, ... )
--
--		Updates a /command member if its valid.
--
--		e.g.
--			updateSlashCommand({id="myID";onExecute = fooFunc; } );
--
--			will change the onExecute function for myID.
--
--	arg members:
--		id - the ID matching the old slashCommand
--		member - onExecute | onSpace | onTab | commands | action | helpText
--		newvalue - the new value. 
--
--	returns:
--		true - successfully replace.
--		false - validation failed
--]]

registerSlashCommand[edit]

--[[
--	registerSlashCommand ( {slashCommand} [, {slashCommand}] ...)
--
--		See the slashCommand definition for more information. 
--
--	(Should be at the end of this file)
--		
--	Example:
--		Sky.registerSlashCommand(
--			{
--				id = "SnoopyCommand";
--				commands = {"/snoop", "/snoopy"};
--				onExecute = function( msg, cmd ) Sea.io.print("You're snoopy, ", msg , "! You  used: ", cmd ); end; 
--				action = "before";
--				helpText = "Shows the world you're nuts!"
--			}
--		);
--
--		/snoop Belldandy
--
--		Would print "You're snoopy, Belldandy! You used /snoop"
--
--		Action:
--			"hide"
--			If you return true from the slash command, it will attempt to 
--			call the default or previous slash command.
--
--			"before"
--			It will call your new function before the default command.
--
--			"after"
--			It will cally our new function after the default command.
--
--	Returns:
--		true - success!
--		false - a command failed!
--
--]]

registerMailbox[edit]

--[[
--
--	registerMailbox({mailboxRegistrant}, ...)
--
--		Registers a mailbox which will drop messages into a 
--		mailbox matching id, if acceptTest(message) returns true. 
--
--		See the mailboxRegistrant definition for more details
--		
--	Returns:
--		true if successful
--		false if unable to register
--]]

unregisterMailbox[edit]

--[[
--	unregisterMailbox(id)
--		unregisters the mailbox with the specified id
--
--	args:
--		id - string id of the mailbox
--]]

sendTable[edit]

--[[
--	sendTable( table [, system, target, player])
--	
--		Sends a lua object to the target using Sky.
--		See sendMessage for argument details
--
--]]

sendMessage[edit]

  • This can be used for regular chat, the only difference from SendChatMessage will be that it will be bound by the outbound character limit and chopped into pieces if it's too long.
  • SAY, WHISPER, PARTY, GUILD, RAID and CHANNEL messages will not be parsed or have special characters encoded.
  • SKY_CHANNEL, SKY_GROUP, SKY_GUILD, and SKY_PLAYER have line breaks, "s", "S" and "|" converted to invisible characters and back to their correct characters on the recieving end.

EX:

Sky.sendMessage("Group Members Rock!", "PARTY")
Sky.sendMessage("Whispers Rock!", "WHISPER", nil, "PlayerName")
Sky.sendMessage("101101001 Blah", SKY_CHANNEL, "AddonID")
--[[
--	sendMessage(message [, system, target, player])
--
--		Sends a simple text message to a 
--		specified target using Sky. 
--
--	Args:
--		message - the text to be delivered
--
--		optional (Default is an unencoded "SAY" to no particular target):
--		
--		system - channel/system used for transport 
--			(Sky Encoded & Hidden Messages)
--			SKY_CHANNEL |"global" - sends to all Sky users
--			SKY_GROUP  - sends to party/raid members using Sky
--			SKY_GUILD - sends to all guild members using Sky
--			SKY_PLAYER - sends to a player using Sky, through a hidden whisper
--			(Pure/Visible Messages)
--			"SAY" sends to the world regardless of Sky usage
--			"WHISPER" sends to a player regardless of Sky usage
--			"PARTY" sends to a party regardless of Sky usage
--			"GUILD" sends to a guild regardless of Sky usage
--			"RAID" sends to a raid regardless of Sky usage
--			"CHANNEL" sends to a particular channel (1, general, etc)
--			
--		target - destination mailbox
--			This value will be the .target value of the envelope sent to acceptTest
--
--		player - 
--			( channel identifier for "CHANNEL" )
--			( playername for SKY_PLAYER/"WHISPER" )
--			( nil for everything else )
--
--]]

isSkyUser[edit]

--	isSkyUser ( username ) 
--		Checks if a username is a known sky user. If they are not, you get nil.
--		If they are, you get a list of the channels they have been seen in. 
--
--		Due to the way the SkyUserList updates, 
--		You should do this 20 seconds after the party changes.
--
--	Returns:
--		table - list of the channels they are in
--		nil - they are not known to be a sky user. 

flush[edit]

Warning:

Do not use this function recklessly. It will attempt to dump 30 messages at a time out of the SkyQueue. However, this may cause framerate drops if you have a lot of messaging going on.

A better solution is to use Sky.sendFastMessage().

--	flush()
--		Forces all timers to go off NOW
--
--

sendAlert[edit]

--[[
--	sendAlert (message [, system, alertid])
--
--		Sends a message instantly through Sky. 
--		Alerts cannot be longer than SKY_MAX_DATAGRAM_LENGTH
--		and cannot contain anything but text.
--
--	Args:
--		message - message to be sent
--		system - SKY_CHANNEL|SKY_PARTY|SKY_PLAYER|SKY_ZONE|SKY_RAID
--		alertid - 2 character code to indicate who gets alerted
--
--	Returns:
--		true - message parsed and sent
--		false - unable to parse or unable to send
--		
--]]

registerAlert[edit]

--[[
--	registerAlert ( {alertRegistrant} [, {alertRegistrant} ] ... )
--
--		Registers an alert watcher with Sky. 
--		Alerts are called immediately, rather than stored. 
--		This can cause lag if too many are sent. 
--		You are warned!
--]]

registerHostess[edit]

--[[
--	registerHostess( {skyHostess} [, {skyHostess}] )
--		Registers a hostess who gets informed as channels are made available,
--		removed, or when players are joined/added. 
--
--	args:
--		skyHostess - table
--			{
--				id - unique id for the hostess
--				callback - function called when a channel even occurs
--					(action, actionData)
--					action - string containing 
--						SKY_PLAYER_JOIN|SKY_PLAYER_LEAVE|SKY_CHANNEL_LIST|SKY_CHANNEL_JOIN|SKY_CHANNEL_LEFT
--                                             NOTE: SkyLight seems to implement SKY_CHANNEL_LEAVE instead of SKY_CHANNEL LEFT,
--                                                   even though its comments don't reflect this. I don't know about regular Sky.
--					actionData - table
--						{
--							channel - channel name (SKY_CHANNEL or whatever)
--							
--						(action dependent:)
--							username - string - username of the player who joined/left
--							list - table - users in channel
--						}
--					
--				channels - table containing channels
--					SKY_CHANNEL, SKY_PARTY, "general", etc
--				description - short string describing the addon
--			}
--]]

updateHostess[edit]

--[[
--	updateHostess ( {skyHostess} [, {skyHostess}] )
--		Updates a hostess to have new values
--
--	args: 
--		See registerHostess
--
--	returns:
--		true - success
--		false - failed to register
--]]

unregisterHostess[edit]

--[[
--	unregisterHostess(id)
--		unregisters the specified hostess by id
--
--	args:
--		id - string id
--]]

unregisterSlashCommand[edit]

--[[
--	unregisterSlashCommand(id)
--		Removes the slash commands associated with that id
--
--	args:
--		id - string id
--
--]]

unregisterAlert[edit]

--[[
--	unregisterAlert(id)
--		Unregisters an alert by its id
--
--	args:
--		id - string id
--
--]]

unregisterMailbox[edit]

--[[
--	unregisterMailbox(id)
--		unregisters the mailbox with the specified id
--
--	args:
--		id - string id of the mailbox
--]]

checkBandwidth[edit]

--[[
--	checkBandwidth()
--		Check the status of the bandwidth limit.
--	returns:
--		A positive or negative number, the size of which indicates how
--		much over (positive) or under (negative) the client is relative
--		to the bandwidth limit.
--]]

isHostingByID[edit]

--[[
--	isHostingByID(id)
--		retuns true if there's a hostess with that id
--
--	args:
--		id - string id
--
--	returns:
--		true - it exists
--		false - not exists
--]]