Editing
Target selectors
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Target selector variables == {| class="floatright wikitable" style="clear:none;margin-left:1em;" |+ Summary of target selector variables ! Variable !! Selects |- | <code>@p</code> || the nearest player |- | <code>@r</code> || a random player |- | <code>@a</code> || all players |- | <code>@e</code> || all entities |- | <code>@s</code> || the entity executing the command |- | <code>@c</code> || the player's agent{{only|education}} |- | <code>@v</code> || all agents{{only|education}} |- | <code>@initiator</code> || the player who clicks an [[NPC]] [[dialogue]] button{{only|bedrock|education|short=1}} |} A target selector variable identifies the broad category of targets to select. There are five (six {{in|bedrock}}, eight {{in|edu}}) variables: ; <code>@p</code> : Selects the nearest player from the command's execution. If there are multiple nearest players, caused by them being precisely the same distance away, the player who most recently joined the server is selected. : {{IN|Bedrock}}, <code>@p</code> only selects players who are alive. ; <code>@r</code> : Selects a random player. : {{el|Bedrock}} can use <code>@r</code> to select non-player entities via the <code>type</code> selector argument; {{in|java}}, to select a random entity, use <code>@e[sort=random]</code> instead. : {{IN|Bedrock}}, <code>@r</code> can only select entities who are alive. ; <code>@a</code> : Selects every player, alive or not. ; <code>@e</code> : Selects all alive entities (including players) in loaded chunks. ; <code>@s</code> : Selects the entity (alive or not) that executed the command. It does not select anything if the command was run by a command block or server console. ; <code>@c</code>{{only|education}} : Selects the player's agent only. ; <code>@v</code>{{only|education}} : Selects all agents. Works only if more than one agent exists. ; <code>@initiator</code>{{only|bedrock}} : Selects the player who interacts with a button in a JSON [[NPC]] [[dialogue]].
Summary:
Please note that all contributions to Kiiw may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Kiiw:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information