JPEvent

JPEvent

Cancel/pause/resume posted events
Version : 2.0
Price : $25
State : Out

Changelog

v2.0

  • Now compatible with ShiVa 2.0.
  • Plugin API compiled for Mac and Linux in addition to Windows : it will provide API completion in the Script module in ShiVa Editor for each of these operating systems.
  • Now uses a user token instead of an email to activate

v1.7

  • Fixed a bug causing user.setScene to always return nil
  • Fixed a bug with the onWillBeDestroyed event for a user AIModel

v1.6

  • Fixed a bug with events param #11 (was #10).
  • Now compatible with up to 32 parameters (was 16).

v1.5

  • Fixed a bug with event sent to distant users (that are not compatible with string patterns)

v1.4

  • Optimized for ShiVa 1.9.2

v1.3

  • Fixed a bug with application.setCurrentUserScene (was always returning nil)

v1.2

New functions:

  • application.postEventToAllUsers ( nDelay, sAIModelPattern, sHandler, vParam0, vParam1, ... )
  • application.sendEventImmediateToAllUsers ( sAIModelPattern, sHandler, vParam0, vParam1, ... )
  • application.sendEventToAllUsers ( sAIModelPattern, sHandler, vParam0, vParam1, ... )

v1.1

  • Fixed an internal issue
  • The plugin was not able to load in some cases

API

--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 )

Description

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:

  • When you manually call removeAIModel
  • When a scene is closed
  • When a user or object is destroyed
  • When the application quits or is restarted