Eventtype: Difference between revisions
not sure if SERVER_DISCONNECTED is still used |
No edit summary |
||
Line 1: | Line 1: | ||
== Introduction == | |||
Known | Events are used for communication between different parts of the client. For example the chat log is registered to the CHAT_MSG_CHANNEL event. When the client receives a chat message the event is triggered and the received string passed along with it. | ||
The event callback in the chat log now appends the string to the log. | |||
A very basic example using the TARGET_CHANGED event. It's triggered whenever the target changes | |||
<source lang="lua"> | |||
-- define a table. this table is the "object" that gets registered with event | |||
target = {} | |||
-- define a function called OnEvent within this table. It's called when the event is triggered. | |||
-- It has at least one argument, containing the name of the event that is passed to it | |||
function target:OnEvent(event) | |||
-- this way it is possible to handle multiple events with one table | |||
if event == "TARGET_CHANGED" then | |||
-- the only action is to print something | |||
print("Target Changed") | |||
end | |||
end | |||
-- register the table with the event | |||
RegisterEvent(target, "TARGET_CHANGED") | |||
</source> | |||
== Notes == | |||
Calling RegisterEvent twice with the same arguments will result in the same table receiving an event twice, which is generally not wanted. Use ReloadInterface or UnregisterEvent to get rid previously registered tables before registering new ones. | |||
Passing locally defined tables to RegisterEvent doesn't work. | |||
example: | |||
<source lang="lua"> | |||
do | |||
local tab = {} | |||
function tab:OnEvent() print("this doesn't work") end | |||
RegisterEvent(tab, "MYEVENT") | |||
end | |||
</source> | |||
the table needs a strong reference: | |||
<source lang="lua"> | |||
do | |||
local tab = {} | |||
function tab:OnEvent() print("this does work") end | |||
RegisterEvent(tab, "MYEVENT") | |||
tab_strong = tab | |||
end | |||
</source> | |||
== Eventlist == | |||
The client provides a set of predefined events. | |||
Known events are: | |||
ACTIVATE_CHAT_CHANNEL<br> | ACTIVATE_CHAT_CHANNEL<br> | ||
Line 17: | Line 73: | ||
CHAT_DONE<br> | CHAT_DONE<br> | ||
CHAT_MSG_BAR1 - A message from an Itani in the station bar.<br> | CHAT_MSG_BAR1 - A message from an Itani in the station bar.<br> | ||
CHAT_MSG_BAR2 - A message from | CHAT_MSG_BAR2 - A message from a Serco in the station bar.<br> | ||
CHAT_MSG_BAR3 - A message from | CHAT_MSG_BAR3 - A message from a UIT in the station bar.<br> | ||
CHAT_MSG_BAR<br> | CHAT_MSG_BAR<br> | ||
CHAT_MSG_BARENTER - A message stating that a player has entered the bar.<br> | CHAT_MSG_BARENTER - A message stating that a player has entered the bar.<br> | ||
Line 24: | Line 80: | ||
CHAT_MSG_BARLIST - A message listing the players currently in the bar.<br> | CHAT_MSG_BARLIST - A message listing the players currently in the bar.<br> | ||
CHAT_MSG_BAR_EMOTE1 - An emote (/me) message from an Itani in the station bar.<br> | CHAT_MSG_BAR_EMOTE1 - An emote (/me) message from an Itani in the station bar.<br> | ||
CHAT_MSG_BAR_EMOTE2 - An emote (/me) message from | CHAT_MSG_BAR_EMOTE2 - An emote (/me) message from a Serco in the station bar.<br> | ||
CHAT_MSG_BAR_EMOTE3 - An emote (/me) message from | CHAT_MSG_BAR_EMOTE3 - An emote (/me) message from a UIT in the station bar.<br> | ||
CHAT_MSG_BAR_EMOTE<br> | CHAT_MSG_BAR_EMOTE<br> | ||
CHAT_MSG_BUDDYNOTE<br> | CHAT_MSG_BUDDYNOTE<br> |
Revision as of 12:51, 5 November 2007
Introduction
Events are used for communication between different parts of the client. For example the chat log is registered to the CHAT_MSG_CHANNEL event. When the client receives a chat message the event is triggered and the received string passed along with it. The event callback in the chat log now appends the string to the log.
A very basic example using the TARGET_CHANGED event. It's triggered whenever the target changes
<source lang="lua">
-- define a table. this table is the "object" that gets registered with event
target = {}
-- define a function called OnEvent within this table. It's called when the event is triggered. -- It has at least one argument, containing the name of the event that is passed to it function target:OnEvent(event)
-- this way it is possible to handle multiple events with one table if event == "TARGET_CHANGED" then -- the only action is to print something print("Target Changed") end
end
-- register the table with the event RegisterEvent(target, "TARGET_CHANGED")
</source>
Notes
Calling RegisterEvent twice with the same arguments will result in the same table receiving an event twice, which is generally not wanted. Use ReloadInterface or UnregisterEvent to get rid previously registered tables before registering new ones.
Passing locally defined tables to RegisterEvent doesn't work. example: <source lang="lua"> do
local tab = {} function tab:OnEvent() print("this doesn't work") end RegisterEvent(tab, "MYEVENT")
end </source>
the table needs a strong reference: <source lang="lua"> do
local tab = {} function tab:OnEvent() print("this does work") end RegisterEvent(tab, "MYEVENT") tab_strong = tab
end </source>
Eventlist
The client provides a set of predefined events.
Known events are:
ACTIVATE_CHAT_CHANNEL
ACTIVATE_CHAT_GROUP
ACTIVATE_CHAT_GUILD
ACTIVATE_CHAT_MISSION
ACTIVATE_CHAT_PRIVATE
ACTIVATE_CHAT_SAY
ACTIVATE_CHAT_SECTOR
ACTIVATE_CHAT_USER
AUTOAIM_MODE_CHANGED
CHANGE_ACTIVE_CHATTAB
CHARINFOMENU_TOGGLE
CHAT_CANCELLED
CHAT_DONE
CHAT_MSG_BAR1 - A message from an Itani in the station bar.
CHAT_MSG_BAR2 - A message from a Serco in the station bar.
CHAT_MSG_BAR3 - A message from a UIT in the station bar.
CHAT_MSG_BAR
CHAT_MSG_BARENTER - A message stating that a player has entered the bar.
CHAT_MSG_BARLEAVE - A message stating that a player has left the bar.
CHAT_MSG_BARLIST - A message listing the players currently in the bar.
CHAT_MSG_BAR_EMOTE1 - An emote (/me) message from an Itani in the station bar.
CHAT_MSG_BAR_EMOTE2 - An emote (/me) message from a Serco in the station bar.
CHAT_MSG_BAR_EMOTE3 - An emote (/me) message from a UIT in the station bar.
CHAT_MSG_BAR_EMOTE
CHAT_MSG_BUDDYNOTE
CHAT_MSG_CHANNEL
CHAT_MSG_CHANNEL_ACTIVE
CHAT_MSG_CHANNEL_EMOTE
CHAT_MSG_CHANNEL_EMOTE_ACTIVE
CHAT_MSG_CONFIRMATION
CHAT_MSG_DEATH
CHAT_MSG_ERROR
CHAT_MSG_GLOBAL_SERVER
CHAT_MSG_GROUP - A message from a player in your group.
CHAT_MSG_GUIDE - A message from a guide.
CHAT_MSG_GUILD - A message from guildmate.
CHAT_MSG_GUILD_EMOTE - An emote (/me) message from a guildmate.
CHAT_MSG_GUILD_MOTD - The guild MOTD.
CHAT_MSG_GROUP_NOTIFICATION
CHAT_MSG_INCOMINGBUDDYNOTE
CHAT_MSG_MISSION
CHAT_MSG_MOTD
CHAT_MSG_NATION - A message on nation chat. Depricated/unused.
CHAT_MSG_PRINT
CHAT_MSG_PRIVATE - An incoming private message from another player.
CHAT_MSG_PRIVATEOUTGOING - An outgoing private message to another player.
CHAT_MSG_SECTOR - A message from a player in the sector.
CHAT_MSG_SECTORD - A message from the sector daemon.
CHAT_MSG_SECTORD_MISSION - A mission message from the sector daemon.
CHAT_MSG_SECTORD_SECTOR - A sector message from the sector daemon (temp KOS standing messages and the 'You've been caught in an Ion Storm.' messages)
CHAT_MSG_SECTOR_EMOTE - An emote (/me) message from a player in-sector.
CHAT_MSG_SERVER
CHAT_MSG_SERVER_CHANNEL
CHAT_MSG_SERVER_CHANNEL_ACTIVE
CHAT_MSG_SERVER_GUILD
CHAT_MSG_SERVER_SECTOR
CHAT_MSG_SYSTEM - A message from another player in your system.
CHAT_SCROLL_DOWN
CHAT_SCROLL_UP
CINEMATIC_START - Called when an ingame cinematic is started. Examples include the undocking animation and the warping sequences.
COMMAND
DESIRED_SPEED_CHANGED
ENTERED_STATION
ENTERING_STATION
FLIGHT_MODE_CHANGED
GROUP_CREATED
GROUP_MEMBER_DIED
GROUP_MEMBER_HEALTH_UPDATE
GROUP_MEMBER_JOINED
GROUP_MEMBER_KILLED
GROUP_MEMBER_LEFT
GROUP_MEMBER_LOCATION_CHANGED
GROUP_MEMBER_UPDATE
GROUP_OWNER_CHANGED
GROUP_SELF_JOINED
GROUP_SELF_LEFT
GUILD_ACTIVITY_LOG
GUILD_BALANCE_UPDATED
GUILD_BANK_LOG
GUILD_MEMBERS_UPDATED
GUILD_MEMBER_ADDED
GUILD_MEMBER_REMOVED
GUILD_MEMBER_UPDATED
GUILD_MOTD_UPDATED
GUILD_PRIVILEGES_UPDATED
HUD_HELP_TOGGLE
HUD_HIDE
HUD_INVENTORY_TOGGLE
HUD_MODE_TOGGLE
HUD_SHOW
HUD_TOGGLE
HUD_UPDATE
INVENTORY_ADD
INVENTORY_REMOVE
INVENTORY_UPDATE
JETTISONMENU_TOGGLE
JUMP_OUT_CINEMATIC_FINISHED - Called when the sector jump-out cinematic is finished.
LEAVING_STATION
LOGIN_FAILED
LOGIN_SUCCESSFUL
MISSIONLIST_UPDATED
MISSION_ADDED
MISSION_NOTIFICATION
MISSION_QUESTION_OPEN
MISSION_REMOVED
MISSION_TIMER_START
MISSION_TIMER_STOP
MISSION_UPDATED
MSG_LOGOFF_TIMER
MSG_NOTIFICATION
NAVMENU_TOGGLE
NAVROUTE_ADD
NAVROUTE_CHANGED
NAVROUTE_SAVE
NAVROUTE_UNDOLAST
OBJECT_INFO_UPDATED
OPEN_SURVEY
PLAYERLIST_TOGGLE
PLAYER_DIED
PLAYER_ENTERED_GAME
PLAYER_ENTERED_SECTOR
PLAYER_GOT_HIT
PLAYER_GUILD_TAG_UPDATED
PLAYER_HIT
PLAYER_HOME_CHANGED
PLAYER_LEFT_SECTOR
PLAYER_LOGGED_OUT
PLAYER_RECEIVED_NEW_ACCOMPLISHMENTS
PLAYER_STATS_UPDATED
PLAYER_UPDATE_ACCOMPLISHMENTS
PLAYER_UPDATE_FACTIONSTANDINGS
PLAYER_UPDATE_SKILLS
PLAYER_UPDATE_STATS
PROXIMITY_ALERT
SECTOR_CHANGED
SECTOR_LOADED
SECTOR_LOADING
SERVER_DISCONNECTED
SHIP_CHANGED
SHIP_SPAWNED
SHIP_UPDATED
SHOW_STATION
START
STATION_TURRET_HEALTH_UPDATE
STATION_UPDATED
STATION_UPDATE_DESIREDITEMS
STATION_UPDATE_PRICE
SYSMENU_TOGGLE
TARGET_CHANGED
TARGET_HEALTH_UPDATE
TARGET_SCANNED
TERMINATE
TRANSACTION_COMPLETED
TRANSACTION_FAILED
UNLOAD_INTERFACE - raised when interface is about to be reloaded.
UPDATE_BUDDY_LIST
UPDATE_CHARACTER_LIST
UPDATE_CHARINFO
UPDATE_DUEL_INFO
UPDATE_NEWS
UPDATE_NEWS_HEADLINES
WARP_OUT_CINEMATIC_FINISHED - Called when the wormhole warp-out cinematic is finished.
WEAPON_GROUP_CHANGED
WEAPON_PROGRESS_START
WEAPON_PROGRESS_STOP
rHUDxscale