# API Summary

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

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

## 🕹️ ScriptApp&#x20;

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

## ♻️ Lifecycle

### [onInit](/zep-script/zep-script-api/scriptapp/lifecycle.md#oninit)

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

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

### [onJoinPlayer](/zep-script/zep-script-api/scriptapp/lifecycle.md#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](/zep-script/zep-script-api/scriptapp/lifecycle.md#onstart)

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

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

### [onUpdate](/zep-script/zep-script-api/scriptapp/lifecycle.md#onupdate)

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

This function runs periodically about every 20ms.

### [onLeavePlayer](/zep-script/zep-script-api/scriptapp/lifecycle.md#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](/zep-script/zep-script-api/scriptapp/lifecycle.md#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](broken://pages/tDQnn0o07RdoXBHwuVWQ#spacehashid-and-maphashid)

{% 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>](/zep-script/zep-script-guide/appendix/understanding-spaces-and-maps.md))

### [creatorID](/zep-script/zep-script-api/scriptapp/field.md#creatorid)

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

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

### [players](/zep-script/zep-script-api/scriptapp/field.md#players)

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

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

### [playerCount](/zep-script/zep-script-api/scriptapp/field.md#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](/zep-script/zep-script-api/scriptapp/field.md#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](/zep-script/zep-script-api/scriptapp/field.md#displayratio)

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

Value to control display zooming (Default value: 1)

### [storage](broken://pages/tDQnn0o07RdoXBHwuVWQ#storage)

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

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

### [followPlayer](/zep-script/zep-script-api/scriptapp/field.md#followplayer)

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

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

### [showName](broken://pages/tDQnn0o07RdoXBHwuVWQ#showname)

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

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

## 🛰️ EventListeners

### [onSay](/zep-script/zep-script-api/scriptapp/event-listeners.md#onsay)

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

This function operates when a player enters chat.

### [onPlayerTouched](/zep-script/zep-script-api/scriptapp/event-listeners.md#onplayertouched)

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

This function operates when an avatar collides with another avatar.

### [onObjectTouched](/zep-script/zep-script-api/scriptapp/event-listeners.md#onobjecttouched)

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

This function operates when an avatar collides with an object.

### [onAppObjectTouched](/zep-script/zep-script-api/scriptapp/event-listeners.md#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](/zep-script/zep-script-api/scriptapp/event-listeners.md#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](/zep-script/zep-script-api/scriptapp/event-listeners.md#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](/zep-script/zep-script-api/scriptapp/event-listeners.md#onsidebartouched)

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

This function operates when a player touches the Sidebar app.

### [onTriggerObject](/zep-script/zep-script-api/scriptapp/event-listeners.md#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](/zep-script/zep-script-api/scriptapp/callbacks.md#runlater)

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

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

### [addOnTileTouched](/zep-script/zep-script-api/scriptapp/callbacks.md#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](/zep-script/zep-script-api/scriptapp/callbacks.md#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](/zep-script/zep-script-api/scriptapp/callbacks.md#addonkeydown)

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

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

### [setTimeout](/zep-script/zep-script-api/scriptapp/callbacks.md#settimeout)

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

This executes a callback after time (ms).

### [setInterval](/zep-script/zep-script-api/scriptapp/callbacks.md#setinterval)

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

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

### [addMobileButton](/zep-script/zep-script-api/scriptapp/callbacks.md#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](/zep-script/zep-script-api/scriptapp/callbacks.md#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](/zep-script/zep-script-api/scriptapp/methods.md#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](/zep-script/zep-script-api/scriptapp/methods.md#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](/zep-script/zep-script-api/scriptapp/methods.md#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](/zep-script/zep-script-api/scriptapp/methods.md#saytoall)

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

This function displays text in the chat window.

### [showWidget](/zep-script/zep-script-api/scriptapp/methods.md#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](/zep-script/zep-script-api/scriptapp/methods.md#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](/zep-script/zep-script-api/scriptapp/methods.md#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](/zep-script/zep-script-api/scriptapp/methods.md#kickplayer)

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

This function kicks the player corresponding to playerID.

### [forceDestroy](/zep-script/zep-script-api/scriptapp/methods.md#forcedestroy)

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

This function shuts down the mini-game app.

### [clearChat](/zep-script/zep-script-api/scriptapp/methods.md#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](/zep-script/zep-script-api/scriptapp/methods.md#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](/zep-script/zep-script-api/scriptapp/methods.md#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](/zep-script/zep-script-api/scriptapp/methods.md#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](/zep-script/zep-script-api/scriptapp/methods.md#httpget)

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

This function calls for HTTP Get request.

### [httpPost](/zep-script/zep-script-api/scriptapp/methods.md#httppost)

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

This function calls for HTTP Post request.

### [httpPostJson](/zep-script/zep-script-api/scriptapp/methods.md#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](/zep-script/zep-script-api/scriptapp/methods.md#sendupdated)

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

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

### [save](/zep-script/zep-script-api/scriptapp/methods.md#save)

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

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

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

## 🗺️ ScriptMap&#x20;

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

## 🗃️ Field

### [width & height](/zep-script/zep-script-api/scriptmap/field.md#width-and-height)

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

Calls the map’s width and height values.

## 💠 Methods

### [putTileEffect](/zep-script/zep-script-api/scriptmap/methods.md#puttileeffect)

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

This function applies a tile effect to the specified coordinates.

### [putObject](/zep-script/zep-script-api/scriptmap/methods.md#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?**](broken://spaces/u4PFrNZjiq0L6ogrcQ8C)

### [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](/zep-script/zep-script-api/scriptmap/methods.md#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](/zep-script/zep-script-api/scriptmap/methods.md#getobjectwithkey)

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

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

### [playObjectAnimation](/zep-script/zep-script-api/scriptmap/methods.md#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](/zep-script/zep-script-api/scriptmap/methods.md#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](/zep-script/zep-script-api/scriptmap/methods.md#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](/zep-script/zep-script-api/scriptmap/methods.md#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()](/zep-script/zep-script-api/scriptmap/methods.md#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](/zep-script/zep-script-api/scriptmap/methods.md#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](/zep-script/zep-script-api/scriptmap/methods.md#getobjectsbytype)

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

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

### [getTopObjectsByType](/zep-script/zep-script-api/scriptmap/methods.md#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](/zep-script/zep-script-api/scriptplayer/field.md#id-name)

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

This calls the player ID and nickname values.

### [title](/zep-script/zep-script-api/scriptplayer/field.md#title)

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

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

### [role](/zep-script/zep-script-api/scriptplayer/field.md#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](/zep-script/zep-script-api/scriptplayer/field.md#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](/zep-script/zep-script-api/scriptplayer/field.md#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](/zep-script/zep-script-api/scriptplayer/field.md#movespeed)

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

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

### [sprite](/zep-script/zep-script-api/scriptplayer/field.md#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](/zep-script/zep-script-api/scriptplayer/field.md#tag)

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

Give necessary attribute values to a player by using tag.

### [hidden](/zep-script/zep-script-api/scriptplayer/field.md#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](/zep-script/zep-script-api/scriptplayer/field.md#spotlight)

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

This activates or deactivates the player’s spotlight feature.

### [disableVideo, disableAudio](/zep-script/zep-script-api/scriptplayer/field.md#disablevideo-disableaudio)

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

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

### [attackType](/zep-script/zep-script-api/scriptplayer/field.md#attacktype)

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

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

### [attackParam1](/zep-script/zep-script-api/scriptplayer/field.md#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](/zep-script/zep-script-api/scriptplayer/field.md#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](/zep-script/zep-script-api/scriptplayer/field.md#attacksprite)

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

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

### [walletAddress](/zep-script/zep-script-api/scriptplayer/field.md#walletaddress)

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

This is the player’s wallet address.

### [storage](/zep-script/zep-script-api/scriptplayer/field.md#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](/zep-script/zep-script-api/scriptplayer/field.md#ismobile)

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

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

### [isMoving](/zep-script/zep-script-api/scriptplayer/field.md#ismoving)

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

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

### [isJumping](/zep-script/zep-script-api/scriptplayer/field.md#isjumping)

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

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

### [customData](/zep-script/zep-script-api/scriptplayer/field.md#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](/zep-script/zep-script-guide/appendix/how-to-use-url-query-strings.md)

### [displayRatio](/zep-script/zep-script-api/scriptplayer/field.md#displayratio)

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

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

### [titleColor](/zep-script/zep-script-api/scriptplayer/field.md#titlecolor)

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

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

### [emailHash](/zep-script/zep-script-api/scriptplayer/field.md#emailhash)

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

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

### [isGuest](/zep-script/zep-script-api/scriptplayer/field.md#isguest)

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

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

## 💠 Methods

### [showCenterLabel](broken://pages/pOwCneDJgc3EKRByq0zI#showcenterlabel)

{% 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](broken://pages/pOwCneDJgc3EKRByq0zI#showcustomlabel)

{% 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](broken://pages/pOwCneDJgc3EKRByq0zI#showwidget)

{% 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](/zep-script/zep-script-api/scriptplayer/methods.md#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](/zep-script/zep-script-api/scriptplayer/methods.md#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](/zep-script/zep-script-api/scriptplayer/methods.md#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](/zep-script/zep-script-api/scriptplayer/methods.md#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](/zep-script/zep-script-api/scriptplayer/methods.md#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](broken://pages/pOwCneDJgc3EKRByq0zI#isemail)

{% 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](broken://pages/pOwCneDJgc3EKRByq0zI#getlocationname)

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

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

### [spawnAt](broken://pages/pOwCneDJgc3EKRByq0zI#spawnat)

{% 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](broken://pages/pOwCneDJgc3EKRByq0zI#spawnatlocation)

{% 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](broken://pages/pOwCneDJgc3EKRByq0zI#spawnatmap)

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

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

### [playSound](broken://pages/pOwCneDJgc3EKRByq0zI#playsound)

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

This function plays sound to the corresponding player.

### [playSoundLink](broken://pages/pOwCneDJgc3EKRByq0zI#playsoundlink)

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

This function plays sound for all players.

### [sendUpdated](broken://pages/pOwCneDJgc3EKRByq0zI#sendupdated)

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

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

### [save](broken://pages/pOwCneDJgc3EKRByq0zI#save)

{% 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](broken://pages/KSjwtdtjBJQqp2nAcMNS#id)

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

This calls the widget’s id value.

## 🛰️ EventListeners

### [onMessage](broken://pages/hBEEdCorQa3S86gShWXm#onmessage)

{% 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](broken://pages/33xkkRJUeCMIKPnz44AV#sendmessage)

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

This sends data to the widget from the App.

### [destroy](broken://pages/33xkkRJUeCMIKPnz44AV#destroy)

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

This function closes the widget.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zep.us/zep-script/zep-script-api/api-summary.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
