# Field

### 소개

**Field**는 App과 관련된 속성 값들 입니다. 이 필드를 활용해 참가 중인 스페이스나 맵, 플레이어 정보 등을 조회하거나, 저장공간을 활용할 수 있습니다.

🔒 아이콘이 있는 필드는 수정이 불가능한 읽기 전용 필드입니다.

<table><thead><tr><th width="206">이름</th><th>설명</th></tr></thead><tbody><tr><td>🔒 spaceHashID</td><td>App이 설치된 스페이스의 해쉬값을 보여줍니다.</td></tr><tr><td>🔒 mapHashID</td><td>App이 설치된 맵의 해쉬값을 가져옵니다.</td></tr><tr><td>🔒 creatorID</td><td>App을 실행한 플레이어의 ID 값을 가져옵니다.</td></tr><tr><td>🔒 players</td><td>맵에 있는 모든 플레이어 리스트를 배열로 가져옵니다.</td></tr><tr><td>🔒 playerCount</td><td>앱이 설치된 맵에 있는 플레이어의 수를 가져옵니다.</td></tr><tr><td>cameraEffect</td><td>카메라 이펙트의 종류를 셋팅할 변수 값</td></tr><tr><td>cameraEffectParam</td><td>카메라 이펙트 효과의 범위 값</td></tr><tr><td>displayRatio</td><td>화면의 줌을 컨트롤 하는 값</td></tr><tr><td>storage</td><td>스페이스 내의 App 데이터의 저장공간(스페이스 한정)</td></tr><tr><td>followPlayer</td><td>App의 따라가기 기능 활성화 여부 값</td></tr><tr><td>showName</td><td>플레이어 닉네임 숨김 여부</td></tr><tr><td>🔒 appHashID</td><td>앱의 HashID 값을 가져옵니다.</td></tr><tr><td>enableFreeView</td><td>앱이 설치된 맵의 둘러보기 허용 여부를 설정할 수 있습니다.</td></tr></tbody></table>

## 📚 API 설명 및 예제

### spaceHashID & mapHashID

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

앱이 설치된 스페이스의 spaceHashID와 mapHashID를 가져옵니다. [<mark style="color:purple;">(스페이스와 맵 이해하기)</mark>](/creator/reference/undefined.md)

**예제**

앱이 설치된 맵의 spaceHashID와 mapHashID 출력해보기

```jsx
// 플레이어가 입장할 때 동작하는 함수
App.onJoinPlayer.Add(function(player){
  // 채팅창에 spaceHashID와 mapHashID 출력해보기
	App.sayToAll(`spaceHashID: ${App.spaceHashID}`); // spaceHashID: Ak42Xz
	App.sayToAll(`mapHashID: ${App.mapHashID}`) // mapHashId: 25g3RQ
})
```

###

### creatorID

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

미니게임을 실행한 플레이어의 ID 값을 가져옵니다.\
⛔맵 내장형  앱인 노멀 앱과 사이드바 앱에서는 동작하지 않습니다.

**예제**

미니게임을 실행한 플레이어의 닉네임을 채팅창에 출력해보기

```jsx
// 플레이어가 입장할 때 동작하는 함수
App.onJoinPlayer.Add(function(player){
	if(player.id == App.creatorID){
		App.sayToAll(`${player.name}님이 앱을 실행했습니다.`)
	}
})
```

####

### players

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

맵에 있는 모든 플레이어 리스트를 배열로 가져옵니다.

**예제**

맵에 있는 모든 플레이어 닉네임을 출력해보기

```jsx
// q 키를 누르면 동작하는 함수
// App.addOnKeyDown 설명
App.addOnKeyDown(81,function(p){
	//App.players를 이용해 채팅창에 접속해있는 모든 플레이어의 닉네임을 출력하기
	let players = App.players;
	for(let i in players){
		let player = players[i]
		App.sayToAll(player.name)
	}
})
```

####

### playerCount

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

앱이 설치된 맵에 있는 플레이어의 수를 가져옵니다.

**예시**

맵에 있는 플레이어 수 출력해보기

```jsx
// q 키를 누르면 동작하는 함수
// App.addOnKeyDown 설명
App.addOnKeyDown(81,function(p){
	// 현재 접속자 수를 채팅창에 출력
	App.sayToAll(`접속자 수: ${App.playerCount}`)
})
```

####

### cameraEffect & cameraEffectParam1

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

App.cameraEffect: 카메라 이펙트의 종류를 셋팅할 변수 값

App.cameraEffectParam1: 카메라 이펙트 효과의 범위 값

**예제**

비네팅 효과를 On/Off 하는 키 함수 만들어보기

```jsx
// q 키를 누르면 동작하는 함수
// 한 번 누르면 비네팅 효과가 켜지고, 두 번 누르면 비네팅 효과가 꺼짐
// App.addOnKeyDown 설명
App.addOnKeyDown(81,function(p){
	if(App.cameraEffect == 0){
		App.cameraEffect = 1; // 1 = 비네팅 효과
		App.cameraEffectParam1 = 500; // 비네팅 효과의 범위를 500으로 지정
	}
	else if(App.cameraEffect == 1){
		App.cameraEffect = 0; // 비네팅 효과 끄기
	}
	App.sendUpdated(); // 앱의 Field값이 변경되면 App.sendUpdated()로 변경값을 적용
})
```

<figure><img src="/files/XZVicu0fGjD3MNDIBOL8" alt=""><figcaption><p>비네팅 효과 범위 500이 적용된 모습</p></figcaption></figure>

####

### displayRatio

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

화면의 줌을 컨트롤 하는 값 ( 기본 값: 1 )

**예제**

화면의 줌을 컨트롤 하는 키 만들어보기

```jsx
// q 키를 누르면 동작하는 함수
// 한 번 누르면 화면의 줌 값이 커지고, 한 번 더 누르면 원래대로 돌아오는 키 함수 
// App.addOnKeyDown 설명
App.addOnKeyDown(81,function(p){
	if(App.displayRatio == 1){
		App.displayRatio = 5;
	}else{
		App.displayRatio = 1;
	}
	App.sendUpdated(); //* 앱의 Field값이 변경되면 App.sendUpdated()로 변경값을 적용
})
```

<div><figure><img src="/files/nNf7vvQL7n0Hr26ejFOm" alt=""><figcaption><p>displayRatio 값이 5일 때</p></figcaption></figure> <figure><img src="/files/4uHEWrow4dpYwrU0Vs5c" alt=""><figcaption><p>displayRatio 값이 1일 때</p></figcaption></figure></div>

### storage

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

스페이스 내의 App 데이터의 저장공간 입니다 (스페이스 한정)

**예제**

[**Storage 페이지**](/zep-script-api/zepscriptapi/scriptapp/storage.md)를 참고해주세요

####

### followPlayer

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

App의 따라가기 기능 활성화 여부 값 입니다. ( 기본 값 : false )

노멀 앱, 미니게임 앱이 실행 중인 경우 followPlayer 값이 false로 설정되어 ‘따라가기’ 기능이 비활성화됩니다.

**예제**

따라가기 기능을 끄고 키는 함수 만들어보기

```jsx
// q 키를 누르면 동작하는 함수
// followPlayer 값을 바꾸는 키 함수
App.addOnKeyDown(81,function(p){
	if(App.followPlayer){
		App.followPlayer = false;
	}else{
		App.followPlayer = true;
	}
	App.sayToAll(`App.followPlayer: ${App.followPlayer}`)
	App.sendUpdated(); //* 앱의 Field값이 변경되면 App.sendUpdated()로 변경값을 적용
})
```

###

### showName

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

플레이어 닉네임 숨김 여부

App.showName 을 false로 설정하면 모든 플레이어의 닉네임이 숨김 처리됩니다.

**예제**

```javascript
// q 키를 누르면 동작하는 함수
// showName 값을 바꾸는 키 함수
App.addOnKeyDown(81,function(p){
	if(App.showName){
		App.showName = false;
	}else{
		App.showName = true;
	}
	App.sayToAll(`App.showName: ${App.showName}`)
	App.sendUpdated(); //* 앱의 Field값이 변경되면 App.sendUpdated()로 변경값을 적용
})

```

###

### appHashID

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

앱의 HashID를 가져옵니다.

**예제**

채팅창에앱의 HashID 출력하기

```jsx
// 플레이어가 입장할 때 동작하는 함수
App.onJoinPlayer.Add(function(player){
	App.sayToAll(`appHashID: ${App.appHashID}`); 
})
```

###

### enableFreeView

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

앱이 설치된 맵의 둘러보기 허용 여부를 설정할 수 있습니다.

**예제**

단축키로 맵 둘러보기 허용 여부 설정하기

```jsx
// Q를 누르면 동작하는 함수
App.addOnKeyDown(81, function (player) {
	if (App.enableFreeView) {
		App.enableFreeView = false;
	} else {
		App.enableFreeView = true;
	}
	App.sendUpdated();
	player.sendMessage(`App.enableFreeView = ${App.enableFreeView}`, 0x00ffff);
});
```

***

### 부록

[<mark style="color:purple;">스페이스와 맵 이해하기</mark>](https://app.gitbook.com/o/-MkvEtFn2kFBYSN4_5rX/s/iW553XSGeKCAPpImxXi3/~/changes/bRylDKw8UxLaVWLvuhVV/creator/zep-script-guide/reference/undefined)


---

# 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-kr.zep.us/zep-script-api/zepscriptapi/scriptapp/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.
