• Hey! Register here to create your account, engage with the community, and talk about what is new!

Thorough Guide to Select Object

RDM

Member
Overlord
Joined
Sep 6, 2020
Messages
36
Reaction score
22
Hi y'all. Select object is quite niche in terms of where it can be applied, but it is still nonetheless required in those situations. SelObj brings an extensive amount of clarification to your code when it is most needed, which makes it an important addition to your Batman coding utility belt! This guide will show you the ins-and-outs of Select Object, and provide some of its applications and purposes as well.

Part 1: How to Use Select Object

1600380638306.png

Select Object is an efficient way of targeting specific entities and/or players through direct means or through conditional statements. The "target" is whatever or whoever the code is applying to, be it an entity, player, or neither (in which case there would be no target). There can also be multiple targets, depending on which selector you are using. Some SelObj selectors require no parameters, while others require one or more. Here is a list of all the Select Object selectors, including the amount of parameters each of them have.

Select Nothing (0 Chest Parameters)
Select Default Player (0 Chest Parameters)
Select Default Entity (0 Chest Parameters)
Select Random Player (0 Chest Parameters)
Select Random Mob (0 Chest Parameters)
Select Random Entity (0 Chest Parameters)
Select All Players (0 Chest Parameters)
Select All Mobs (0 Chest Parameters)
Select All Entities (0 Chest Parameters)
Select Last-Spawned Mob (0 Chest Parameters)
Select Last-Spawned Entity (0 Chest Parameters)
Select Killer (0 Chest Parameters)
Select Select Damager (0 Chest Parameters)
Select Shooter (0 Chest Parameters)
Select Projectile (0 Chest Parameters)
Select Victim (0 Chest Parameters)

Select Player by Name (1 Chest Parameter)
Select Mobs by Name (1 Chest Parameter)
Select Entities by Name (1 Chest Parameter)
Filter Selection Randomly (1 Chest Parameter)

Filter Selection by Distance (2 Chest Parameters)
Select Players by Condition (Conditional)
Select Mobs by Condition (Conditional)
Select Entities by Condition (Conditional)
Filter Selection by Condition (Conditional)


Part 2: How to Apply Select Object

Select Object is relatively easy to apply in your code. The default target for your code is None, which it does not mean what it implies. Code without a target will still run normally, as if you had never changed anything in the first place. That means, in the majority of cases, code with no target will target the Default player or entity ("Default" is whoever activated the line of code). When you select an object, that selection will remain the same unless changed until the entire thread (including functions) has been read, with the exception of processes (See: Processes Guide).

1600383752455.png

Part 3: Applications of Select Object

Select Object has many uses in complicated constructions, including, but not limited to, queue systems, game starts, random player selections, and long lines of code including the targeting of multiple entities and/or players.



Note: Another similar feature is the Player and Entity Action Targets. They contain similar target selectors (not nearly as many though), but I don't use these very often for three reasons. You're still welcome to use this form of selection targeting, but here are my reasons as to why I don't use them.

1) They can only be used in Action code blocks, making them ultimately less flexible than their Select Object counterparts.

2) They change the target only during the one instance, so if I wanted to select an object for a sustained period of time, I would need to input the target for each and every action code block. That's all fine and dandy if I need only need 1 instance to begin with, but I tend not to use these for more than one or two actions, otherwise I risk forgetting to input the selector which would likely cause something to not work properly.

3) They don't offer as many selector options, so sometimes it feels like more of a hassle than a benefit to use them. There's a caveat to this though, in the form of the "Current Selection" target, shown as the nether star in the Player and Entity Action Target GUIs shown below. That's nice and all, but it's still more of a hassle to use these to a greater extent than for one or two actions, as explained in 2).

1600380038171.png
1600380153640.png
 
Last edited:

RyanLand

Active member
Overlord
Joined
Sep 6, 2020
Messages
59
Reaction score
38
Probably worth to mention that if multiple objects are selected at once, the code will run for every object.

I've seen enough people that had a SetVar:Increment after a SelObj asking why it increased more than said.
 
  • Like
Reactions: RDM

HellishBro

Active member
Joined
Nov 11, 2022
Messages
42
Reaction score
3
Probably worth to mention that if multiple objects are selected at once, the code will run for every object.

I've seen enough people that had a SetVar:Increment after a SelObj asking why it increased more than said.
im like 3 years late, but exactly what actions can run more than once for each selector in the selection? theres player / entity actions, and probably a lot more that i dont know
 
Top Bottom