This wiki is archived and useful information is being migrated to the main bzflag.org website

Editing Events (API)

Jump to: navigation, search

Warning: The database has been locked for maintenance, so you will not be able to save your edits right now. You may wish to copy and paste your text into a text file and save it for later.

The administrator who locked it offered this explanation: Archived wiki

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
{{BZFS_API_Doc|keeptitle=1}}
+
darc4tz
 +
{{DoDoc|Fill in articles for all API events}}
 +
 
 +
{{BZFS_API_Doc}}
 +
 
 
==Overview==
 
==Overview==
 
API events are callbacks that a [[Plug-ins|plug-in]] can install into [[BZFS]] to be called in response to specific actions or state changes in the server side game world. Events are the primary method of communication from BZFS to installed plug-ins. Specific events exist for nearly all logical actions that can happen during a game of BZFlag.
 
API events are callbacks that a [[Plug-ins|plug-in]] can install into [[BZFS]] to be called in response to specific actions or state changes in the server side game world. Events are the primary method of communication from BZFS to installed plug-ins. Specific events exist for nearly all logical actions that can happen during a game of BZFlag.
  
 
==Installation and Removal==
 
==Installation and Removal==
The callbacks for events are typically installed during the [[bz_Load]] (2.0.x) or [[Init]] (2.4+) entry point in a plug-in, so they can be active when a plug-in is first loaded.
+
The callbacks for events are typically installed during the [[bz_Load]] entry point in a plug-in, so they can be active when a plug-in is first loaded.
  
 
The plug-in must call the function;
 
The plug-in must call the function;
  
2.0.x
 
 
  BZF_API bool [[bz_registerEvent]] ( bz_eEventType eventType, [[bz_EventHandler]]* eventHandler );
 
  BZF_API bool [[bz_registerEvent]] ( bz_eEventType eventType, [[bz_EventHandler]]* eventHandler );
  
2.4+
+
The plug-in registers and event callback derived from [[bz_EventHandler]] for each specific event types it wishes to monitor.
Register ( bz_eEventType );
+
  
The plug-in registers and event callback derived from [[bz_EventHandler]] (2.0.x) or [[bz_Plugin]] (2.4+) for each specific event types it wishes to monitor.
+
When a plug-in no longer needs to monitor an event, or when it is unloaded in the [[bz_Unload]] entry point, the plug-in must remove the installed callback by calling the function;
  
When a plug-in no longer needs to monitor an event, or when it is unloaded in the [[bz_Unload]] (2.0.x) or [[Cleanup]] (2.4+) entry point, the plug-in must remove the installed callback by calling the function;
 
 
2.0.x
 
 
  BZF_API bool [[bz_removeEvent]] ( bz_eEventType eventType, [[bz_EventHandler]]* eventHandler );
 
  BZF_API bool [[bz_removeEvent]] ( bz_eEventType eventType, [[bz_EventHandler]]* eventHandler );
 
2.4+
 
Flush();
 
 
In BZFlag 2.4, events are no longer removed individually but instead they are all removed automatically by calling on the 'Flush()' method.
 
  
 
==Event Handler==
 
==Event Handler==
The plug-in must define a class that is derived from [[bz_EventHandler]] (2.0.x) or [[bz_Plugin]] (2.4+) and pass a pointer to an object of that class when ever it registers an event callback.
+
The plug-in must define a class that is derived from [[bz_EventHandler]] and pass a pointer to an object of that class when ever it registers an event callback.
  
When ever a specific event is triggered, BZFS will call the 'process' (2.0.x) or 'Event' (2.4+) method of the installed callback class.
+
When ever a specific event is triggered, BZFS will call the 'process' method of the installed callback class.
  
2.0.x
 
 
   virtual void process ( bz_EventData *eventData ) = 0;
 
   virtual void process ( bz_EventData *eventData ) = 0;
 
2.4+
 
  virtual void Event ( bz_EventData *eventData ) = 0;
 
  
 
==Event Data==
 
==Event Data==
Line 47: Line 37:
  
 
==Events==
 
==Events==
The following list contains all the event types currently supported by BZFS version 2.99
+
The following list contains all the event types currently supported by BZFS version 2.1
  
   [[bz_eAllowAutoPilotChangeEvent]]
+
   [[bz_eNullEvent]]
  [[bz_eAllowCTFCaptureEvent]]
+
  [[bz_eAllowFlagGrabEvent]]
+
  [[bz_eAllowKillCommandEvent]]
+
  [[bz_eAllowPlayer]]
+
  [[bz_eAllowSpawn]]
+
  [[bz_eAnointRabbitEvent]]
+
  [[bz_eAutoPilotChangeEvent]]
+
  [[bz_eBZDBChange]]
+
  [[bz_eBanEvent]]
+
 
   [[bz_eCaptureEvent]]
 
   [[bz_eCaptureEvent]]
  [[bz_eFilteredChatMessageEvent]]
 
  [[bz_eFlagDroppedEvent]]
 
  [[bz_eFlagGrabbedEvent]]
 
  [[bz_eFlagResetEvent]]
 
  [[bz_eFlagTransferredEvent]]
 
  [[bz_eGameStartEvent]]
 
  [[bz_eGameStartEvent|bz_eGameEndEvent]]
 
  [[bz_eGetAutoTeamEvent]]
 
  [[bz_eGetPlayerInfoEvent]]
 
  [[bz_eGetPlayerSpawnPosEvent]]
 
  [[bz_eGetWorldEvent]]
 
  [[bz_eHostBanModifyEvent]]
 
  [[bz_eHostBanNotifyEvent]]
 
  [[bz_eIdBanEvent]]
 
  [[bz_eIdleNewNonPlayerConnection]]
 
  [[bz_eKickEvent]]
 
  [[bz_eKillEvent]]
 
  [[bz_eListServerUpdateEvent]]
 
  [[bz_eLogingEvent]]
 
  [[bz_eLuaDataEvent]]
 
  [[bz_eMessageFilteredEvent]]
 
  [[bz_eNetDataReceiveEvent]]
 
  [[bz_eNetDataSendEvent]]
 
  [[bz_eNewNonPlayerConnection]]
 
  [[bz_eNewRabbitEvent]]
 
  [[bz_eNullEvent]]
 
  [[bz_ePlayerAuthEvent]]
 
  [[bz_ePlayerCollision]]
 
  [[bz_ePlayerCustomDataChanged]]
 
 
   [[bz_ePlayerDieEvent]]
 
   [[bz_ePlayerDieEvent]]
 +
  [[bz_ePlayerSpawnEvent]]
 +
  [[bz_eZoneEntryEvent]]
 +
  [[bz_eZoneExitEvent]]
 
   [[bz_ePlayerJoinEvent]]
 
   [[bz_ePlayerJoinEvent]]
 
   [[bz_ePlayerPartEvent]]
 
   [[bz_ePlayerPartEvent]]
  [[bz_ePlayerPauseRequestEvent]]
 
  [[bz_ePlayerPausedEvent]]
 
  [[bz_ePlayerSentCustomData]]
 
  [[bz_ePlayerSpawnEvent]]
 
  [[bz_ePlayerTeamChangeEvent]]
 
  [[bz_ePlayerUpdateDoneEvent]]
 
  [[bz_ePlayerUpdateEvent]]
 
 
   [[bz_eRawChatMessageEvent]]
 
   [[bz_eRawChatMessageEvent]]
   [[bz_eReloadEvent]]
+
   [[bz_eFilteredChatMessageEvent]]
  [[bz_eReportFiledEvent]]
+
  [[bz_eServerMsgEvent]]
+
  [[bz_eShotEndedEvent]]
+
  [[bz_eShotExpiredEvent]]
+
  [[bz_eShotFiredEvent]]
+
  [[bz_eShotRicochetEvent]]
+
  [[bz_eShotStoppedEvent]]
+
  [[bz_eShotTeleportEvent]]
+
  [[bz_eSlashCommandEvent]]
+
  [[bz_eTeleportEvent]]
+
  [[bz_eTickEvent]]
+
 
   [[bz_eUnknownSlashCommand]]
 
   [[bz_eUnknownSlashCommand]]
   [[bz_eWorldFinalized]]
+
   [[bz_eGetPlayerSpawnPosEvent]]
   [[bz_eZoneEntryEvent]]
+
   [[bz_eGetAutoTeamEvent]]
  [[bz_eZoneExitEvent]]
+
 
+
The following list contains all the event types currently supported by BZFS version 2.4
+
  [[bz_eAllowCTFCaptureEvent]]
+
  [[bz_eAllowFlagGrab]]
+
 
   [[bz_eAllowPlayer]]
 
   [[bz_eAllowPlayer]]
   [[bz_eAllowPollEvent]]
+
   [[bz_eTickEvent]]
 +
  [[bz_eGetWorldEvent]]
 +
  [[bz_eGetPlayerInfoEvent]]
 
   [[bz_eAllowSpawn]]
 
   [[bz_eAllowSpawn]]
 +
  [[bz_eListServerUpdateEvent]]
 
   [[bz_eBanEvent]]
 
   [[bz_eBanEvent]]
   [[bz_eBZDBChange]]
+
   [[bz_eHostBanEvent]]
  [[bz_eCaptureEvent]]
+
  [[bz_eFilteredChatMessageEvent]]
