New functions:
--JPEvent JPEvent.activate ( sUserToken, sActivationKey ) --NEW EVENT --"onWillBeDestroyed" trigered when an AIModel will be destroyed. --For users, it occurs in the following cases : -- - When the AIModel is removed from the user. (user.removeAIModel) -- - When the user is destroyed. (application.destroyUser) --For objects, it occurs in the following cases : -- - When the AIModel is removed from the object. (object.removeAIModel) -- - When the object is explicitly destroyed, or if its parent is destroyed.(scene.destroyRuntimeObject, object.destroy, ) -- - When the scene of the object is closed. (user.setScene, application.setCurrentUserScene) --For both users and objects: -- - When the application stops or is restarted (onApplicationWillQuit) --IMPROVED API FUNCTIONS: possibility to set a pattern for the AIModel parameter. If the AIModel is nil, the event will be sent to any AIModel of the specified target object.sendEventImmediate ( hObject, sAIModelPattern, sHandler, vParam0, vParam1, ... ) object.sendEvent ( hObject, sAIModelPattern, sHandler, vParam0, vParam1, ... ) object.postEvent ( hObject, nDelay, sAIModelPattern, sHandler, vParam0, vParam1, ... ) user.sendEventImmediate ( hUser, sAIModelPattern, sHandler, vParam0, vParam1, ... ) user.sendEvent ( hUser, sAIModelPattern, sHandler, vParam0, vParam1, ... ) user.postEvent ( hUser, nDelay, sAIModelPattern, sHandler, vParam0, vParam1, ... ) --NEW API FUNCTIONS: Note that you can use these function using both api.function ( ) or JPEvent.api_function ( ). Only the second case will have code completion. --application application.cancelEvents ( sAIModelPattern, sHandlerPattern ) application.cancelObjectEvents ( sAIModelPattern, sHandlerPattern ) application.cancelUserEvents ( sAIModelPattern, sHandlerPattern ) application.delayEvents ( nDelay, sAIModelPattern, sHandlerPattern ) application.delayObjectEvents ( nDelay, sAIModelPattern, sHandlerPattern ) application.delayUserEvents ( nDelay, sAIModelPattern, sHandlerPattern ) application.pauseEvents ( sAIModelPattern, sHandlerPattern ) application.pauseObjectEvents ( sAIModelPattern, sHandlerPattern ) application.pauseUserEvents ( sAIModelPattern, sHandlerPattern ) application.postEventToCurrentUser ( nDelay, sAIModelPattern, sHandler, vParam0, vParam1, ... ) application.resumeEvents ( sAIModelPattern, sHandlerPattern ) application.resumeObjectEvents ( sAIModelPattern, sHandlerPattern ) application.resumeUserEvents ( sAIModelPattern, sHandlerPattern ) application.postEventToCurrentUser ( nDelay, sAIModelPattern, sHandler, vParam0, vParam1, ... ) application.sendEventImmediateToCurrentUser ( sAIModelPattern, sHandler, vParam0, vParam1, ... ) application.sendEventToCurrentUser ( sAIModelPattern, sHandler, vParam0, vParam1, ... ) application.postEventToAllUsers ( nDelay, sAIModelPattern, sHandler, vParam0, vParam1, ... ) application.sendEventImmediateToAllUsers ( sAIModelPattern, sHandler, vParam0, vParam1, ... ) application.sendEventToAllUsers ( sAIModelPattern, sHandler, vParam0, vParam1, ... ) --object object.cancelEvents ( hObject, sAIModelPattern, sHandlerPattern ) object.delayEvents ( hObject, nDelay, sAIModelPattern, sHandlerPattern ) object.pauseEvents ( hObject, sAIModelPattern, sHandlerPattern ) object.resumeEvents ( hObject, sAIModelPattern, sHandlerPattern ) --scene scene.cancelEvents ( hScene, sAIModelPattern, sHandlerPattern ) scene.cancelObjectEvents ( hScene, sAIModelPattern, sHandlerPattern ) scene.cancelUserEvents ( hScene, sAIModelPattern, sHandlerPattern ) scene.delayEvents ( hScene, nDelay, sAIModelPattern, sHandlerPattern ) scene.delayObjectEvents ( hScene, nDelay, sAIModelPattern, sHandlerPattern ) scene.delayUserEvents ( hScene, nDelay, sAIModelPattern, sHandlerPattern ) scene.pauseEvents ( hScene, sAIModelPattern, sHandlerPattern ) scene.pauseObjectEvents ( hScene, sAIModelPattern, sHandlerPattern ) scene.pauseUserEvents ( hScene, sAIModelPattern, sHandlerPattern ) scene.resumeEvents ( hScene, sAIModelPattern, sHandlerPattern ) scene.resumeObjectEvents ( hScene, sAIModelPattern, sHandlerPattern ) scene.resumeUserEvents ( hScene, sAIModelPattern, sHandlerPattern ) --user user.cancelEvents ( hUser, sAIModelPattern, sHandlerPattern ) user.delayEvents ( hUser, nDelay, sAIModelPattern, sHandlerPattern ) user.pauseEvents ( hUser, sAIModelPattern, sHandlerPattern ) user.resumeEvents ( hUser, sAIModelPattern, sHandlerPattern )
Who has never be in need to cancel a posted event?
JPEvent is a very useful tool. With this tool, you will be able to control events you have posted. It allows you to cancel events, to pause or resume them, and also to add some additional delay.
You will be able to do actions on several events at once, thanks to the patterns support.
JPEvent provides various functions, to target object events only, user events, events sent in a scene or in the whole application. Here are a couple of functions:
--All of these functions can be used with patterns! user.cancelEvents ( hUser ) scene.pauseObjectEvents ( hScene, "MonsterType.*", ".*" ) object.resumeEvents ( hObject, ".*", "onAttack" ) application.delayEvents ( 3 )
All of the available functions can be found in the API page of JPEvent.
JPEvent also provides a new feature when sending events, the possibility to use a pattern in place of the AIModel name. With this king of feature, you will be able to send events to several AIModels at once. This feature works for both users and objects, with postEvent, sendEvent and sendEventImmediate. Also, 3 new functions are available, to be able to send events to the current user without having to use its handle:
application.postEventToCurrentUser ( nDelay, sAIModelPattern, sHandler, vParam0, ... ) application.sendEventImmediateToCurrentUser ( sAIModelPattern, sHandler, vParam0, ... ) application.sendEventToCurrentUser ( sAIModelPattern, sHandler, vParam0, ... )
Finally, it offers a very interesting feature: it sends a "onWillBeDestroyed" to any AIModel, just before it will be destroyed. This is really great, it allows you for instance to free the allocated resources during the AIModel life time. It works for any AIModel, for both users and objetcs, an occurs in the following cases: