<aside> ๐Ÿ’ก ScriptApp โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” ZEP Script๋กœ ๋งŒ๋“œ๋Š” App์„ ๊ด€์žฅํ•˜๋Š” Coreํ•œ ํด๋ž˜์Šค๋กœ, ๋‹ค์–‘ํ•œ ํ•จ์ˆ˜์™€ ํ•„๋“œ๋ฅผ ๊ฐ–๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

</aside>

Fields


๋ชจ๋“  App์— ์กด์žฌํ•˜๋Š” ํ•„์ˆ˜์ ์ธ ํ•„๋“œ๊ฐ’์ž…๋‹ˆ๋‹ค. Script์—์„œ ๋ฐ”๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ด๋ฆ„ ํƒ€์ž… ์„ค๋ช…
App.worldHashID String App์ด ์„ค์น˜๋œ ์ŠคํŽ˜์ด์Šค์˜ ํ•ด์‰ฌ๊ฐ’์„ ์ถœ๋ ฅ (Read Only)
App.mapHashID String App์ด ์„ค์น˜๋œ ๋งต์˜ ํ•ด์‰ฌ๊ฐ’์„ ์ถœ๋ ฅ (Read Only)
App.players ScriptPlayer[] ๋งต์— ์žˆ๋Š” ๋ชจ๋“  ํ”Œ๋ ˆ์ด์–ด ๋ฆฌ์ŠคํŠธ๋ฅผ ์ถœ๋ ฅ (Read Only)
App.playerCount Number ๋งต์— ์žˆ๋Š” ๋ชจ๋“  ํ”Œ๋ ˆ์ด์–ด์˜ ์ˆ˜๋ฅผ ์ถœ๋ ฅ (Read Only)
App.cameraEffect NONE = 0
SPOTLIGHT = 1 NONE : ์•„๋ฌด ํšจ๊ณผ ์—†์Œ
SPOTLIGHT : ๋น„๋„คํŒ… ํšจ๊ณผ ์ ์šฉ
App.cameraEffectParam1 Number cameraEffect๊ฐ€ NONE์ด ์•„๋‹ ๊ฒฝ์šฐ์˜ ์ƒํƒœ๊ฐ’ : ํด์ˆ˜๋ก ์˜์—ญ์ด ์ปค์ง„๋‹ค.
App.storage String ์ŠคํŽ˜์ด์Šค ๋‚ด์˜ App ๊ฐ’ ์ €์žฅ๊ณต๊ฐ„(์ŠคํŽ˜์ด์Šค ํ•œ์ •)

Lifecycle


App์˜ ์ƒ์• ์ฃผ๊ธฐ๋ฅผ ๊ด€๋ฆฌํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค. onInit๋ถ€ํ„ฐ onDestroy๊นŒ์ง€์˜ ์ƒ์• ์ฃผ๊ธฐ์— ๋งž๊ฒŒ App์„ ๋งŒ๋“ค์–ด๋ณด์‹ญ์‹œ์˜ค.

์ ญ์Šคํฌ๋ฆฝํŠธ ๋ผ์ดํ”„์‚ฌ์ดํด.png

Good to know: function()์˜ ๊ด„ํ˜ธ ์•ˆ์— ํŒŒ๋ผ๋ฏธํ„ฐ๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ, ๋ฐ˜๋“œ์‹œ ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ์จ์ค˜์•ผํ•˜๋ฉฐ ํ•จ์ˆ˜ ์•ˆ์—์„œ ์ง€์—ญ ๋ณ€์ˆ˜๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํŒŒ๋ผ๋ฏธํ„ฐ ์ด๋ฆ„์€ ์ž„์˜๋กœ ๋ณ€๊ฒฝ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ํŒŒ๋ผ๋ฏธํ„ฐ ์˜ˆ์‹œ - player, dt

// App ์‹คํ–‰ ์‹œ์— ์ตœ์ดˆ๋กœ ํ˜ธ์ถœ๋˜๋Š” ์ด๋ฒคํŠธ (์œ ์ € ์ง„์ž… ์ „)
// Normal App๊ณผ Sidebar App์€ Script ์ ์šฉ ํ›„ ๋งต์ด ์‹คํ–‰๋  ๋•Œ ํ˜ธ์ถœ
App.onInit.Add(function(){
});

// ๋ชจ๋“  ํ”Œ๋ ˆ์ด์–ด๋ฅผ ์ด ์ด๋ฒคํŠธ๋ฅผ ํ†ตํ•ด App์— ์ง„์ž…์‹œํ‚ด
App.onJoinPlayer.Add(function(player) {
});

// ํ”Œ๋ ˆ์ด์–ด ๋ชจ๋‘ ์ง„์ž… ์‹œ ์ตœ์ดˆ๋กœ ์‹œ์ž‘๋˜๋Š” ์ด๋ฒคํŠธ
App.onStart.Add(function(){
});

// 20ms ๋งˆ๋‹ค ํ˜ธ์ถœ๋˜๋Š” ์ด๋ฒคํŠธ
// dt: deltatime(์ „ ํ”„๋ ˆ์ž„์ด ์™„๋ฃŒ๋˜๊ธฐ๊นŒ์ง€ ๊ฑธ๋ฆฐ ์‹œ๊ฐ„)
App.onUpdate.Add(function(dt){
});

// ์ด๋ฒคํŠธ ์ฝœ๋ฐฑ ์ฒ˜๋ฆฌ ํ›„ ๋‹ค์‹œ onUpdate

// App ์ข…๋ฃŒ ์‹œ ๋ชจ๋“  ํ”Œ๋ ˆ์ด์–ด๋ฅผ App์—์„œ ๋‚˜๊ฐ€๊ฒŒ ํ•จ
App.onLeavePlayer.Add(function(player){
});

// App ์ข…๋ฃŒ ์‹œ ๋งˆ์ง€๋ง‰์œผ๋กœ ํ˜ธ์ถœ
// Normal App๊ณผ Sidebar App์€ ๋ณ„๋„์˜ ์ข…๋ฃŒ
App.onDestroy.Add(function(){
});

Event Listeners


ํŠน์ • ์ƒํ™ฉ์ด๋‚˜ ์œ ์ €์˜ ํ–‰๋™์— ๋ฐ˜์‘ํ•˜์—ฌ ์ž๋™์œผ๋กœ ํ˜ธ์ถœ๋˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

์ด๋ฆ„ ํƒ€์ž… ์„ค๋ช…
player scriptPlayer ํ”Œ๋ ˆ์ด์–ด ์ž์‹ 
text String ์ž…๋ ฅ ๋˜๋Š” ์ถœ๋ ฅํ•  ํ…์ŠคํŠธ
sender scriptPlayer ํ–‰๋™์˜ ์ฃผ์ฒด๊ฐ€ ๋˜๋Š” ํ”Œ๋ ˆ์ด์–ด
target scriptPlayer ํ–‰๋™์˜ ๊ฐ์ฒด๊ฐ€ ๋˜๋Š” ํ”Œ๋ ˆ์ด์–ด
x Number ์ถฉ๋Œ ๋˜๋Š” ํ˜„์ƒ์ด ์ผ์–ด๋‚œ ์œ„์น˜์˜ X ์ขŒํ‘œ
y Number ์ถฉ๋Œ ๋˜๋Š” ํ˜„์ƒ์ด ์ผ์–ด๋‚œ ์œ„์น˜์˜ Y ์ขŒํ‘œ
tileID Number ํƒ€์ผ ID