-
Notifications
You must be signed in to change notification settings - Fork 111
Callback Guide
Callbacks are scripting "hooks" that the engine provides, which allow you to write custom responses to events. Callbacks are optional, if the engine fires off a callback and nothing is defined for that event, then nothing happens.
A common callback that is used in many types of games is "onCollision". When the physics system registers a contact between two objects that have their collision properties properly defined and at least one of the objects has its callback turned on, you can define a script reponse for this event like so:
function SceneObject::onCollision(%this, %sceneObject, %collisionDetails)
{
}
Depending on the namespace and what the object inherits from, you can define callbacks at the name, class/superclass, behavior, or object level.
Remember that the amount of callbacks available to an object depends on its inheritance tree. A Sprite, for example, is not listed here but has the callbacks available from SpriteBase, SceneObject, and SimObject.
SimObject
- onAdd
- onRemove
CompositeSprite
- onCustomLayout
ParticlePlayer
- onStopParticlePlayer
SceneObject
- onUpdate
- onWake
- onSleep
- onMoveToComplete
- onRotateToComplete
- onFadeToComplete
- onGrowToComplete
Trigger
- onEnter
- onStay
- onLeave
SpriteBase
- onAnimationEnd
Scene
- onSceneCollision
- onCollision
- onSceneEndCollision
- onEndCollision
- onSceneUpdate
- onSceneRender
- onAddToScene
- onRemoveFromScene
- onSafeDelete
BehaviorComponent
- onBehaviorAdd
- onBehaviorRemove
- onBehaviorMissing
SimComponent
- onComponentAdd
- onComponentRemove
SceneWindow
- onExtentChange
GuiButtonBaseCtrl
- onMouseEnter
- onMouseLeave
- onMouseUp
- onRightClick
- onClick
GuiCheckBoxCtrl
- onClick
GuiSceneObjectCtrl
- onDoubleClick
- onMouseEnter
- onMouseLeave
- onMouseDragged
GuiAutoScrollCtrl
- onTick
GuiFormCtrl
- onResize
GuiRolloutCtrl
- onCollapsed
- onExpanded
GuiScrollCtrl
- onScroll
GuiTabBookCtrl
- onTabSelected
GuiDebugger
- DbgSetCursorWatch
- onRemoveBreakPoint
- onSetBreakPoint
- onSetWatch
GuiEditCtrl
- onClearSelected
- onAddSelected
- onAddNewCtrl
- onPreEdit
- onPostEdit
- onSelect
- onSelectionParentChange
- onPreSelectionNudged
- onPostDelectionNudged
- onSelectionMoved
- onTrashSelection
- onAddNewCtrlSet
- onDelete
- onControlInspectPreApply
- onControlInspectPostApply
GuiMenuBar
- onMouseInMenu
- onMenuSelect
- onMenuItemSelect
- onSubmenuSelect
GuiArrayCtrl
- onSelect
- onRightMouseDown
GuiCanvas
- onWake
GuiColorPicker
- onMouseDown
- onMouseDragged
- onMouseMove
- onMouseEnter
- onMouseLeave
- onMouseUp
GuiControl
- onWake
- onSleep
- onAction
- onDialogPush
- onDialogPop
GuiInputCtrl
- onInputEvent
GuiListBoxCtrl
- onUnSelect
- onSelect
- onMouseDragged
- onDoubleClick
GuiMessageVectorCtrl
- urlClickCallback
GuiMLTextCtrl
- onResize
- onURL
GuiPopUpCtrl
- onSelect
- onCancel
GuiPopUpCtrlEx
- onSelect
- onHotTrackItem
- onCancel
GuiScriptNotifyCtrl
- onChildAdded
- onChildRemoved
- onResize
- onChildResized
- onParentResized
- onLoseFirstResponder
- onGainFirstResponder
GuiSliderCtrl
- onMouseDragged
GuiTextEditCtrl
- onMouseDown
- onMouseDragged
- onMouseUp
- onTabComplete
- onValidate
- onReturn
- onLoseFirstResponder
GuiTextListCtrl
- onSelect
- onDeleteKey
GuiTreeViewCtrl
- onDeleteObject
- onWake
- onDefineIcons
- onInstantGroupSelected
- onRemoveSelection
- onAddSelection
- onInspect
- onUnSelect
- onDeleteSelection
- onObjectDeleteCompleted
- onKeyDown
- onClearSelection
- onRightMouseDown
ModuleManager
- onModuleRegister
- onModulePreLoad
- onModulePostLoad
- onModulePreUnload
- onModulePostUnload
PopupMenu
- onMessageReceived
GameCenter
- onAdd
- onRemove
- gameCenterAuthenticationChanged
iOSPlatform
- onExecuteDone
iOSStream
- oniOSStreamEnd
main
- oniOSResignActive
- oniOSBecomeActive
- oniOSWillTerminate
- onExit
- oniOSOrientationToLandscapeLeft
- oniOSOrientationToLandscapeRight
- oniOSOrientationToPortrait
- oniOSOrientationToPortraitUpsideDown
WinWindow
- onDropBegin
- onDropFile
- onDropEnd
- onClosePressed
- onWindowFocusChange
GameConnection
- onConnectionTimeout
- onConnectionAccepted
- onConnectRequestTimedOut
- onConnectionDropped
- onConnectRequestRejected
- onConnectionError
- onDrop
- setLagIcon
NetDownload
- onFileChunkReceived
NetGhost
- onGhostAlwaysObjectReceived
- onGhostAlwaysStarted
ServerQuery
- onServerQueryStatus
- onClearGameTypes
- onAddGameType
- onClearMissionTypes
- onAddMissionType
TcpObject
- onConnectRequest
- onLine
- onDNSResolved
- onDNSFailed
- onConnected
- onConnectFailed
- onDisconnect
UndoManager
- onClear
- onRemoveUndo
- onUndo
- onRedo
- onAddUndo
ScriptMsgListener
- onMessageReceived
- onMessageObjectReceived
- onAddToQueue
- onRemoveFromQueue