> For the complete documentation index, see [llms.txt](https://zep-1.gitbook.io/zep-guidebook-jp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zep-1.gitbook.io/zep-guidebook-jp/zep-script-api/zepscriptapi/api-summary.md).

# API Summary

ZEP-Script API一覧

## :mag:<mark style="color:blue;">Ctrl + Fを利用し、お探しのAPIを検索してください！</mark>

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

## 🕹️ ScriptApp&#x20;

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

## ♻️ Lifecycle

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

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

Appが初めて起動される時に一回呼び出されます。

### [onJoinPlayer](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/lifecycle.md#onjoinplayer)

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

onInitが呼び出された後、接続している全プレイヤーを当該イベントを通じて入場させ、その後に入場するプレイヤーがいるたびに動作します。

### [onStart](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/lifecycle.md#onstart)

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

全プレイヤーがonJoinPlayerで入場した後、一度呼出されます。

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

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

約20msごとに実行される関数です。

### [onLeavePlayer](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/lifecycle.md#onleaveplayer)

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

退出するプレイヤーがいるたびに動作します。 その後、他のAppが実行されたり、設置したGame Blockが破壊される時、全プレイヤーをこの関数で退場させます。

### [onDestroy](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/lifecycle.md#ondestroy)

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

他Appが実行されたり、設置したGame Blockが破壊される時、動作します。

## 🗃️ Field

### [spaceHashID & mapHashID](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/field.md#spacehashid-and-maphashid)

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

アプリが設置されたスペースのspaceHashIDとmapHashIDを取得します。[<mark style="color:purple;">(スペースとマップについて)</mark>](/zep-guidebook-jp/zep-scriptgaido/reference/supsutomappunitsuite.md)

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

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

Appを実行したプレイヤーのIDデータを取得します。

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

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

マップにいる全プレイヤーのリストを配列で取得します。

### [playerCount](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/field.md#playercount)

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

Appが設置されたマップにいるプレイヤーの数を取得します。

### [cameraEffect & cameraEffectParam1](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/field.md#cameraeffect-and-cameraeffectparam1)

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

App.cameraEffect: カメラエフェクトの種類を設定する変数

App.cameraEffectParam1: カメラエフェクト効果の範囲データ

### [displayRatio](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/field.md#displayratio)

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

画面のズームをコントロールするデータ (デフォルト値：1)

### [storage](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/field.md#storage)

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

スペース内のAppデータの保存空間です。（スペース限定）[<mark style="color:blue;">**Storageページ**</mark>](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/storage.md)をご参照ください。

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

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

Appフォロー機能の設定データです。 (デフォルト値 : false)

### [showName](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/field.md#showname)

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

プレイヤーのニックネーム隠し機能の設定データです。(デフォルト値 : true)

### [appHashID](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/field.md#apphashid)

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

AppのHashIDを取得します。

## ️💾 Storage

### [setStorage, getStorage](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/storage.md)

{% hint style="info" %}
App.setStorage(string) / App.getStorage(function())
{% endhint %}

App.setStorage関数でApp storageを保存し、アプリを使用している他のマップのApp storageに変更がある場合、App.getStorage関数でApp storageを同期化することができます。

{% hint style="warning" %}
App.getStorage関数は非同期関数であるため、App.getStorage関数の次の行にApp.storageを使うコードを入れる場合、同期できると保証できません。
{% endhint %}

## 🛰️ EventListeners

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

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

プレイヤーがチャットを入力する時に動作します。

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

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

アバター同士が衝突する時に動作します。

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

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

アバターがオブジェクトと衝突する時に動作します。

### [onAppObjectTouched](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/event-listeners.md#onappobjecttouched)

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

️ アバターがKeyデータを持ったオブジェクトと衝突する時に動作します。

### [onUnitAttacked](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/event-listeners.md#onunitattacked)

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

プレイヤーが攻撃キー(Zキー)で他のアバターを攻撃する時に動作します。

### [onObjectAttacked](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/event-listeners.md#onobjectattacked)

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

プレイヤーが攻撃キー(Zキー)でオブジェクトを攻撃する時に動作します。

### [onSidebarTouched](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/event-listeners.md#onsidebartouched)

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

プレイヤーがサイドバーアプリをクリック(タッチ)する時に動作します。

### [onTriggerObject](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/event-listeners.md#ontriggerobject)

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

オブジェクトとFキーで相互作用する時に動作する関数です。

### [onAppObjectAttacked](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/event-listeners.md#onappobjectattacked)

{% hint style="info" %}

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

{% endhint %}

プレイヤーが攻撃キー(Zキー)でキーデータを持つオブジェクトを攻撃する時に動作します。

## ☎️ Callbacks

### [runLater](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/callbacks.md#runlater)

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

time(秒)後にcallback関数を実行します。

### [addOnTileTouched](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/callbacks.md#addontiletouched)

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

指定したx,y座標にプレイヤーが到着する場合、callback関数を実行します。

### [addOnLocationTouched](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/callbacks.md#addonlocationtouched)

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

プレイヤーがマップエディタの「領域指定」機能を通じて指定した領域に到着した時、callback関数を実行します。

### [addOnKeyDown](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/callbacks.md#addonkeydown)

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

プレイヤーが指定したキーを押した時にcallback関数を実行します。

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

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

time(ms)後にcallback関数を実行します。

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

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

time(ms)間隔でcallback関数を実行します。

### [addMobileButton](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/callbacks.md#addmobilebutton)

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

モバイル環境でカスタムモバイルボタンを追加し、ボタンを押したら動作する関数を指定します。

### [putMobilePunch](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/callbacks.md#putmobilepunch)

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

enableがtrueの場合、モバイル環境でパンチボタンが追加されます。

### [putMobilePunchWithIcon](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/callbacks.md#putmobilepunchwithicon)

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

ロードしたイメージでパンチボタンを作成・追加します。

## 💠 Methods

### [loadSpritesheet](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/methods.md#loadspritesheet)

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

スプライトシートイメージファイルを読み込んで客体化する関数です。

### [showCenterLabel](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/methods.md#showcenterlabel)

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

指定した位置に全プレイヤーへのtextを3秒間表示する関数です。

### [showCustomLabel](/zep-guidebook-jp/zep-script-api/zepscriptapi/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 %}

指定した位置に全プレイヤーへのtextを3秒間表示する関数です。

text部分に<mark style="color:purple;">`span`</mark>タグを入れてテキストをカスタマイズすることができます。

### [sayToAll](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/methods.md#saytoall)

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

チャットバーにtextの内容を出力します。

### [sayToStaffs](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/methods.md#saytostaffs)

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

Staff以上の権限のユーザのチャットバーにtext内容を出力します。

### [showWidget](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/methods.md#showwidget)

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

全プレイヤーに指定されたalignの位置に当該htmlファイルをウィジェットとして表示する関数です。

### [showYoutubeWidget](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/methods.md#showyoutubewidget)

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

リンクに当該するYoutubeコンテンツをウィジェットで表示します。

### [spawnPlayer](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/methods.md#spawnplayer)

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

playerIDに当該するプレイヤーをtileX, tileY座標に移動させる関数です。

### [kickPlayer](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/methods.md#kickplayer)

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

playerIDに当該するプレイヤーを追放する関数です。

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

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

ミニゲームアプリを強制的に終了する関数です。

### [clearChat](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/methods.md#clearchat)

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

すべてのチャット内容を削除する関数です。

### [getPlayerByID](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/methods.md#getplayerbyid)

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

IDに当該するプレイヤーを返す関数です。

### [playSound](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/methods.md#playsound)

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

全プレイヤーにサウンドを再生する関数です。

### [playSoundLink](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/methods.md#playsoundlink)

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

全プレイヤーにサウンドを再生する関数です。

### [stopSound](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/methods.md#stopsound)

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

再生中のサウンドを停止する関数です。

### [httpGet](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/methods.md#httpget)

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

http getリクエストを送る関数です。

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

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

Form-Data形式のhttp postリクエストを送る関数です。

### [httpPostJson](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/methods.md#httppostjson)

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

Json形式のhttp postリクエストを送る関数です。

### [sendUpdated](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/methods.md#sendupdated)

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

App関連フィールドのデータが変更されたら、変更されたデータを適用する関数です。

### [changeAttackSound](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptapp/methods.md#changeattacksound)

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

ポーク(Zキー)攻撃の効果音を変更する関数です。

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

## 🗺️ ScriptMap&#x20;

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

## 🗃️ Field

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

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

マップの横縦のデータを取得します。

## 💠 Methods

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

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

指定した座標にタイル効果を適用する関数です。

### [putObject](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptmap/methods.md#putobject)

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

指定した座標にオブジェクトを置く関数です。(基準座標: Left Top) → [<mark style="color:purple;">**基準座標**</mark>](/zep-guidebook-jp/zep-scriptgaido/reference/coordinate.md)

### [putObjectMultiple](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptmap/methods.md#putobjectmultiple)

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

オブジェクトを配置する座標を2次元配列で入力し、一気にオブジェクトを設置する機能です。この機能を使うと一度に多くのオブジェクトを設置する場合、負荷を減らすことができます。

### [putObjectWithKey](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptmap/methods.md#putobjectwithkey)

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

指定した座標にキーデータを持つオブジェクトを置く関数です。 (基準座標: Left Top)

### [getObjectWithKey](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptmap/methods.md#getobjectwithkey)

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

当該キーデータを持つオブジェクトの情報を取得します。

### [playObjectAnimation](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptmap/methods.md#playobjectanimation)

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

該当座標にあるオブジェクトのスプライトアニメーションを実行させる関数です。

その座標点に[<mark style="color:purple;">Map.putObject</mark>](#putobject)関数が先行する必要があります。

### [playObjectAnimationWithKey](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptmap/methods.md#playobjectanimationwithkey)

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

Keyデータと一致するオブジェクトのスプライトアニメーションを実行させる関数です。

###

### [moveObject](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptmap/methods.md#moveobject)

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

x,y座標に位置するオブジェクトをtargetX, targetYにtime秒間移動する関数です。

その座標点に[<mark style="color:purple;">Map.putObject</mark>](https://app.gitbook.com/o/-MkvEtFn2kFBYSN4_5rX/s/iW553XSGeKCAPpImxXi3/~/changes/bRylDKw8UxLaVWLvuhVV/creator/zep-script-v2_kr/api/scriptmap/methods)関数が先行する必要があります。

### [moveObjectWithKey](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptmap/methods.md#moveobjectwithkey)

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

Keyデータを持つオブジェクトをtargetX, targetYに移動させる関数です。

### [clearAllObjects()](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptmap/methods.md#clearallobjects)

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

ZEP Scriptで生成された全オブジェクトを削除する関数です。

### [getTile](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptmap/methods.md#gettile)

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

当該するレイヤーのx、y座標にあるタイルのタイプデータを返し、タイルがない場合-1を返します。

### [getLocation](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptmap/methods.md#getlocation)

{% hint style="info" %}
Map.getLocation(locationName: string)
{% endhint %}

パラメーターで送信したロケーションがある場合、ロケーション設置座標を返します。

### [getLocationRandom](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptmap/methods.md#getlocationrandom)

{% hint style="info" %}
Map.getLocationRandom(locationName: string)
{% endhint %}

パラメーターで送信したロケーションが2つ以上ある場合、ランダムで選択肢、ロケーション設置座標を返します。

### [hasLocation](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptmap/methods.md#haslocation)

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

マップに該当ロケーションがあるかどうかをチェックし、true/falseのデータを返します。

### [getObjectsByType](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptmap/methods.md#getobjectsbytype)

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

&#x20;Typeに該当するオブジェクトを返す関数です。

### [getTopObjectsByType](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptmap/methods.md#gettopobjectsbytype)

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

&#x20;Typeに該当する上段オブジェクトを返す関数です。

### [sayObjectWithKey](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptmap/methods.md#sayobjectwithkey)

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

&#x20;Keyデータを持つオブジェクト上に吹き出しを表示する関数です。

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

## 👥 ScriptPlayer&#x20;

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

## 🗃️ Field

### [id , name](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/field.md#id-name)

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

プレイヤーのid、ニックネームデータを取得します。

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

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

titleはアバターのニックネーム上に黄色で表示されるテキストです。

### [role](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/field.md#role)

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

Roleはプレイヤーの権限を表す数値です。プレイヤーの権限（Role）に応じて、以下の値が返されます。

| ゲスト  | -1   | スタッフ   | 2000 |
| ---- | ---- | ------ | ---- |
| メンバー | 0    | 管理者    | 3000 |
| エディタ | 1000 | マップ所有者 | 3001 |

###

### [tileX, tileY](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/field.md#tilex-tiley)

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

プレイヤーのアバターがいるX座標とY座標のデータです。

### [dir](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/field.md#dir)

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

プレイヤーのアバターが向いている方向です。

アバターが向いている方向によって、次のようなデータを出力します。

<div align="center"><figure><img src="https://content.gitbook.com/content/G3jVUd3jY2jJys64a3C1/blobs/frodTQT7O4gWY0Sq7Wdx/Untitled-1_(1).png" alt=""><figcaption><p>アバターが向いている方向によるdirデータ</p></figcaption></figure> <figure><img src="https://3595873196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG3jVUd3jY2jJys64a3C1%2Fuploads%2Ft6GM3PTcMo5DNxN3z9Bx%2Fimage.png?alt=media&amp;token=d03d8435-4d6d-484a-901e-b16545724bb4" alt=""><figcaption></figcaption></figure></div>

### [moveSpeed](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/field.md#movespeed)

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

プレイヤーの移動速度データです。（デフォルト：80）

### [sprite](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/field.md#sprite)

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

プレイヤーアバターのスプライトイメージです。(**null**を入力すると基本アバターイメージに初期化）

### [tag](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/field.md#tag)

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

Tagを使いプレイヤーに必要な属性データを与えることができます。

### [hidden](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/field.md#hidden)

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

hiddenのデータがtrueの場合、当該プレイヤーは他プレイヤーに見えません。

### [spotlight](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/field.md#spotlight)

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

プレイヤーのスポットライト機能ON・OFFに関するデータです。

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

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

プレイヤーのビデオ・オーディオの使用をチェックします。

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

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

プレイヤーの攻撃(Zキー)タイプです。（デフォルト：0）

### [attackParam1](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/field.md#attackparam1)

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

攻撃(Zキー)イメージが飛ぶ距離属性です。攻撃可能距離は増加しません。

### [attackParam2](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/field.md#attackparam2)

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

攻撃可能範囲属性です。attackTypeが遠距離攻撃に設定されている場合のみ有効です。

### [attackSprite](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/field.md#attacksprite)

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

攻撃（Zキー）イメージ属性です。

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

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

プレイヤーの電子ウォレットアドレスです。

### [storage](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/field.md#storage)

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

スペース内のプレイヤーデータを保存する空間です(スペース限定)。

### [isMobile](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/field.md#ismobile)

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

プレイヤーのモバイル接続可否をtrue/falseで出力します。

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

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

プレイヤーが移動中である場合True、そうでない場合Falseを返します。

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

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

プレイヤーがジャンプしている場合True、そうでない場合Falseを返します。

### [customData](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/field.md#customdata)

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

URLクエリ文字列で渡されたデータを保存するフィールドです。 :fire: [URLクエリ文字列活用](/zep-guidebook-jp/zep-scriptgaido/reference/urlkueriwosuru.md)

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

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

プレイヤー画面ズームをコントロールするデータ (デフォルト値：1 )

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

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

プレイヤーのタイトル色を読み込んだり修正できます。

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

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

プレイヤーのメールアドレスHashデータを取得します。

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

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

非ログインプレイヤーの場合、trueで出力します。

### [away](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/field.md#away)

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

5分以上非活性化されたユーザーの場合`true`データを持ちます。

## 💠 Methods

### [showCenterLabel](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#showcenterlabel)

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

指定した位置に当該プレイヤーへのtextを3秒間表示する関数です。

### [showCustomLabel](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#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 %}

指定した位置に全プレイヤーへのtextを3秒間表示する関数です。

text部分に<mark style="color:purple;">`span`</mark>タグを入れてテキストをカスタマイズすることができます。

### [showWidget](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#showwidget)

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

当該プレイヤーに指定されたalignの位置に当該htmlファイルをウィジェットとして表示する関数です。

### [showBuyAlert](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#showbuyalert)

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

プレイヤーに購入ウィジェットを表示し、購入後動作するコールバック関数を作成できます。**payToSpaceOwner**オプションがfalseの場合、アプリの所有者が受益を得り、trueの場合、アプリが設置されたマップの所有者が受益を得るようになります。

### [hideBuyAlert](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#hidebuyalert)

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

プレイヤーの購入ウィジェットを閉じます。

### [sendMessage](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#sendmessage)

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

ユーザー個人にチャットメッセージを送信する関数です。

### [showPrompt](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#showprompt)

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

プレイヤーに入力ウィンドウを表示し、プレイヤーの応答により動作するcallback関数を作成できます。

### [showConfirm](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#showconfirm)

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

プレイヤーに確認ウィンドウを表示し、プレイヤーOKをクリックすると動作するcallback関数を作成できます。cancelをクリックした場合にはcallback関数が動作しません。

### [showAlert](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#showalert)

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

プレイヤーに警告ウィンドウを表示し、プレイヤーOKをクリックすると動作するcallback関数を作成できます。

### [showWidgetResponsive](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#showwidgetresponsive)

{% hint style="info" %}

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

{% endhint %}

ウィジェットの上下左右の余白を画面サイズに対する割合(％)で定義し、ウィジェットを表示します。

画面サイズが余白を含んだウィジェット領域より小さい場合、ウィジェットのサイズも縮小されます。

### [openWebLink](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#openweblink)

{% hint style="info" %}
player.openWebLink(url:string, popup:boolean=false)
{% endhint %}

プレイヤーにWeb URLを新規タブやポップアップで表示します。

### [showEmbed](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#showembed)

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

当該プレイヤーに指定されたalignの位置にURL埋め込み画面を表示する関数です。

### [showImageModal](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#showimagemodal)

{% hint style="info" %}
player.showImage(url: string)
{% endhint %}

入力したイメージアドレスに当該するイメージをプレイヤーに表示します。

### [showNoteModal](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#shownotemodal)

{% hint style="info" %}
player.showNoteModal(text: string)
{% endhint %}

プレイヤーにテキストウィンドウを表示する関数です。

### [isEmail](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#isemail)

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

当該プレイヤーのメールアドレスがパラメータデータと一致する場合True、一致しない場合Falseを返します。

### [getLocationName](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#getlocationname)

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

プレイヤーが現在位置している、領域指定機能により指定した場所名を出力します。

### [spawnAt](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#spawnat)

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

プレイヤーのアバターを指定した方向を向いた状態でtileX、tileY座標に移動させます。

### [spawnAtLocation](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#spawnatlocation)

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

プレイヤーのアバターを領域指定機能を使用した「name」と名付けた位置に向いている状態で移動させます。

### [spawnAtMap](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#spawnatmap)

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

プレイヤーを当該スペースの当該マップに移動させます。

### [setCameraTarget](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#setcameratarget)

{% hint style="info" %}
**\[1]** player.setCameraTarget( tileX: Number, tileY: Number, time: Number )

**\[2]** player.setCameraTarget( key: String, time: Number )
{% endhint %}

**\[1]** プレイヤーの視点を指定した座標へ移動させます。

**\[2]** プレイヤーの視点を特定オブジェクトへ移動させます。

### [setEffectSprite](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#seteffectsprite)

{% hint style="info" %}
player.setEffectSprite(resource: ScriptDynamicResource, offsetX: Number, offsetY: Number, type: Number)
{% endhint %}

プレイヤーの背景または前景イメージを設定できます。

### [playSound](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#playsound)

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

当該プレイヤーにサウンドを再生する関数です。

### [playSoundLink](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#playsoundlink)

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

全プレイヤーにサウンドを再生する関数です。

### [sendUpdated](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#sendupdated)

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

App、Player関連フィールドのデータが変更された場合、変更されたデータを適用する関数です。

### [save](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptplayer/methods.md#save)

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

App、Player storageのデータが変更された場合、変更されたデータを適用する関数です。

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

## 🧙‍♂️ ScriptWidget&#x20;

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

## 🗃️ Field

### [id](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptwidget/field.md#id)

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

ウィジェットのIDデータを取得します。

## 🛰️ EventListeners

### [onMessage](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptwidget/event-listeners.md#onmessage)

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

ウィジェットでAppにメッセージを送るとcallback関数が動作します。

## 💠 Methods

### [sendMessage](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptwidget/methods.md#sendmessage)

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

Appでウィジェットにデータを送信します。

### [destroy](/zep-guidebook-jp/zep-script-api/zepscriptapi/scriptwidget/methods.md#destroy)

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

ウィジェットを削除する関数です。

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

## 🔩 Utility Class&#x20;

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

## ⏳ Time

### [getTime](/zep-guidebook-jp/zep-script-api/zepscriptapi/utilityclass/time.md#gettime)

{% hint style="info" %}
Time.getTime()
{% endhint %}

ZEPサーバーの現在時間をmilliseconds単位のデータで返します。

### [getUtcTime](/zep-guidebook-jp/zep-script-api/zepscriptapi/utilityclass/time.md#getutctime)

{% hint style="info" %}
Time.getUtcTime()
{% endhint %}

現在のUTC時間をmilliseconds単位のデータで返します。

### [getTimeInterval](/zep-guidebook-jp/zep-script-api/zepscriptapi/utilityclass/time.md#gettimeinterval)

{% hint style="info" %}
Time.getTimeInterval(timeA: number, timeB: number, returnType: DateType)
{% endhint %}

`timeB - timeA`を計算し、その結果を指定した`returnType`で返します。
