Forum


Notifications
Clear all

MCPE/Bedrock Scoreboard API (ScoreAPI)

McBedrock
(@mcbedrock1)
Illustrious Member Admin

Scoreboard API (ScoreAPI)

 

This behavior pack extends the capabilities of the scoreboard command. You can perform calculations over coordinates, player’s level and game mode. The behavior pack uses smart algorithms, so there is high performance

 

Documentation

First you need to declare objectives x, y, z, ry, rx, level, mode and temp. This is easy to do by entering the command /function scoreapi_init. What are these objectives for?

  • x, y, z — the main coordinates of the player
  • ry, rx — the coordinates of the player’s head rotation. ry — horizontal rotation, from –180 to 180. rx — vertical rotation, from –90 to 90.
  • level — the player’s level
  • mode — the player’s gamemode
  • temp — a temporary objective used in some functions. Changing its value will not have any effect

The syntax of the functions

Functions starting with save_ save the values of the player’s properties to the objectives. For example, function save_level saves the player’s level to the level objective.

Functions starting with set_ set the player’s properties by taking values from objectives.

Functions starting with tp_ teleport the player using objectives x, y, z, or ry, rx. For example, function tp_x teleports the player to the x objective. tp_xyz teleports the player to the x, y, z objectives. “” in the function name means ~ (relative). So tp_-xy means “tp ~x y“, tp_-x-y-z means “tp ~x ~y ~z“, etc.

Functions

There are 65 functions (8 private, 3 system and 51 usable. Usable functions:

  • scoreapi_init — initiates objectives x, y, z, ry, rx, level, mode and temp
  • scoreapi_remove — removes objectives
  • scoreapi_help — outputs information about the functions
  • save_? — saves ? to the objectives. Examples: save_xy (saves x and y coordinates), save_rx (saves rx coordinate), save_mode (saves gamemode)
  • save_all — saves all the coordinates (x, y, z, ry, rx). This function does not save the level and gamemode!
  • tp_? — teleports the player to ? coordinates. Examples: tp_xz (teleports to x and z), tp_x-yz (teleports to x, ~y and z), tp_-ry (teleports to ~ry)
  • tp_all — teleports the player to all the coordinates (x, y, z, ry and rx)
  • set_mode — sets the player’s gamemode
  • set_level — sets the player’s level
  • add_levels — adds levels to the player’s level (supports negative values)
  • remove_levels — removes levels from the player’s level (supports negative values)
  • clear_level — sets the player’s level to 0
  • look_xyz — turns the player to the x, y, z coordinates

Notes

  • When setting the player level, the sound is not played; this was done on purpose. To fix this, do /playsound random.levelup @s ~ ~ ~ 0.75 1
  • I don’t recommend using functions too often (every tick), because they contain “complex” processes (however, I haven’t tried)
  • Maximum values: x, z, ry, rz  16777216, level — 24791, mode — 2.
  • You can use my addon in your own projects and edit the functions for your purposes

 

Thank you for using my addon! If you find any bug or error in the text, write in the comments.

creator: coolomet

Downloads

Quote
Topic starter Posted : 23/08/2020 12:22 pm
Share: