Skip to content

Entity Selectors

Shiny Bunny edited this page May 2, 2020 · 3 revisions

The entity selectors in DPScript let you, just like in vanilla minecraft commands, select entities using some parameters. But in DPScript, the selector syntax has been tweaked and improved so writing those selectors is much easier and much more readable.

Here is a simple example of selecting all armor stands in the world:

Vanilla: @e[type=armor_stand]

DPScript: @armor_stand

As you can probably guess, entity types can be written right after the @ to shorten the selector expression.

Selector Parameters

So just like in vanilla minecraft, after the target selector (@a, @e, @s..) comes a list of parameters surrounded in square brackets. In DPScript, it works the same, but is much simpler and has a bunch of convenient shorthands.

Ranges

In minecraft, a range value is expressed in the format of <min?>..<max?> (for example, ..45 is all values that are 45 or less) In DPScript, you can just compare the value to the parameter name.

For example - selecting players by their xp level:

@a[level=30..] => @a[level >= 30]

It's undoubtedly much more readable.

Scores

Selecting entities with a specific objective value in minecraft is done usually like this: @a[scores={myObj=1..}]

But in DPScript, you can just write @a[myObj > 0] - as long as the myObj objective is declared. For more info about declaring objectives, see Objectives.

Parameter Reference

  • distance: double range
  • level: int range
  • pitch (x_rotation): double range
  • yaw (y_rotation): double range
  • name: string
  • tag: identifier - can be used multiple times, or just use tags
  • tags: identifier list
  • limit: int
  • more coming soon

Selector Usage

See Selector Usage

Clone this wiki locally