API Summary
Last updated
Last updated
App.onInit.Add(function(){})
This function is called once when running the app for the first time.
App.onJoinPlayer.Add(function(player){})
Once onInit is called, this event lets all connected players enter and then operates whenever a new player enters afterward.
App.onStart.Add(function(){})
This function is called once after players have entered via onJoinPlayer.
App.onUpdate.Add(function(dt){})
This function runs periodically about every 20ms.
App.onLeavePlayer.Add(function(player){})
This function operates whenever a player exits. After that, this function kicks all players from the app when another app is launched or the installed Game Block is destroyed.
App.onDestroy.Add(function(){})
It operates when another app is launched or the installed Game Block is destroyed.
App.spaceHashID: String App.mapHashID: String
This calls spaceHashID and mapHashID of the Space where an app is installed. (Understanding Spaces and Maps)
App.creatorID
This calls the ID value of the player who executed the app.
App.players: ScriptPlayer[]
This calls a list of all players on the map as an array.
App.playerCount: Number
This calls the number of all players on the map where the app is installed.
App.cameraEffect: NONE = 0, SPOTLIGHT = 1 App.cameraEffectParam1: Number
App.cameraEffect: variable value to set the type of camera effect
App.cameraEffectParam1: range value of camera effect
App.displayRatio
Value to control display zooming (Default value: 1)
App.storage: String
App value storage space in the Space (Limited to Space)
App.followPlayer: Boolean
This shows whether the appβs follow function is enabled. (Default value: false)
App.showName: Boolean
This shows whether the player's nickname is hidden. (Default value: true)
App.onSay.Add(function(player, text){});
This function operates when a player enters chat.
App.onPlayerTouched.Add(function(sender, target, x, y){});
This function operates when an avatar collides with another avatar.
App.onObjectTouched.Add(function(sender, x, y){});
This function operates when an avatar collides with an object.
App.onAppObjectTouched.Add(function(key, sender, x, y){});
οΈThis function operates when an avatar collides with an object with a key value.
App.onUnitAttacked.Add(function(sender, x, y, target){});
This function operates when a player attacks another avatar with Z.
App.onObjectAttacked.Add(function(sender, x, y){});
This function operates when a player attacks an object with the Z key.
App.onSidebarTouched.Add(function(player){});
This function operates when a player touches the Sidebar app.
App.onTriggerObject.Add(function(player, layerID, x, y){});
This function that when an avatar interacts with an object with the F key.
This function operates when an avatar attacks an object with a key value with the Z key.
App.runLater(function(){}, time: number);
This executes a callback function after a period of time (in seconds).
App.addOnTileTouched(x: integer, y: integer, function(player){})
This executes a callback function when a player gets to the designated X and Y coordinates.
App.addOnLocationTouched(name: string, function(player){})
This executes a callback function when a player gets to the designated area specified by the Map Editor.
App.addOnKeyDown(keycode : number, function(player){});
This executes a callback when a player presses the specified key.
setTimeout(function(){}, time: number);
This executes a callback after time (ms).
setInterval(function(){}, time: number);
This executes a callback at a specified time interval (ms).
App.addMobileButton( anchor: number, posX: number, posY: number, function(player){} )
This executes by pressing a custom button added in the mobile environment.
App.putMobilePunch(enable: boolean = true)
This adds a punch button in the mobile environment when "enable" is "true."
App.putMobilePunchWithIcon(icon: ScriptDynamicResource)
This function adds a punch button using a image loaded.
App.loadSpritesheet(fileName: string, frameWidth: integer, frameHeight: integer, anims: array, frameRate: integer): ScriptDynamicResource
This function reads a sprite sheet picture file and makes it an object.
App.showCenterLabel(text: string, color: uint = 0xFFFFFF, bgColor: uint = 0x000000, offset: number = 0, time: number = 3000)
This function displays text for 3 seconds at the designated location for all players.
App.showCustomLabel(text: string, color: number = 0xFFFFFF, bgColor: number = 0x000000, offset: number = 0, width = 100, opacity = 0.6, time: number = 3000);
This function displays text for 3 seconds at the designated location for all players.
You can decorate the text by inserting span
tags in the text part.
App.sayToAll(text: string, color: uint = 0xFFFFFF)
This function displays text in the chat window.
App.showWidget(fileName: string, align: string, width: integer, height: integer): ScriptWidget
This function loads the HTML file as a widget at the align position specified for all players.
player.showBuyAlert(itemName: string, price: number, callback: function)
This function displays a purchase widget to a player and executes a callback function that runs when a purchase is completed.
player.hideBuyAlert()
This function closes a player's purchase widget.
App.showYoutubeWidget(link: string, align: string, width: integer, height: integer): ScriptWidget
This function calls the YouTube video corresponding to the link to the widget.
App.spawnPlayer(playerID: string, tileX: integer, tileY: integer)
This function moves the player corresponding to playerID to tileX and tileY coordinates.
App.kickPlayer(playerID: string)
This function kicks the player corresponding to playerID.
App.forceDestroy();
This function shuts down the mini-game app.
App.clearChat();
This function deletes all chat history.
App.getPlayerByID(playerID: string);
This function returns a player corresponding to the id.
App.playSound(fileName: string, loop: boolean = false, overlap: boolean = false)
This function plays the sound file to all players.
App.playSoundLink(link: string, loop: boolean = false)
This function plays the sound corresponding to the link to all players.
App.stopSound();
This function stops all playing sounds.
App.changeAttackSound(fileName:string)
This function changes the poke (Z key) sound effects.
App.httpGet(url: string, headers: object, function(res: string){})
This function calls for HTTP Get request.
App.httpPost(url: string, headers: object, body: object, function(res: string))
This function calls for HTTP Post request.
App.httpPostJson(url: string, headers: object, body: object, function(res: string))
This function calls for HTTP Post request in JSON.
App.sendUpdated()
This function applies the updated app-related field values when changes are made.
App.save()
This function applies the updated app storage values when changes are made.
Map.width : Number Map.height : Number
Calls the mapβs width and height values.
Map.putTileEffect(x: number, y: number, tileID: TileEffectType)
This function applies a tile effect to the specified coordinates.
Map.putObject(x: number, y: number, dynamicResource: ScriptDynamicResource, option: JsValue)
Map.putObjectMultiple(tileArray: array, type: PutObjectType, dynamicResource: ScriptDynamicResource, option: object);
This function installs objects at once by entering coordinates to place objects in a two-dimensional array. This allows you to reduce the load when you install many objects at once.
Map.putObjectWithKey(x: number, y: number, dynamicResource: ScriptDynamicResource, option: JsValue)
This function places an object on the specified coordinates (Reference coordinates: Left-Top)
Map.getObjectWithKey(key: String)
This function gets the information of the object with the corresponding key value.
Map.playObjectAnimation(x: number, y: number, name: string)
This function activates the object animation at the corresponding coordinates.
The above function must be preceded by the Map.putObject function.
Map.playObjectAnimation(key: string, animName: string, repeatCount: number)
This function executes the object's sprite animation whose key value matches.
Map.moveObject(x: number, y: number, targetX: number, targetY: number, time: number)
This function moves the object from the objectβs x,y coordinates to the target x,y coordinates for a certain amount of time (secs).
The above function must be preceded by the Map.putObject function.
Map.moveObjectWithKey(key: string, targetX: number, targetY: number, path:boolean = true)
This function moves an object with a key value to the specified coordinates.
Map.clearAllObjects()
This function removes all objects created by the ZEP script.
Map.getTile(layer: number, x: number, y: number)
This returns the type value of the tile at the x and y coordinates of the corresponding layer. If no tile, this returns "-1."
Map.hasLocation(locationName: String)
This function checks if the corresponding location exists in the map and returns true or false accordingly.
Map.getObjectsByType(type: numer) : array
This function returns the objects that correspond to Type.
Map.getTopObjectsByType(type: numer) : array
This function returns the top objects that correspond to each type.
Map.sayObjectWithKey( key: string, message: string )
This function displays a word balloon above an object with a key value.
player.id : Number player.name : String
This calls the player ID and nickname values.
player.title : String
Title is a yellow text that displays above the avatarβs nickname.
player.role : Number
Role is the playerβs permission rolesβ number value.
The following values will be displayed depending on the playerβs role.
Guest
-1
Staff
2000
Member
0
Admin
3000
Editor
1000
Owner
3001
player.tileX: Number player.tileY: Number
The x axis value and y axis value of where the playerβs avatar is standing.
player.dir : Number
The direction the playerβs avatar is looking.
The following values are displayed depending on the direction the avatar is looking.
Left
1
Top-Left
5
Up
2
Bottom-Left
6
Right
3
Top-Right
7
Down
4
Bottom-Right
8
player.moveSpeed : Number
This is the playerβs movement speed value. (Default value: 80)
player.sprite : ScriptDynamicResource
A sprite image of the playerβs avatar. (Resets to the default avatar image when inputting null)
player.tag: Any
Give necessary attribute values to a player by using tag.
player.hidden: Boolean
If the hidden attribute value is true, the corresponding player is not visible to other players.
player.spotlight: Boolean
This activates or deactivates the playerβs spotlight feature.
player.disableVideo : Boolean player.disableAudio : Boolean
This activates or deactivates the playerβs video/audio features.
player.attackType : Number
This is a playerβs attack type performed by pressing z. (Default value: 0)
player.attackParam1: Number
This is an attribute for the attack imageβs distance range shown when pressing z. The attackβs possible distance range does not increase.
player.attackParam2: Number
This is an attribute for distance available for attack. This is only valid when attackType is set to a ranged attack.
player.attackSprite : ScriptDynamicResource
This is an attribute for the attack image shown when pressing z.
player.walletAddress : String
This is the playerβs wallet address.
player.storage : String
This is the storage space for the player value within the space. (Limited to the Space)
player.isMobile : Boolean
This displays whether the player is connected via mobile in true or false.
player.isMoving : Boolean
If the player is moving, this function returns True. If not, this returns False.
player.isJumping : Boolean
If the player is jumping, this function returns True. If not, this returns False.
player.customData : String
This field saves the value received as a query string. How to Use URL Query Strings
player.displayRatio: number
This function zooms the player's display in or out. (Default Value: 1)
player.titleColor: number
This function can read and change the player title's color.
player.emailHash
This function reads the hash value of the player's email.
player.isGuest
If the player is not signed in, this function returns True.
player.showCenterLabel(text: string, color: uint = 0xFFFFFF, bgColor: uint = 0x000000, offset: number = 0, time: number = 3000)
This function displays text for 3 seconds at a designated location to the corresponding player.
player.showCustomLabel(text: string, color: number = 0xFFFFFF, bgColor: number = 0x000000, offset: number = 0, width = 100, opacity = 0.6, time: number = 3000);
This function displays a text for 3 seconds at a specific location to all players.
You can decorate the text by adding span
tags to the text.
player.showWidget(fileName: string, align: string, width: integer, height: integer): ScriptWidget
This function calls the html file as a widget to the playerβs designated align location.
player.showBuyAlert(itemName: string, price: number, callback: function)
This function displays a purchase widget to a player and executes a callback function that runs when a purchase is completed.
player.sendMessage(text: string, color: uint = 0xFFFFFF)
This function sends a private message to a player in the chat window.
player.showPrompt(text: string, function(inputText))
This function displays an input window and executes a callback function that runs according to a player's response.
player.showConfirm(text: string, function(result))
This function displays an confirm window and executes a callback function that runs when a player clicks "OK". When a player clicks "Cancel," this callback function doesn't operate.
player.showAlert(text: string, function())
This function displays an alert window and executes a callback function that runs when a player clicks "OK".
This function displays the widget by defining the top/bottom/left/right margin using a responsive percentage of the screen size.
player.showEmbed(url: string, align: string, width: number, height: number, hasBackdrop: boolean = true)
This function opens a web URL as an embed in the designated location.
This function opens a web URL in a new tab or window to a player.
player.isEmail(email: string): boolean
Depending on whether the corresponding playerβs email is the same as the parameter value, the value will return as true when it matches and false when it does not match.
player.getLocationName : string
This displays the location name of where the player is standing.
player.spawnAt(tileX: int ,tileY: int, dir: int = 0)
This moves the playerβs avatar to look in the designated direction when on tileX and tileY coordinates.
player.spawnAtLocation(name: string, dir:int = 0)
This moves the playerβs avatar to a specific area called name and makes them look in a designated direction.
player.spawnAtMap(spaceHashID string, mapHashID:string = null)
This moves the player to the corresponding Spaceβs map.
Player.playSound(fileName: string, loop: boolean = false, overlap: boolean = false)
This function plays sound to the corresponding player.
player.playSoundLink(link: string, loop: boolean = false)
This function plays sound for all players.
player.sendUpdated()
This function applies the changed value whenever field values pertaining to App or Player are changed.
player.save()
This function applies the changed value whenever values pertaining to App or Player storage are changed.
widget.id
This calls the widgetβs id value.
widget.onMessage.Add(function(player, data: any){});
Callback function that activates when a message is sent from the widget to the App.
widget.sendMessage(object: any)
This sends data to the widget from the App.
widget.destroy()
This function closes the widget.
This function places the object at the specified coordinates. (Reference coordinates: Left-Top) β What are