Eventtype: Difference between revisions

From Vendetta Lua
Jump to navigationJump to search
BlackNet (talk | contribs)
→‎Eventlist: entered station is still valid
Line 123: Line 123:
ENTERED_STATION<br>
ENTERED_STATION<br>
ENTERING_STATION<br>
ENTERING_STATION<br>
ENTER_ZONE_NFZ<br>
FLIGHT_MODE_CHANGED<br>
FLIGHT_MODE_CHANGED<br>
GROUP_CREATED<br>
GROUP_CREATED<br>
Line 161: Line 162:
JETTISONMENU_TOGGLE<br>
JETTISONMENU_TOGGLE<br>
JUMP_OUT_CINEMATIC_FINISHED - Called when the sector jump-out cinematic is finished.<br>
JUMP_OUT_CINEMATIC_FINISHED - Called when the sector jump-out cinematic is finished.<br>
LEAVE_ZONE_NFZ<br>
LEAVING_STATION<br>
LEAVING_STATION<br>
LOGIN_FAILED<br>
LOGIN_FAILED<br>

Revision as of 22:06, 6 November 2008

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
ENTER_ZONE_NFZ
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_INVITED
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_SKIRMISH_CLOSE
HUD_SKIRMISH_OPEN
HUD_SKIRMISH_UPDATE
HUD_TOGGLE
HUD_UPDATE
INVENTORY_ADD
INVENTORY_RECEIVED
INVENTORY_REMOVE
INVENTORY_UPDATE
JETTISONMENU_TOGGLE
JUMP_OUT_CINEMATIC_FINISHED - Called when the sector jump-out cinematic is finished.
LEAVE_ZONE_NFZ
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_ALIGNMENT_UPDATED
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
STATION_UPDATE_REQUESTED
STORM_STARTED
STORM_STOPPED
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
VOICECHAT_PLAYER_LISTEN_STATUS
VOICECHAT_PLAYER_MUTE_STATUS
VOICECHAT_PLAYER_TALK_STATUS
WARP_OUT_CINEMATIC_FINISHED - Called when the wormhole warp-out cinematic is finished.
WEAPON_GROUP_CHANGED
WEAPON_PROGRESS_START
WEAPON_PROGRESS_STOP
rHUDxscale