Selectors in "with" save their value for that specific command
Steps to Reproduce:
1. Create a function tagged in "minecraft:tick".
2. Write in the created function:
execute as @a[tag=bug] run title @a title {"translate":"death.attack.generic","with":[{"selector":"@s"}]}
What I expected to happen was...:
For 1st selector: "(1) died"
For 2nd selector: "(2) died"
What actually happened was...:
For 1st selector: "(1) died"
For 2nd selector: "(1) died"
The video showing this:
https://youtu.be/4OqGOJprpGA
If you don't use the function tagged in "minecraft:tick", it will work fine:
https://youtu.be/YOSgsir7AJw
Created Issue:
Selectors save its value in "ticked" functions
Steps to Reproduce:
1. Create a function tagged in "minecraft:tick".
2. Write in the created function:execute as @a[tag=bug] run title @a title {"translate":"death.attack.generic","with":[{"selector":"@s"}]}What I expected to happen was...:
For 1st selector: "(1) died"
For 2nd selector: "(2) died"What actually happened was...:
For 1st selector: "(1) died"
For 2nd selector: "(1) died"The video showing this:
https://youtu.be/4OqGOJprpGA
Selectors in "with" save its value in "ticked" functions
Selectors in "with" save its value in"ticked"functionsSelectors in "with" save its value in functions tagged in "minecraft:tick"
Steps to Reproduce:
1. Create a function tagged in "minecraft:tick".
2. Write in the created function:execute as @a[tag=bug] run title @a title {"translate":"death.attack.generic","with":[{"selector":"@s"}]}What I expected to happen was...:
For 1st selector: "(1) died"
For 2nd selector: "(2) died"What actually happened was...:
For 1st selector: "(1) died"
For 2nd selector: "(1) died"The video showing this:
https://youtu.be/4OqGOJprpGAIf you don't use the function tagged in "minecraft:tick", it will work fine:
https://youtu.be/YOSgsir7AJw
Selectors in "with" saveitsvalue in functions tagged in "minecraft:tick"Selectors in "with" save their value in functions tagged in "minecraft:tick"
Selectors in "with" save their valuein functions tagged in "minecraft:tick"Selectors in "with" save their value for that specific command
relates to
You have to do:
title @a title {"translate":"death.attack.generic","with":[{"selector":"@a[tag=bug]"}]}for the command to work as expected. The @a selector changes the executing entity, basically overwriting the previous "as @a[tag=bug]". @s uses the currently selected entity, which in this case is now @a and not @a[tag=bug]. Doing:
execute as @a[tag=bug] run title @s title {"translate":"death.attack.generic","with":[{"selector":"@s"}]}will not work since I'm assuming you want all players to see a title with the name of another player that died.
«The @a selector changes the executing entity»
It should not work like this.
If you don't use the function tagged in "minecraft:tick", it will work fine:
https://youtu.be/YOSgsir7AJw
Confirmed for 18w14b.
No need to comment with new versions if you can just update it yourself.
I ran
/execute as @e[type=armor_stand] run tellraw @a {"translate":"death.attack.generic","with":[{"selector":"@s"}]}in chat with 2 armor stands in loaded chunks, both with a different name. Both messages used the same entity.
Seems related to
MC-124241This tickets is invalid; sorry for the very late realization.
If there’s 2 players selected by tag=bug, the second player will send their title to everyone, overwriting previous titles.
For the valid cases, see the related ticket.