Field

Introduction

Field contains the attributes of an app. With these fields, you can view the Space, maps, or user information, or you can store values for later.

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

NameDescription

🔒 spaceHashID

Outputs the hash value of the Space where the app is installed

🔒 mapHashID

Outputs the hash value of the map where the app is installed

🔒 creatorID

Calls the ID value of the player who executed the app

🔒 players

Calls a list of all players on the map as an array

🔒 playerCount

Calls the number of all players on the map where the app is installed

cameraEffect

Variable value to set the type of camera effect

cameraEffectParam

Range value of camera effect

displayRatio

Value to control display zooming

storage

App value storage space in the Space (Space limited)

followPlayer

Determines if the app’s follow function is enabled

showName

Determines if the player's nickname is hidden

🔒 appHashID

Calls the hash value of the app

📚 API Description and Example

spaceHashID & mapHashID

App.spaceHashID: String App.mapHashID: String

This calls spaceHashID and mapHashID of the Space where an app is installed. (Understanding Spaces and Maps)

Example

Display spaceHashID and mapHashID of the map where an app is installed.

// Activates function when a player enters
App.onJoinPlayer.Add(function(player){
  // Displays spaceHashID and mapHashID in the chat window
	App.sayToAll(`spaceHashID: ${App.spaceHashID}`); // spaceHashID: Ak42Xz
	App.sayToAll(`mapHashID: ${App.mapHashID}`) // mapHashId: 25g3RQ
})

creatorID

App.creatorID: Number

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

Example

Display the nickname of the player who executed the app.

// Activates function when a player enters
App.onJoinPlayer.Add(function(player){
  if(player.id == App.creatorID){
		App.sayToAll(`${player.name} has executed the app.`)
	}
})

players

App.players: ScriptPlayer[]

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

Example

Display the nicknames of all players on the map.

// Activates function when q is pressed
// App.addOnKeyDown
App.addOnKeyDown(81,function(p){
	//Displays the nicknames of all players in the chat window via App.players
	let players = App.players;
	for(let i in players){
		let player = players[i]
		App.sayToAll(player.name)
	}
})

playerCount

App.playerCount: Number

This calls the number of all players on the map where the app is installed

Example

Display the number of all players on the map.

// Activates function when q is pressed
// App.addOnKeyDown
App.addOnKeyDown(81,function(p){
	// Displays the number of all current players
	App.sayToAll(`the number of all current players: ${App.playerCount}`)
})

cameraEffect & cameraEffectParam1

App.cameraEffect: NONE = 0, SPOTLIGHT = 1 App.cameraEffectParam1: Number

App.cameraEffect: variable value to set the type of camera effect

App.cameraEffectParam1: range value of camera effect

Example

Make a function to turn the vignette effect on/off.

// Activates function when q is pressed
// Press once to turn the vignetting on and press twice to turn off
// App.addOnKeyDown
App.addOnKeyDown(81,function(p){
	if(App.cameraEffect == 0){
		App.cameraEffect = 1; // 1 = vignette effect
		App.cameraEffectParam1 = 500; // Sets the range of the vignette effect to 500
	}
	else if(App.cameraEffect == 1){
		App.cameraEffect = 0; // Turns off the vignette effect
	}
	App.sendUpdated(); // When the app's Field Value is changed, new values are applied using App.sendUpdated()
})

displayRatio

App.displayRatio: Number

Value to control display zooming (default value: 1)

Example

Bind a zoom function to q to control display zooming.

// Activates function when q is pressed
// Press once to zoom in and press twice to return to the original state
// App.addOnKeyDown
App.addOnKeyDown(81,function(p){
	if(App.displayRatio == 1){
		*App.displayRatio = 5;*
	}else{
		*App.displayRatio = 1;
	}
	App.sendUpdated(); //* When the app's Field Value is changed, new values are applied using App.sendUpdated()
})

storage

App.storage: String

App value storage space in the Space (Space limited)

Example

Save a simple text to App storage.

Saved values don’t disappear even though the app ends

// Activates function when q is pressed
// App.addOnKeyDown
App.addOnKeyDown(81,function(p){
	App.storage = "data";
	App.save(); // When the storage value is changed, new values are applied using App.save()
})

// Activates function upon pressing w
App.addOnKeyDown(87,function(p){
	App.sayToAll(App.storage); // Displays the value stored in App storage to the chat window
})

followPlayer

App.followPlayer: Boolean

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

When normal apps or Mini-Game apps are running, the “follow” function becomes deactivated as followPlayer value is set to false.

Example

Make a function to turn the follow function on or off.

// Activates function when q is pressed
// Key function that changes the followPlayer value
// App.addOnKeyDown explanation 
App.addOnKeyDown(81,function(p){
	if(App.followPlayer){
		App.followPlayer = false;
	}else{
		App.followPlayer = true;
	*}*
	App.sayToAll(`App.followPlayer: ${App.followPlayer}`)
	*App.sendUpdated(); //* When the app's Field Value is changed, new values are applied using App.sendUpdated()
})

showName

App.showName: Boolean

This shows whether the player's nickname is hidden.

When App.showName is set to false, the nickcnames of all players are hidden.

Example

// Activates function when q is pressed
// Key function that changes the showName value
App.addOnKeyDown(81,function(p){
	if(App.showName){
		App.showName = false;
	}else{
		App.showName = true;
	}
	App.sayToAll(`App.showName: ${App.showName}`)
	App.sendUpdated(); //When the app's Field Value is changed, new values are applied using App.sendUpdated()
})

appHashID

App.appHashID: String

This calls the hash value of the app

Example

Display the app's HashID to the chat window.

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

Appendix

Understanding Spaces and Maps

Last updated