+
  [[bz_eFlagDroppedEvent]]
+
  [[bz_eFlagGrabbedEvent]]
+
  [[bz_eFlagTransferredEvent]]
+
  [[bz_eGameEndEvent]]
+
  [[bz_eGamePauseEvent]]
+
  [[bz_eGameResumeEvent]]
+
  [[bz_eGameStartEvent]]
+
  [[bz_eGetAutoTeamEvent]]
+
  [[bz_eGetPlayerInfoEvent]]
+
  [[bz_eGetPlayerMotto]]
+
  [[bz_eGetPlayerSpawnPosEvent]]
+
  [[bz_eGetWorldEvent]]
+
  [[bz_eHostBanModifyEvent]]
+
 
   [[bz_eKickEvent]]
 
   [[bz_eKickEvent]]
 
   [[bz_eKillEvent]]
 
   [[bz_eKillEvent]]
   [[bz_eListServerUpdateEvent]]
+
   [[bz_ePlayerPausedEvent]]
  [[bz_eLoggingEvent]]
+
  [[bz_eMsgDebugEvent]]
+
 
   [[bz_eMessageFilteredEvent]]
 
   [[bz_eMessageFilteredEvent]]
   [[bz_eNetDataReceiveEvent]]
+
   [[bz_eGameStartEvent]]
   [[bz_eNetDataSendEvent]]
+
   [[bz_eGameEndEvent]]
   [[bz_eNewNonPlayerConnection]]
+
   [[bz_eSlashCommandEvent]]
 
   [[bz_ePlayerAuthEvent]]
 
   [[bz_ePlayerAuthEvent]]
   [[bz_ePlayerDieEvent]]
+
   [[bz_eServerMsgEvent]]
   [[bz_ePlayerJoinEvent]]
+
   [[bz_eShotFiredEvent]]
   [[bz_ePlayerPartEvent]]
+
   [[bz_eAnointRabbitEvent]]
   [[bz_ePlayerPausedEvent]]
+
   [[bz_eNewRabbitEvent]]
   [[bz_ePlayerScoreChanged]]
+
   [[bz_eReloadEvent]]
  [[bz_ePlayerSpawnEvent]]
+
 
   [[bz_ePlayerUpdateEvent]]
 
   [[bz_ePlayerUpdateEvent]]
   [[bz_ePluginLoaded]]
+
   [[bz_eNetDataSendEvent]]
   [[bz_ePluginUnloaded]]
+
   [[bz_eNetDataReceveEvent]]
   [[bz_ePollStartEvent]]
+
   [[bz_eLoggingEvent]]
   [[bz_ePollVoteEvent]]
+
   [[bz_eFlagTransferredEvent]]
   [[bz_ePollVetoEvent]]
+
   [[bz_eFlagGrabbedEvent]]
   [[bz_ePollEndEvent]]
+
   [[bz_eFlagDroppedEvent]]
  [[bz_eRawChatMessageEvent]]
+
  [[bz_eReportFiledEvent]]
+
  [[bz_eServerMsgEvent]]
+
 
   [[bz_eShotEndedEvent]]
 
   [[bz_eShotEndedEvent]]
   [[bz_eShotFiredEvent]]
+
   [[bz_eNewNonPlayerConnection]]
   [[bz_eSlashCommandEvent]]
+
   [[bz_eIdleNewNonPlayerConnection]]
   [[bz_eTeamScoreChanged]]
+
   [[bz_ePlayerCollision]]
   [[bz_eTickEvent]]
+
   [[bz_eFlagResetEvent]]
  [[bz_eUnknownSlashCommand]]
+
 
   [[bz_eWorldFinalized]]
 
   [[bz_eWorldFinalized]]
   [[bz_eZoneEntryEvent]]
+
   [[bz_eAllowCTFCaptureEvent]]
  [[bz_eZoneExitEvent]]
+
  
 
There exists one additional event in the 'bz_eEventType' enumeration in 'bzfsAPI.h', ''bz_eLastEvent''. This event is simply used by BZFS to assist in the counting of the total number of events, it will never be called and can not be installed.
 
There exists one additional event in the 'bz_eEventType' enumeration in 'bzfsAPI.h', ''bz_eLastEvent''. This event is simply used by BZFS to assist in the counting of the total number of events, it will never be called and can not be installed.
  
== See also ==
+
==See also==
* [[BZFS API]]
+
[[BZFS API]]
* [[Functions(API)|BZFS API Functions]]
+
 
* [[Plug-ins]]
+
[[plug-ins]]
  
[[Category:BZFS_API_Functions]]
+
[[Category:BZFS_API_Events]]

Please note that all contributions to BZFlagWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see BZFlagWiki:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel | Editing help (opens in new window)

Template used on this page: