# Field

### Introduction

These are the attribute values pertaining to players.

The player’s nickname ([<mark style="color:purple;">name</mark>](#id-name)), location ([<mark style="color:purple;">tileX / tileY</mark>](#tilex-tiley)), etc. can be viewed. The player’s spotlight ([<mark style="color:purple;">spotlight</mark>](#spotlight)) feature and hide ([<mark style="color:purple;">hidden</mark>](#hidden)) feature can be activated. The player’s movement speed ([<mark style="color:purple;">moveSpeed</mark>](#movespeed)) and image ([<mark style="color:purple;">sprite</mark>](#sprite)) can be adjusted. It’s also possible to utilize the Space's storage ([<mark style="color:purple;">storage</mark>](#storage)) for storing player values.

🔒 Fields with this icon are read-only fields that cannot be revised.

<table><thead><tr><th width="196">Name</th><th>Description</th></tr></thead><tbody><tr><td>🔒 id</td><td>Player ID value</td></tr><tr><td>name</td><td>Player Nickname value</td></tr><tr><td>title</td><td>Text to be displayed in yellow above an avatar’s nickname</td></tr><tr><td>🔒 role</td><td>A numerical value that represents a player’s permissions</td></tr><tr><td>🔒 tileX / tileY</td><td>The X and Y coordinate values where the avatar is standing</td></tr><tr><td>🔒 dir</td><td>A value representing the direction a player is looking</td></tr><tr><td>moveSpeed</td><td>A value representing the player’s movement speed</td></tr><tr><td>sprite</td><td>An avatar’s sprite image value</td></tr><tr><td>tag</td><td>Value storage space to assign required attribute values</td></tr><tr><td>hidden</td><td>If the value is set to true, the player is invisible</td></tr><tr><td>spotlight</td><td>Toggle player spotlight</td></tr><tr><td>🔒 disableVideo</td><td>Toggle player video</td></tr><tr><td>🔒 disableAudio</td><td>Toggle player audio</td></tr><tr><td>attackType</td><td>Player’s attack type when z is pressed</td></tr><tr><td>attackSprite</td><td>Player’s attack image value when z is pressed</td></tr><tr><td>attackParam1</td><td>Distance value that affects how far the attack image flies</td></tr><tr><td>attackParam2</td><td>Distance value available for attack<br>Only valid when <code>attackType</code> is set to 2 (ranged attack)</td></tr><tr><td>🔒 walletAddress</td><td>The player’s wallet address value</td></tr><tr><td>storage</td><td>Storage space for player values in the Space (limited to the Space)</td></tr><tr><td>🔒 isMobile</td><td>Whether the player is connected via mobile</td></tr><tr><td>🔒 isMoving</td><td>If the player is moving, returns True. If not, returns False</td></tr><tr><td>🔒 isJumping</td><td>If the player is jumping, returns True. If not, returns False</td></tr><tr><td>customData</td><td>Can read the URL query string and save the value</td></tr><tr><td>displayRatio</td><td>Zoom in or out player's display</td></tr><tr><td>titleColor</td><td>Player's title color</td></tr><tr><td>🔒 emailHash</td><td>The hash value of the player's email</td></tr><tr><td>🔒 isGuest</td><td>If the player is not signed in, returns True.</td></tr></tbody></table>

## 📚 API Description and Examples

### id , name

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

Calls the player ID and nickname values.

**Example**

Make the player’s ID and nickname value display when a player enters.

```jsx
// Activates function when a player enters
App.onJoinPlayer.Add(function(player){
  App.sayToAll(`id: ${player.id} name: ${player.name}`);
})
```

### title

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

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

**Example**

Set up a title for a player when they enter.

```jsx
// Activates function when a player enters 
App.onJoinPlayer.Add(function(player){
	player.title = "title";
	player.sendUpdated();
})
```

### 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.

<table><thead><tr><th width="146">Role</th><th width="137">Number</th><th width="154">Role</th><th width="168">Number</th></tr></thead><tbody><tr><td>Guest</td><td>-1</td><td>Staff</td><td>2000</td></tr><tr><td>Member</td><td>0</td><td>Admin</td><td>3000</td></tr><tr><td>Editor</td><td>1000</td><td>Owner</td><td>3001</td></tr></tbody></table>

**Example**

Display the permission role value in the chat screen.

```jsx
// Activates function when q is pressed 
// **[App.addOnKeyDown Description (Link)](https://www.notion.so/Callbacks-7ac5078bab7c4f3180ae05463713581d)**
App.addOnKeyDown(81,function(player){
	App.sayToAll(`${player.name}'s permissions: ${player.role}`)
})
```

### tileX, tileY

{% hint style="info" %}
player.tileX: Number \
player.tileY: Number
{% endhint %}

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

**Example**

Display my avatar’s x and y coordinates.

```jsx
// Activates function when q is pressed 
// **[App.addOnKeyDown Description (Link)](https://www.notion.so/Callbacks-7ac5078bab7c4f3180ae05463713581d)**
App.addOnKeyDown(81,function(player){
	App.sayToAll(`Current Coordinates: (${player.tileX}, ${player.tileY})`)
})
```

### dir

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

The direction the player’s avatar is looking.

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

![](/files/EDxBDkN9XIDv4Uz3Hk2R)

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

**Example**

Display the value of where the avatar is looking.

```jsx
// Activates function when q is pressed 
// App.addOnKeyDown Description
App.addOnKeyDown(81,function(player){
	App.sayToAll(`Direction the avatar is looking: ${player.dir}`)
})
```

### moveSpeed

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

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

If the movement speed value is 0, the player cannot move.

**Example**

Increase the movement speed when q is pressed.

```jsx
// Activates function when q is pressed 
// App.addOnKeyDown Description 
App.addOnKeyDown(81,function(player){
	player.moveSpeed = 150;
	player.sendUpdated();
})
```

### 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**)

Check the [<mark style="color:purple;">Understanding Sprite Sheets</mark>](/zep-script/zep-script-guide/appendix/understanding-sprite-sheets.md) page if it’s your first time hearing about sprite images.

**Example**

Apply the Paintman-Blueman image as the avatar image.

{% file src="/files/r42zZVmOUI3NDpENOt24" %}

<div align="left"><figure><img src="/files/etUxqznxedHQixvV7U9G" alt=""><figcaption></figcaption></figure></div>

```jsx
// One frame's size 48x64
let blueman = App.loadSpritesheet('blueman.png', 48, 64, {
    left: [5, 6, 7, 8, 9], // left direction facing image
    up: [15, 16, 17, 18, 19],
    down: [0, 1, 2, 3, 4],
    right: [10, 11, 12, 13, 14],
		dance: [20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],
		down_jump: [38],
		left_jump: [39],
		right_jump: [40],
		up_jump: [41],
}, 8);
// Changes avatar's image when player enters
App.onJoinPlayer.Add(function(player){
	player.sprite = blueman;
	player.sendUpdated();
});
```

### tag

{% hint style="info" %}
player.tag: Any
{% endhint %}

Give necessary attribute values to a player by using tag.

**Example**

Give a player the ‘alive’ attribute value. The ‘alive’ attribute value is a deliberately created attribute.

If the attribute is unused, it won’t be a useful attribute value. In this case, the "alive" attribute value can check if a player has been eliminated from a game or not.&#x20;

```jsx
// Activates function when a player enters 
App.onJoinPlayer.Add(function (player) {
	player.tag = {
		alive: true,
	};
	player.sendUpdated();

	App.sayToAll(`alive: ${player.tag.alive}`);
});
```

### hidden

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

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

{% hint style="danger" %}
The avatar in a hidden state is not visible, but it is possible to connect the video and audio.
{% endhint %}

**Example**

Give an avatar the hidden attribute to make the avatar not visible to other players.

```jsx
// Activates function when q is pressed 
// App.addOnKeyDown Description
App.addOnKeyDown(81,function(player){
	player.hidden = true;
	player.sendUpdated();
});
```

### spotlight

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

This activates or deactivates the player’s spotlight feature.

**Example**

Make a function that turns the spotlight feature ON or OFF by pressing q.

```jsx
// Activates function when q is pressed
// App.addOnKeyDown Description
App.addOnKeyDown(81,function(player){
	if(player.spotlight){
		player.spotlight = false;
	}
	else{
		player.spotlight = true;
	}
	player.sendUpdated();
});
```

### disableVideo, disableAudio

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

This activates or deactivates the player’s video/audio features.

**Example**

Display in the chat screen if the video and/or audio are deactivated or not.

```jsx
// Activates function when q is pressed 
// App.addOnKeyDown Description 
App.addOnKeyDown(81, function (player) {
	App.sayToAll(`video activation or deactivation: ${player.disableVideo}`);
	App.sayToAll(`audio activation or deactivation: ${player.disableAudio}`);
});
```

### attackType

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

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

<table><thead><tr><th width="134">attackType</th><th>Description</th></tr></thead><tbody><tr><td>0</td><td>If the attackType is not set up, it means it is set to the default attack type.</td></tr></tbody></table>

**Example**

Change the avatar’s attackType.

```jsx
// Activates function when q is pressed 
// App.addOnKeyDown Description
App.addOnKeyDown(81, function (player) {
	player.attackType = 0;
	App.sayToAll(`attackType: ${player.attackType}`);
	player.sendUpdated();
});
```

### attackParam1

{% hint style="info" %}
&#x20;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.

**Example**

Change the attackParam1.

<div align="left"><figure><img src="/files/1qtnk53bCtQcKDA7NfM0" alt=""><figcaption></figcaption></figure></div>

```jsx
// Activates function when q is pressed 
// App.addOnKeyDown Description
App.addOnKeyDown(81, function (player) {
	App.sayToAll(`attackType: ${player.attackType}`);
	App.sayToAll(`attackParam1: ${player.attackParam1}`);
	player.attackType = 0;
	player.attackParam1 = 10;
	player.sendUpdated();
});
```

### 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.

**Example**

Set a ranged attack using attackParam2.

![](/files/lrbwejclzv81JkOPuBpI)

```jsx
// Activates function when q is pressed
// App.addOnKeyDown
App.addOnKeyDown(81, function (player) {
	player.attackType = 2;
	player.attackParam2 = 5;
	App.sayToAll(`attackType: ${player.attackType}`);
	App.sayToAll(`attackParam2: ${player.attackParam2}`);
	player.sendUpdated();
});
```

### attackSprite

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

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

**Example**

Apply the boxing game’s glove attack image.

<div align="left"><figure><img src="/files/ycFk2gF6uIr7Zknc2EC7" alt=""><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="/files/ZxWDpgWQp2zyyKTNgxft" alt=""><figcaption></figcaption></figure></div>

```jsx
let redBoxing = App.loadSpritesheet("redBoxing.png");
// Activates function when q is pressed 
// App.addOnKeyDown Description
App.addOnKeyDown(81, function (player) {
	player.attackSprite = redBoxing;
	player.sendUpdated();
});
```

### walletAddress

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

This is the player’s wallet address.

**Example**

Call the wallet address. If there is no wallet address, the results called will be **null**.

```jsx
// Activates function when q is pressed 
// **[App.addOnKeyDown Description (Link)](https://www.notion.so/Callbacks-7ac5078bab7c4f3180ae05463713581d)**
App.addOnKeyDown(81, function (player) {
	App.sayToAll(`${player.walletAddress}`)
});
```

### storage

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

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

**Example**

Store the data in player storage and check it.

{% hint style="success" %}
&#x20;Even after closing the app and restarting it, the stored values will not disappear.
{% endhint %}

```jsx
// Activates function when q is pressed 
// App.addOnKeyDown Description
App.addOnKeyDown(81,function(player){
	player.storage = "data";
	player.save(); // Applies the changed storage value to player.save() when storage values are changed
})

// Activates function when w is pressed 
App.addOnKeyDown(87,function(player){
	App.sayToAll(player.storage); // Displays the value saved in player storage on the chat screen
})
```

### isMobile

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

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

**Example**

Display mobile  PC status in the entry message when a player enters.

```jsx
// Activates function when a player enters
App.onJoinPlayer.Add(function(player){	
	if(player.isMobile){
		App.sayToAll(`${player.name} entered from mobile.`)	
	} else{
		App.sayToAll(`${player.name} entered from PC.`)
	}
});
```

####

### isMoving

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

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

**Example**

Detect the player's movement and display a message.

```jsx
App.onUpdate.Add(function (dt) {
	let _players = App.players;
	for (let i in _players) {
		let p = _players[i];
		if (p.isMoving) {
			App.sayToAll(`${p.name} is moving...`);
		}
	}
});
```

####

### isJumping

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

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

**Example**

Detect the player's movement and display a message.

```jsx
App.onUpdate.Add(function (dt) {
	let _players = App.players;
	for (let i in _players) {
		let p = _players[i];
		if (p.isJumping) {
			App.sayToAll(`[System] ${p.name} is jumping...`);
		}
	}
});
```

####

### customData

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

This field saves the value received as a query string.

**Example**

[**How to Use URL Query Strings**](/zep-script/zep-script-guide/appendix/how-to-use-url-query-strings.md)

### displayRatio

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

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

**Example**

Create a key to zoom in or out.

```
// Activates function when Q is pressed
// Press once to zoom in and press again to zoom out
App.addOnKeyDown(81,function(player){
	if(player.displayRatio == 1){
		player.displayRatio = 5;
	}else{
		player.displayRatio = 1;
	}
	player.sendUpdated(); //* When the player's field value is updated, apply it as player.sendUpdated()
})
```

<div><figure><img src="/files/V47Y4IRrUaHau9uqmwf8" alt=""><figcaption><p>displayRatio = 1</p></figcaption></figure> <figure><img src="/files/l8o4W328hvsncfTA6T77" alt=""><figcaption><p>displayRatio = 5</p></figcaption></figure></div>

### titleColor

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

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

You can enter enum values or hex code values.

```
Available Enum ColorType
{ WHITE, BLACK, RED, GREEN, BLUE, ORANGE, PURPLE, GRAY, YELLOW, MAGENTA, CYAN }
```

**Example**

Change the title color.

![](/files/YQibydKv3ZYDZgG83e19)

```
// Activates function when Q is pressed
App.addOnKeyDown(81, function (player) {
	player.title = "🔸Title🔸";
	// When enum values are entered
	player.titleColor = ColorType.CYAN;
	
	// When hex codes are entered (Delete "//" when using the following)
	// player.titleColor = 0x00FFFF;
	
	player.sendUpdated(); //*When the player's field value is updated, apply it as player.sendUpdated()
});
```

### emailHash

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

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

**Example**

Display the hash value of a player.

```javascript
// Activates function when a player enters 
App.onJoinPlayer.Add(function(player){
  App.sayToAll(`name: ${player.name} emailHash: ${player.emailHash}`);
})
```

### isGuest

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

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

**Example**

Show "GUEST" as a title when a guest who is not signed in enters.

```jsx
// Activates function when a player enters 
App.onJoinPlayer.Add(function(player){
  if(player.isGuest){
    player.title = "GUEST";
    player.sendUpdated();
  }
})
```


---

# 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/scriptplayer/field.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.
