# API Summary

### :mag:Use Ctrl + F to search the API you want and click the title for details!

## ═════════════════════

## 🕹️ ScriptApp&#x20;

## ═════════════════════

## ♻️ Lifecycle

### [onInit](https://docs.zep.us/zep-script/scriptapp/lifecycle#oninit)

{% hint style="info" %}
&#x20;App.onInit.Add(function(){})
{% endhint %}

This function is called once when running the app for the first time.

### [onJoinPlayer](https://docs.zep.us/zep-script/scriptapp/lifecycle#onjoinplayer)

{% hint style="info" %}
App.onJoinPlayer.Add(function(player){})
{% endhint %}

Once onInit is called, this event lets all connected players enter and then operates whenever a new player enters afterward.

### [onStart](https://docs.zep.us/zep-script/scriptapp/lifecycle#onstart)

{% hint style="info" %}
App.onStart.Add(function(){})
{% endhint %}

This function is called once after players have entered via onJoinPlayer.

### [onUpdate](https://docs.zep.us/zep-script/scriptapp/lifecycle#onupdate)

{% hint style="info" %}
App.onUpdate.Add(function(dt){})
{% endhint %}

This function runs periodically about every 20ms.

### [onLeavePlayer](https://docs.zep.us/zep-script/scriptapp/lifecycle#onleaveplayer)

{% hint style="info" %}
&#x20;App.onLeavePlayer.Add(function(player){})
{% endhint %}

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.

### [onDestroy](https://docs.zep.us/zep-script/scriptapp/lifecycle#ondestroy)

{% hint style="info" %}
App.onDestroy.Add(function(){})
{% endhint %}

It operates when another app is launched or the installed Game Block is destroyed.

## 🗃️ Field

### [spaceHashID & mapHashID](https://docs.zep.us/zep-script/zep-script-api/broken-reference)

{% hint style="info" %}
App.spaceHashID: String \
App.mapHashID: String
{% endhint %}

This calls spaceHashID and mapHashID of the Space where an app is installed. ([<mark style="color:purple;">Understanding Spaces and Maps</mark>](https://docs.zep.us/zep-script/zep-script-guide/appendix/understanding-spaces-and-maps))

### [creatorID](https://docs.zep.us/zep-script/scriptapp/field#creatorid)

{% hint style="info" %}
App.creatorID
{% endhint %}

This calls the ID value of the player who executed the app.

### [players](https://docs.zep.us/zep-script/scriptapp/field#players)

{% hint style="info" %}
App.players: ScriptPlayer\[]
{% endhint %}

This calls a list of all players on the map as an array.

### [playerCount](https://docs.zep.us/zep-script/scriptapp/field#playercount)

{% hint style="info" %}
App.playerCount: Number
{% endhint %}

This calls the number of all players on the map where the app is installed.

### [cameraEffect & cameraEffectParam1](https://docs.zep.us/zep-script/scriptapp/field#cameraeffect-and-cameraeffectparam1)

{% hint style="info" %}
App.cameraEffect: NONE = 0, SPOTLIGHT = 1 \
App.cameraEffectParam1: Number
{% endhint %}

App.cameraEffect: variable value to set the type of camera effect

App.cameraEffectParam1: range value of camera effect

### [displayRatio](https://docs.zep.us/zep-script/scriptapp/field#displayratio)

{% hint style="info" %}
App.displayRatio
{% endhint %}

Value to control display zooming (Default value: 1)

### [storage](https://docs.zep.us/zep-script/zep-script-api/broken-reference)

{% hint style="info" %}
App.storage: String
{% endhint %}

App value storage space in the Space (Limited to Space)

### [followPlayer](https://docs.zep.us/zep-script/scriptapp/field#followplayer)

{% hint style="info" %}
&#x20;App.followPlayer: Boolean
{% endhint %}

This shows whether the app’s follow function is enabled. (Default value: false)

### [showName](https://docs.zep.us/zep-script/zep-script-api/broken-reference)

{% hint style="info" %}
&#x20;App.showName: Boolean
{% endhint %}

This shows whether the player's nickname is hidden. (Default value: true)

## 🛰️ EventListeners

### [onSay](https://docs.zep.us/zep-script/scriptapp/event-listeners#onsay)

{% hint style="info" %}
App.onSay.Add(function(player, text){});
{% endhint %}

This function operates when a player enters chat.

### [onPlayerTouched](https://docs.zep.us/zep-script/scriptapp/event-listeners#onplayertouched)

{% hint style="info" %}
App.onPlayerTouched.Add(function(sender, target, x, y){});
{% endhint %}

This function operates when an avatar collides with another avatar.

### [onObjectTouched](https://docs.zep.us/zep-script/scriptapp/event-listeners#onobjecttouched)

{% hint style="info" %}
App.onObjectTouched.Add(function(sender, x, y){});
{% endhint %}

This function operates when an avatar collides with an object.

### [onAppObjectTouched](https://docs.zep.us/zep-script/scriptapp/event-listeners#onappobjecttouched)

{% hint style="info" %}
App.onAppObjectTouched.Add(function(key, sender, x, y){});
{% endhint %}

️This function operates when an avatar collides with an object with a key value.

### [onUnitAttacked](https://docs.zep.us/zep-script/scriptapp/event-listeners#onunitattacked)

{% hint style="info" %}
App.onUnitAttacked.Add(function(sender, x, y, target){});
{% endhint %}

This function operates when a player attacks another avatar with Z.

### [onObjectAttacked](https://docs.zep.us/zep-script/scriptapp/event-listeners#onobjectattacked)

{% hint style="info" %}
App.onObjectAttacked.Add(function(sender, x, y){});
{% endhint %}

This function operates when a player attacks an object with the Z key.

### [onSidebarTouched](https://docs.zep.us/zep-script/scriptapp/event-listeners#onsidebartouched)

{% hint style="info" %}
App.onSidebarTouched.Add(function(player){});
{% endhint %}

This function operates when a player touches the Sidebar app.

### [onTriggerObject](https://docs.zep.us/zep-script/scriptapp/event-listeners#ontriggerobject)

{% hint style="info" %}
App.onTriggerObject.Add(function(player, layerID, x, y, key){});
{% endhint %}

This function that when an avatar interacts with an object with the F key.

### [onAppObjectAttacked](#onappobjectattacked)

{% hint style="info" %}

```
App.onAppObjectAttacked.Add(function (sender, x, y, layer, key) {});
```

{% endhint %}

This function operates when an avatar attacks an object with a key value with the Z key.

## ☎️ Callbacks

### [runLater](https://docs.zep.us/zep-script/scriptapp/callbacks#runlater)

{% hint style="info" %}
App.runLater(function(){}, time: number);
{% endhint %}

This executes a callback function after a period of time (in seconds).

### [addOnTileTouched](https://docs.zep.us/zep-script/scriptapp/callbacks#addontiletouched)

{% hint style="info" %}
App.addOnTileTouched(x: integer, y: integer, function(player){})
{% endhint %}

This executes a callback function when a player gets to the designated X and Y coordinates.

### [addOnLocationTouched](https://docs.zep.us/zep-script/scriptapp/callbacks#addonlocationtouched)

{% hint style="info" %}
App.addOnLocationTouched(name: string, function(player){})
{% endhint %}

This executes a callback function when a player gets to the designated area specified by the Map Editor.

### [addOnKeyDown](https://docs.zep.us/zep-script/scriptapp/callbacks#addonkeydown)

{% hint style="info" %}
App.addOnKeyDown(keycode : number, function(player){});
{% endhint %}

This executes a callback when a player presses the specified key.

### [setTimeout](https://docs.zep.us/zep-script/scriptapp/callbacks#settimeout)

{% hint style="info" %}
setTimeout(function(){}, time: number);
{% endhint %}

This executes a callback after time (ms).

### [setInterval](https://docs.zep.us/zep-script/scriptapp/callbacks#setinterval)

{% hint style="info" %}
setInterval(function(){}, time: number);
{% endhint %}

This executes a callback at a specified time interval (ms).

### [addMobileButton](https://docs.zep.us/zep-script/scriptapp/callbacks#addmobilebutton)

{% hint style="info" %}
App.addMobileButton( anchor: number, posX: number, posY: number, function(player){} )
{% endhint %}

This executes by pressing a custom button added in the mobile environment.

### [putMobilePunch](https://docs.zep.us/zep-script/scriptapp/callbacks#putmobilepunch)

{% hint style="info" %}
App.putMobilePunch(enable: boolean = true)
{% endhint %}

This adds a punch button in the mobile environment when "enable" is "true."

### [putMobilePunchWithIcon](#putmobilepunchwithicon)

{% hint style="info" %}
App.putMobilePunchWithIcon(icon: ScriptDynamicResource)
{% endhint %}

This function adds a punch button using a image loaded.

## 💠 Methods

### [loadSpritesheet](https://docs.zep.us/zep-script/scriptapp/methods#loadspritesheet)

{% hint style="info" %}
App.loadSpritesheet(fileName: string, frameWidth: integer, frameHeight: integer, anims: array, frameRate: integer): ScriptDynamicResource
{% endhint %}

This function reads a sprite sheet picture file and makes it an object.

### [showCenterLabel](https://docs.zep.us/zep-script/scriptapp/methods#showcenterlabel)

{% hint style="info" %}
App.showCenterLabel(text: string, color: uint = 0xFFFFFF, bgColor: uint = 0x000000, offset: number = 0, time: number = 3000)
{% endhint %}

This function displays text for 3 seconds at the designated location for all players.

### [showCustomLabel](https://docs.zep.us/zep-script/scriptapp/methods#showcustomlabel)

{% hint style="info" %}
App.showCustomLabel(text: string, color: number = 0xFFFFFF, bgColor: number = 0x000000, offset: number = 0, width = 100, opacity = 0.6, time: number = 3000);
{% endhint %}

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.

### [sayToAll](https://docs.zep.us/zep-script/scriptapp/methods#saytoall)

{% hint style="info" %}
&#x20;App.sayToAll(text: string, color: uint = 0xFFFFFF)
{% endhint %}

This function displays text in the chat window.

### [showWidget](https://docs.zep.us/zep-script/scriptapp/methods#showwidget)

{% hint style="info" %}
&#x20;App.showWidget(fileName: string, align: string, width: integer, height: integer): ScriptWidget
{% endhint %}

This function loads the HTML file as a widget at the align position specified for all players.

### [showBuyAlert](#showbuyalert)

{% hint style="info" %}
player.showBuyAlert(itemName: string, price: number, callback: function)
{% endhint %}

This function displays a purchase widget to a player and executes a callback function that runs when a purchase is completed.

### [hideBuyAlert](#hidebuyalert)

{% hint style="info" %}
player.hideBuyAlert()
{% endhint %}

This function closes a player's purchase widget.

### [showYoutubeWidget](https://docs.zep.us/zep-script/scriptapp/methods#showyoutubewidget)

{% hint style="info" %}
App.showYoutubeWidget(link: string, align: string, width: integer, height: integer): ScriptWidget
{% endhint %}

This function calls the YouTube video corresponding to the link to the widget.

### [spawnPlayer](https://docs.zep.us/zep-script/scriptapp/methods#spawnplayer)

{% hint style="info" %}
App.spawnPlayer(playerID: string, tileX: integer, tileY: integer)
{% endhint %}

This function moves the player corresponding to playerID to tileX and tileY coordinates.

### [kickPlayer](https://docs.zep.us/zep-script/scriptapp/methods#kickplayer)

{% hint style="info" %}
App.kickPlayer(playerID: string)
{% endhint %}

This function kicks the player corresponding to playerID.

### [forceDestroy](https://docs.zep.us/zep-script/scriptapp/methods#forcedestroy)

{% hint style="info" %}
App.forceDestroy();
{% endhint %}

This function shuts down the mini-game app.

### [clearChat](https://docs.zep.us/zep-script/scriptapp/methods#clearchat)

{% hint style="info" %}
App.clearChat();
{% endhint %}

This function deletes all chat history.

### [getPlayerByID](#getplayerbyid)

{% hint style="info" %}
App.getPlayerByID(playerID: string);
{% endhint %}

This function returns a player corresponding to the id.

### [playSound](https://docs.zep.us/zep-script/scriptapp/methods#playsound)

{% hint style="info" %}
App.playSound(fileName: string, loop: boolean = false, overlap: boolean = false)
{% endhint %}

This function plays the sound file to all players.

### [playSoundLink](https://docs.zep.us/zep-script/scriptapp/methods#playsoundlink)

{% hint style="info" %}
App.playSoundLink(link: string, loop: boolean = false)
{% endhint %}

This function plays the sound corresponding to the link to all players.

### [stopSound](https://docs.zep.us/zep-script/scriptapp/methods#stopsound)

{% hint style="info" %}
App.stopSound();
{% endhint %}

This function stops all playing sounds.

### [changeAttackSound](#changeattacksound)

{% hint style="info" %}
App.changeAttackSound(fileName:string)
{% endhint %}

This function changes the poke (Z key) sound effects.

### [httpGet](https://docs.zep.us/zep-script/scriptapp/methods#httpget)

{% hint style="info" %}
App.httpGet(url: string, headers: object, function(res: string){})
{% endhint %}

This function calls for HTTP Get request.

### [httpPost](https://docs.zep.us/zep-script/scriptapp/methods#httppost)

{% hint style="info" %}
App.httpPost(url: string, headers: object, body: object, function(res: string))
{% endhint %}

This function calls for HTTP Post request.

### [httpPostJson](https://docs.zep.us/zep-script/scriptapp/methods#httppostjson)

{% hint style="info" %}
App.httpPostJson(url: string, headers: object, body: object, function(res: string))
{% endhint %}

This function calls for HTTP Post request in JSON.

### [sendUpdated](https://docs.zep.us/zep-script/scriptapp/methods#sendupdated)

{% hint style="info" %}
App.sendUpdated()
{% endhint %}

This function applies the updated app-related field values when changes are made.

### [save](https://docs.zep.us/zep-script/scriptapp/methods#save)

{% hint style="info" %}
App.save()
{% endhint %}

This function applies the updated app storage values when changes are made.

## ═════════════════════

## 🗺️ ScriptMap&#x20;

## ═════════════════════

## 🗃️ Field

### [width & height](https://docs.zep.us/zep-script/scriptmap/field#width-and-height)

{% hint style="info" %}
Map.width : Number Map.height : Number
{% endhint %}

Calls the map’s width and height values.

## 💠 Methods

### [putTileEffect](https://docs.zep.us/zep-script/scriptmap/methods#puttileeffect)

{% hint style="info" %}
Map.putTileEffect(x: number, y: number, tileID: TileEffectType)
{% endhint %}

This function applies a tile effect to the specified coordinates.

### [putObject](https://docs.zep.us/zep-script/scriptmap/methods#putobject)

{% hint style="info" %}
Map.putObject(x: number, y: number, dynamicResource: ScriptDynamicResource, option: JsValue)
{% endhint %}

This function places the object at the specified coordinates. (Reference coordinates: Left-Top) → What are [**Reference Coordinates?**](https://docs.zep.us/zep-script/zep-script-api/broken-reference)

### [putObjectMultiple](#putobjectmultiple)

{% hint style="info" %}
Map.putObjectMultiple(tileArray: array, type: PutObjectType, dynamicResource: ScriptDynamicResource, option: object);
{% endhint %}

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.

### [putObjectWithKey](https://docs.zep.us/zep-script/scriptmap/methods#putobjectwithkey)

{% hint style="info" %}
Map.putObjectWithKey(x: number, y: number, dynamicResource: ScriptDynamicResource, option: JsValue)
{% endhint %}

This function places an object on the specified coordinates (Reference coordinates: Left-Top)

### [getObjectWithKey](https://docs.zep.us/zep-script/scriptmap/methods#getobjectwithkey)

{% hint style="info" %}
Map.getObjectWithKey(key: String)
{% endhint %}

This function gets the information of the object with the corresponding key value.

### [playObjectAnimation](https://docs.zep.us/zep-script/scriptmap/methods#playobjectanimation)

{% hint style="info" %}
Map.playObjectAnimation(x: number, y: number, name: string)
{% endhint %}

This function activates the object animation at the corresponding coordinates.

The above function must be preceded by the **Map.putObject** function.

### [playObjectAnimationWithKey](https://docs.zep.us/zep-script/scriptmap/methods#playobjectanimationwithkey)

{% hint style="info" %}
Map.playObjectAnimation(key: string, animName: string, repeatCount: number)
{% endhint %}

This function executes the object's sprite animation whose key value matches.

### [moveObject](https://docs.zep.us/zep-script/scriptmap/methods#moveobject)

{% hint style="info" %}
Map.moveObject(x: number, y: number, targetX: number, targetY: number, time: number)
{% endhint %}

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.

### [moveObjectWithKey](https://docs.zep.us/zep-script/scriptmap/methods#moveobjectwithkey)

{% hint style="info" %}
Map.moveObjectWithKey(key: string, targetX: number, targetY: number, path:boolean = true)
{% endhint %}

This function moves an object with a key value to the specified coordinates.

### [clearAllObjects()](https://docs.zep.us/zep-script/scriptmap/methods#clearallobjects)

{% hint style="info" %}
Map.clearAllObjects()
{% endhint %}

This function removes all objects created by the ZEP script.

### [getTile](#gettile)

{% hint style="info" %}
Map.getTile(layer: number, x: number, y: number)
{% endhint %}

This returns the type value of the tile at the x and y coordinates of the corresponding layer. If no tile, this returns "-1."

### [hasLocation](https://docs.zep.us/zep-script/scriptmap/methods#haslocation)

{% hint style="info" %}
Map.hasLocation(locationName: String)
{% endhint %}

This function checks if the corresponding location exists in the map and returns true or false accordingly.

### [getObjectsByType](https://docs.zep.us/zep-script/scriptmap/methods#getobjectsbytype)

{% hint style="info" %}
Map.getObjectsByType(type: numer) : array
{% endhint %}

&#x20;This function returns the objects that correspond to Type.

### [getTopObjectsByType](https://docs.zep.us/zep-script/scriptmap/methods#gettopobjectsbytype)

{% hint style="info" %}
Map.getTopObjectsByType(type: numer) : array
{% endhint %}

&#x20;This function returns the top objects that correspond to each type.

### [sayObjectWithKey](#sayobjectwithkey)

{% hint style="info" %}
Map.sayObjectWithKey( key: string, message: string )
{% endhint %}

This function displays a word balloon above an object with a key value.

## ═════════════════════

## 👥 ScriptPlayer&#x20;

## ═════════════════════

## 🗃️ Field

### [id , name](https://docs.zep.us/zep-script/scriptplayer/field#id-name)

{% hint style="info" %}
player.id : Number player.name : String
{% endhint %}

This calls the player ID and nickname values.

### [title](https://docs.zep.us/zep-script/scriptplayer/field#title)

{% hint style="info" %}
player.title : String
{% endhint %}

Title is a yellow text that displays above the avatar’s nickname.

### [role](https://docs.zep.us/zep-script/scriptplayer/field#role)

{% hint style="info" %}
player.role : Number
{% endhint %}

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 |

### [tileX, tileY](https://docs.zep.us/zep-script/scriptplayer/field#tilex-tiley)

{% hint style="info" %}
&#x20;player.tileX: Number player.tileY: Number
{% endhint %}

The x axis value and y axis value of where the player’s avatar is standing.

### [dir](https://docs.zep.us/zep-script/scriptplayer/field#dir)

{% hint style="info" %}
player.dir : Number
{% endhint %}

The direction the player’s avatar is looking.&#x20;

The following values are displayed depending on the direction the avatar is looking.

| Direction | Number | Direction    | Number |
| --------- | ------ | ------------ | ------ |
| Left      | 1      | Top-Left     | 5      |
| Up        | 2      | Bottom-Left  | 6      |
| Right     | 3      | Top-Right    | 7      |
| Down      | 4      | Bottom-Right | 8      |

### [moveSpeed](https://docs.zep.us/zep-script/scriptplayer/field#movespeed)

{% hint style="info" %}
player.moveSpeed : Number
{% endhint %}

This is the player’s movement speed value. (Default value: 80)

### [sprite](https://docs.zep.us/zep-script/scriptplayer/field#sprite)

{% hint style="info" %}
player.sprite : ScriptDynamicResource
{% endhint %}

A sprite image of the player’s avatar. (Resets to the default avatar image when inputting **null**)

### [tag](https://docs.zep.us/zep-script/scriptplayer/field#tag)

{% hint style="info" %}
&#x20;player.tag: Any
{% endhint %}

Give necessary attribute values to a player by using tag.

### [hidden](https://docs.zep.us/zep-script/scriptplayer/field#hidden)

{% hint style="info" %}
player.hidden: Boolean
{% endhint %}

If the hidden attribute value is true, the corresponding player is not visible to other players.

### [spotlight](https://docs.zep.us/zep-script/scriptplayer/field#spotlight)

{% hint style="info" %}
player.spotlight: Boolean
{% endhint %}

This activates or deactivates the player’s spotlight feature.

### [disableVideo, disableAudio](https://docs.zep.us/zep-script/scriptplayer/field#disablevideo-disableaudio)

{% hint style="info" %}
player.disableVideo : Boolean \
player.disableAudio : Boolean
{% endhint %}

This activates or deactivates the player’s video/audio features.&#x20;

### [attackType](https://docs.zep.us/zep-script/scriptplayer/field#attacktype)

{% hint style="info" %}
player.attackType : Number
{% endhint %}

This is a player’s attack type performed by pressing z. (Default value: 0)

### [attackParam1](https://docs.zep.us/zep-script/scriptplayer/field#attackparam1)

{% hint style="info" %}
player.attackParam1: Number
{% endhint %}

This is an attribute for the attack image’s distance range shown when pressing z. The attack’s possible distance range does not increase.

### [attackParam2](https://docs.zep.us/zep-script/scriptplayer/field#attackparam2)

{% hint style="info" %}
player.attackParam2: Number
{% endhint %}

This is an attribute for distance available for attack. This is only valid when attackType is set to a ranged attack.

### [attackSprite](https://docs.zep.us/zep-script/scriptplayer/field#attacksprite)

{% hint style="info" %}
player.attackSprite : ScriptDynamicResource
{% endhint %}

This is an attribute for the attack image shown when pressing z.

### [walletAddress](https://docs.zep.us/zep-script/scriptplayer/field#walletaddress)

{% hint style="info" %}
player.walletAddress : String
{% endhint %}

This is the player’s wallet address.

### [storage](https://docs.zep.us/zep-script/scriptplayer/field#storage)

{% hint style="info" %}
player.storage : String
{% endhint %}

This is the storage space for the player value within the space. (Limited to the Space)

### [isMobile](https://docs.zep.us/zep-script/scriptplayer/field#ismobile)

{% hint style="info" %}
&#x20;player.isMobile : Boolean
{% endhint %}

This displays whether the player is connected via mobile in true or false.

### [isMoving](https://docs.zep.us/zep-script/scriptplayer/field#ismoving)

{% hint style="info" %}
player.isMoving : Boolean
{% endhint %}

If the player is moving, this function returns True. If not, this returns False.

### [isJumping](https://docs.zep.us/zep-script/scriptplayer/field#isjumping)

{% hint style="info" %}
player.isJumping : Boolean
{% endhint %}

If the player is jumping, this function returns True. If not, this returns False.

### [customData](https://docs.zep.us/zep-script/scriptplayer/field#customdata)

{% hint style="info" %}
&#x20;player.customData : String
{% endhint %}

This field saves the value received as a query string. [how-to-use-url-query-strings](https://docs.zep.us/zep-script/zep-script-guide/appendix/how-to-use-url-query-strings "mention")

### [displayRatio](https://docs.zep.us/zep-script/scriptplayer/field#displayratio)

{% hint style="info" %}
player.displayRatio: number
{% endhint %}

This function zooms the player's display in or out. (Default Value: 1)

### [titleColor](https://docs.zep.us/zep-script/scriptplayer/field#titlecolor)

{% hint style="info" %}
player.titleColor: number
{% endhint %}

This function can read and change the player title's color.

### [emailHash](https://docs.zep.us/zep-script/scriptplayer/field#emailhash)

{% hint style="info" %}
player.emailHash
{% endhint %}

This function reads the hash value of the player's email.

### [isGuest](https://docs.zep.us/zep-script/scriptplayer/field#isguest)

{% hint style="info" %}
player.isGuest
{% endhint %}

If the player is not signed in, this function returns True.

## 💠 Methods

### [showCenterLabel](https://docs.zep.us/zep-script/zep-script-api/broken-reference)

{% hint style="info" %}
&#x20;player.showCenterLabel(text: string, color: uint = 0xFFFFFF, bgColor: uint = 0x000000, offset: number = 0, time: number = 3000)
{% endhint %}

This function displays text for 3 seconds at a designated location to the corresponding player.

### [showCustomLabel](https://docs.zep.us/zep-script/zep-script-api/broken-reference)

{% hint style="info" %}
player.showCustomLabel(text: string, color: number = 0xFFFFFF, bgColor: number = 0x000000, offset: number = 0, width = 100, opacity = 0.6, time: number = 3000);
{% endhint %}

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.

### [showWidget](https://docs.zep.us/zep-script/zep-script-api/broken-reference)

{% hint style="info" %}
player.showWidget(fileName: string, align: string, width: integer, height: integer): ScriptWidget
{% endhint %}

This function calls the html file as a widget to the player’s designated align location.

### [showBuyAlert](https://docs.zep.us/zep-script/scriptplayer/methods#showbuyalert)

{% hint style="info" %}
player.showBuyAlert(itemName: string, price: number, callback: function)
{% endhint %}

This function displays a purchase widget to a player and executes a callback function that runs when a purchase is completed.

### [sendMessage](#sendmessage)

{% hint style="info" %}
&#x20;player.sendMessage(text: string, color: uint = 0xFFFFFF)
{% endhint %}

This function sends a private message to a player in the chat window.

### [showPrompt](https://docs.zep.us/zep-script/scriptplayer/methods#showprompt)

{% hint style="info" %}
player.showPrompt(text: string, function(inputText))
{% endhint %}

This function displays an input window and executes a callback function that runs according to a player's response.

### [showConfirm](https://docs.zep.us/zep-script/scriptplayer/methods#showconfirm)

{% hint style="info" %}
player.showConfirm(text: string, function(result))
{% endhint %}

&#x20;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.

### [showAlert](https://docs.zep.us/zep-script/scriptplayer/methods#showalert)

{% hint style="info" %}
&#x20;player.showAlert(text: string, function())
{% endhint %}

This function displays an alert window and executes a callback function that runs when a player clicks "OK".

### [showWidgetResponsive](https://docs.zep.us/zep-script/scriptplayer/methods#showwidgetresponsive)

{% hint style="info" %}

```
player.showWidgetResponsive(fileName:string, marginTop:number, marginRight:number, marginBottom:number, marginLeft:number)
```

{% endhint %}

This function displays the widget by defining the top/bottom/left/right margin using a responsive percentage of the screen size.

### [showEmbed](#showembed)

{% hint style="info" %}
player.showEmbed(url: string, align: string, width: number, height: number, hasBackdrop: boolean = true)
{% endhint %}

This function opens a web URL as an embed in the designated location.

### [openWebLink](#openweblink)

{% hint style="info" %}

```
player.openWebLink(url:string, popup:boolean=false)
```

{% endhint %}

This function opens a web URL in a new tab or window to a player.

### [isEmail](https://docs.zep.us/zep-script/zep-script-api/broken-reference)

{% hint style="info" %}
player.isEmail(email: string): boolean
{% endhint %}

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.

### [getLocationName](https://docs.zep.us/zep-script/zep-script-api/broken-reference)

{% hint style="info" %}
player.getLocationName : string
{% endhint %}

This displays the location name of where the player is standing.

### [spawnAt](https://docs.zep.us/zep-script/zep-script-api/broken-reference)

{% hint style="info" %}
player.spawnAt(tileX: int ,tileY: int, dir: int = 0)
{% endhint %}

This moves the player’s avatar to look in the designated direction when on tileX and tileY coordinates.

### [spawnAtLocation](https://docs.zep.us/zep-script/zep-script-api/broken-reference)

{% hint style="info" %}
player.spawnAtLocation(name: string, dir:int = 0)
{% endhint %}

This moves the player’s avatar to a specific area called name and makes them look in a designated direction.

### [spawnAtMap](https://docs.zep.us/zep-script/zep-script-api/broken-reference)

{% hint style="info" %}
player.spawnAtMap(spaceHashID string, mapHashID:string = null)
{% endhint %}

This moves the player to the corresponding Space’s map.

### [playSound](https://docs.zep.us/zep-script/zep-script-api/broken-reference)

{% hint style="info" %}
Player.playSound(fileName: string, loop: boolean = false, overlap: boolean = false)
{% endhint %}

This function plays sound to the corresponding player.

### [playSoundLink](https://docs.zep.us/zep-script/zep-script-api/broken-reference)

{% hint style="info" %}
player.playSoundLink(link: string, loop: boolean = false)
{% endhint %}

This function plays sound for all players.

### [sendUpdated](https://docs.zep.us/zep-script/zep-script-api/broken-reference)

{% hint style="info" %}
&#x20;player.sendUpdated()
{% endhint %}

This function applies the changed value whenever field values pertaining to App or Player are changed.

### [save](https://docs.zep.us/zep-script/zep-script-api/broken-reference)

{% hint style="info" %}
player.save()
{% endhint %}

This function applies the changed value whenever values pertaining to App or Player storage are changed.

## ═════════════════════

## 🧙‍♂️ ScriptWidget&#x20;

## ═════════════════════

## 🗃️ Field

### [id](https://docs.zep.us/zep-script/zep-script-api/broken-reference)

{% hint style="info" %}
widget.id
{% endhint %}

This calls the widget’s id value.

## 🛰️ EventListeners

### [onMessage](https://docs.zep.us/zep-script/zep-script-api/broken-reference)

{% hint style="info" %}
widget.onMessage.Add(function(player, data: any){});
{% endhint %}

Callback function that activates when a message is sent from the widget to the App.

## 💠 Methods

### [sendMessage](https://docs.zep.us/zep-script/zep-script-api/broken-reference)

{% hint style="info" %}
widget.sendMessage(object: any)
{% endhint %}

This sends data to the widget from the App.

### [destroy](https://docs.zep.us/zep-script/zep-script-api/broken-reference)

{% hint style="info" %}
widget.destroy()
{% endhint %}

This function closes the widget.
