I assume, based on your previous question, that you want the number of affected armor stands stored on the player. For that there is no need for CommandStats or /tp. You simply need to ensure the commands are activated in the correct order for a /fill clock (see here for a tutorial that covers activation order via /fill).
Otherwise, the set of commands is essentially the same as those in your previous question, albeit adding instead of setting to mimic CommandStats.
Prerequisites:
Objective to state how many armor stands were near the player.
/scoreboard objectives add ASNum dummy
Clock commands:
The following must be run in numerical order on a clock.
Reset the player's ASNum score to a default of 0.
/scoreboard players set @a ASNum 0
Cause armor stands around the player to increase their "ASNum" score by 1. This causes the player's score to be equal to the number of armor stands around them, rather than always 1, to mimic CommandStats.
/execute @e[type=ArmorStand] ~ ~ ~ scoreboard players add @a[r=10] ASNum 1
Players with an ASNum score of 0 would be those not within 10 blocks of an armor stand. Players with a score of 1 or higher will have that many armor stands around them.
/say @a[score_ASNum=0] had no armor stands near them.
/say @a[score_ASNum_min=1] has at least 1 armor stand near them.
/say @a[score_ASNum_min=10] has at least 10 armor stands near them.
This solution is really resource intensive, there may be a better one!
Actually i just simplified the problem to 2D, here's a working solution for 3D:
Once:
/scoreboard objectives add dir dummy
/summon ArmorStand ~ ~5 ~ {NoGravity:1b,CustomName:"move"}
Repeat:
/scoreboard players set @e[type=ArmorStand,name=move] dir 0
/execute @e[type=ArmorStand,name=move,score_dir=0] ~1 ~ ~ summon ArmorStand ~ ~ ~ {NoGravity:1b,CustomName:"move"
/execute @e[type=ArmorStand,name=move,score_dir=0] ~1 ~ ~ scoreboard players set @e[type=ArmorStand,name=move,r=0,c=-1] dir 1
/execute @e[type=ArmorStand,name=move,score_dir=0] ~ ~1 ~ summon ArmorStand ~ ~ ~ {NoGravity:1b,CustomName:"move"}
/execute @e[type=ArmorStand,name=move,score_dir=0] ~ ~1 ~ scoreboard players set @e[type=ArmorStand,name=move,r=0,c=-1] dir 2
/execute @e[type=ArmorStand,name=move,score_dir=0] ~ ~ ~1 summon ArmorStand ~ ~ ~ {NoGravity:1b,CustomName:"move"}
/execute @e[type=ArmorStand,name=move,score_dir=0] ~ ~ ~1 scoreboard players set @e[type=ArmorStand,name=move,r=0,c=-1] dir 3
/execute @e[type=ArmorStand,name=move,score_dir=0] ~-1 ~ ~ summon ArmorStand ~ ~ ~ {NoGravity:1b,CustomName:"move"}
/execute @e[type=ArmorStand,name=move,score_dir=0] ~-1 ~ ~ scoreboard players set @e[type=ArmorStand,name=move,r=0,c=-1] dir 4
/execute @e[type=ArmorStand,name=move,score_dir=0] ~ ~-1 ~ summon ArmorStand ~ ~ ~ {NoGravity:1b,CustomName:"move"}
/execute @e[type=ArmorStand,name=move,score_dir=0] ~ ~-1 ~ scoreboard players set @e[type=ArmorStand,name=move,r=0,c=-1] dir 5
/execute @e[type=ArmorStand,name=move,score_dir=0] ~ ~ ~-1 summon ArmorStand ~ ~ ~ {NoGravity:1b,CustomName:"move"}
/execute @e[type=ArmorStand,name=move,score_dir=0] ~ ~ ~-1 scoreboard players set @e[type=ArmorStand,name=move,r=0,c=-1] dir 6
/execute @e[type=ArmorStand,name=move,score_dir=0] ~ ~ ~ kill @e[type=ArmorStand,name=move,r=0,score_dir_min=1]
/execute @e[type=ArmorStand,name=move,score_dir=1] ~ ~ ~ kill @e[type=ArmorStand,name=move,r=0,score_dir_min=2]
/execute @e[type=ArmorStand,name=move,score_dir=2] ~ ~ ~ kill @e[type=ArmorStand,name=move,r=0,score_dir_min=3]
/execute @e[type=ArmorStand,name=move,score_dir=3] ~ ~ ~ kill @e[type=ArmorStand,name=move,r=0,score_dir_min=4]
/execute @e[type=ArmorStand,name=move,score_dir=4] ~ ~ ~ kill @e[type=ArmorStand,name=move,r=0,score_dir_min=5]
/execute @e[type=ArmorStand,name=move,score_dir=5] ~ ~ ~ kill @e[type=ArmorStand,name=move,r=0,score_dir_min=6]
Best Answer
Easiest way would be to fiddle with
execute
's vertical offset untilr=2
only selects the 8 you want:By placing the start of the spherical selection further up, you can avoid selecting the further away ones that you don't want to select.
A side view of this will look something like:
Alternatively, you can use the
dy, dx, dz
cuboid volume selectors, again with an initial offset:Which looks like this: