Event Listeners
Last updated
Last updated
These functions operate in response to specific situations that may happen in a ZEP Space such as players typing specified words or attacking a specific object.
Name | Description |
---|---|
Event Listeners at a Glance
App.onSay.Add(function(player, text){});
This function operates when a player enters chat.
Parameters
Example
Hangul quiz - Makes a function to guess the answer via chat:
App.onPlayerTouched.Add(function(sender, target, x, y){});
This function operates when an avatar collides with another avatar.
Parameters
Example
Display a message when two avatars collide.
App.onObjectTouched.Add(function(sender, x, y){});
This function operates when an avatar collides with an object.
Parameters
Example
Label display
โญ A collision with an object without the overlap: true
attribute cannot call this function.
App.onAppObjectTouched.Add(function(key, sender, x, y){});
๏ธThis function operates when an avatar collides with an object with a key value.
Parameters
Example
Label display
โญ A collision with an object without the overlap: true
attribute cannot call this function.
App.onUnitAttacked.Add(function(sender, x, y, target){});
This function operates when an avatar attacks another avatar with Z.
Parameters
Example
Display a message when a player attacks another player.
App.onObjectAttacked.Add(function(sender, x, y){});
This function operates when an avatar attacks an object with the Z key.
Parameters
Example
Display a message when an avatar attacks an object.
โญ An attack on an object without the overlap: true
attribute cannot execute the function.
App.onSidebarTouched.Add(function(player){});
This function operates when a player touches the Sidebar app.
Parameters
Example
Display a message on touching the Sidebar app.
Related Tutorial
App.onTriggerObject.Add(function(player, layerID, x, y){});
This function that when an avatar interacts with an object with the F key.
Parameters
Example
Display a message on interacting with the object.
This function operates when an avatar attacks an object with a key value with the Z key.
Reference: Object npcProperty
Parameters
Example
Display a message on attacking an object with a key value.
โญ Attacking an object without the collide: true
property does not execute the function.
Reference
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
onSay
Function that operates when a player types chat
onPlayerTouched
Function that operates when avatars collide with each other
onObjectTouched
Function that operates when an avatar collides with an object
onAppObjectTouched
Function that operates when an avatar collides with an object with a key value
onUnitAttacked
Function that operates when an avatar attacks another avatar with the Z key
onObjectAttacked
Function that operates when an avatar attacks an object with the Z key
onSidebarTouched
Function that operates when a player touches the Sidebar app
onTriggerObject
Function that operates when an avatar interacts with an object with the F key
onAppObjectAttacked
Function that operates when an avatar attacks an object with a key value with the Z key
player
Player
The playerโs parameter refers to the player who enters chat. The playerโs parameter names can be changed arbitrarily.
text
String
Text refers to the entered chat content. The textโs parameter names can be changed arbitrarily.
sender
Player
The player who collides
target
String
The player who is the object of the collision
x, y
Number
The X and Y coordinate of the location where the collision occurs
The parameter name of sender, target, X, and Y can be changed arbitrarily
sender
Player
The player who collides with the object
x, y
Number
The X and Y coordinate of the location where the collision occurs
tileID
Number
The tile ID of the object
obj
Object
Object
key
String
The key value of the object
sender
Player
The player who collides with the object
x, y
Number
The X and Y coordinate of the location where the collision occurs
sender
Player
The player who attacks
x, y
Number
The X and Y coordinate of the location of the player who attacks
target
Player
The player who is under attack
The parameter name of sender, target, x, and y can be changed arbitrarily
sender
Player
The player who attacks
x, y
Number
The X and Y coordinate of the location of the object
The parameter name of sender, x, and y can be changed arbitrarily.
player
Player
The player who touches the Sidebar app
player
Player
The player who interacts with the object
layerID
Number
The ID of the layer where the object is installed Object: layerID = 3 Top object: layerID = 5
x, y
Number
The X and Y coordinate of the location of the object
sender
Player
The player who attacks
x, y
Number
The X and Y coordinate of the location of the object
layer
Number
The layer where the object is installed
key
String
The key value of the object