Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-117596

[Advise] Excutor should CHANGE when using /execute PLAYER ~ ~ ~ function FUNCTION

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • Minecraft 1.12 Pre-Release 3
    • None
    • Windows 10, Java 8
    • Unconfirmed
    • Creative

      In the latest version 1.12 Pre-Release 3. the Function system changed a lot. one of those changes is:

      Technical: Functions should recurse as expected, even whilst mixing /function and /execute

      which means using "execute" commands will NOT change executor.

      For example, there's a function file like this.

      system:say

      say 1
      say 2
      

      Then when a player named PLR run this function, he'll get feedback like this:

      [PLR] 1
      [PLR] 2
      

      If he run this in a command block with{{execute PLR ~ ~ ~ function system:say}}, he'll get feedback like this:

      [@] 1
      [@] 2
      

      What I expected is:

      [PLR] 1
      [PLR] 2
      

      This is very important. For the example above, you may not see how it affects system running. but what if you put lots of arguments in Target Selector?

      See this example plz.
      First, there's a scoreboard-objective named "RandomText" as dummy.
      and run these commands every tick.

      scoreboard players add @a RandomText1
      
      #for players who reach a score of 1200(60 sec), he will see a random number (1 to 5)
      execute @a[score_RandomText_min=1200] ~ ~ ~ summon area_effect_cloud ~ ~ ~ {Tags:["RndText","RndText1"]}
      execute @a[score_RandomText_min=1200] ~ ~ ~ summon area_effect_cloud ~ ~ ~ {Tags:["RndText","RndText2"]}
      execute @a[score_RandomText_min=1200] ~ ~ ~ summon area_effect_cloud ~ ~ ~ {Tags:["RndText","RndText3"]}
      execute @a[score_RandomText_min=1200] ~ ~ ~ summon area_effect_cloud ~ ~ ~ {Tags:["RndText","RndText4"]}
      execute @a[score_RandomText_min=1200] ~ ~ ~ summon area_effect_cloud ~ ~ ~ {Tags:["RndText","RndText5"]}
      #select a random marker to execute "tellraw" command
      execute @a[score_RandomText_min=1200] ~ ~ ~ entitydata @r[r=0,type=area_effect_cloud,tag=RndText] {CustomName:"RndColor"}
      #tellraw commands
      execute @e[type=area_effect_cloud,name=RndColor,tag=RndText1] ~ ~ ~ tellraw @a[r=0,c=1] ["1"]
      execute @e[type=area_effect_cloud,name=RndColor,tag=RndText2] ~ ~ ~ tellraw @a[r=0,c=1] ["2"]
      execute @e[type=area_effect_cloud,name=RndColor,tag=RndText3] ~ ~ ~ tellraw @a[r=0,c=1] ["3"]
      execute @e[type=area_effect_cloud,name=RndColor,tag=RndText4] ~ ~ ~ tellraw @a[r=0,c=1] ["4"]
      execute @e[type=area_effect_cloud,name=RndColor,tag=RndText5] ~ ~ ~ tellraw @a[r=0,c=1] ["5"]
      #reset clock.
      scoreboard players reset @a[score_RandomText_min=1200] RandomText
      

      Well you guys will see many "execute @a[score_RandomText_min=1200] ~ ~ ~" in above commands.
      In pre-1 I'd put those "summon" commands in a function file

      system:RndText

      summon area_effect_cloud ~ ~ ~ {Tags:["RndText","RndText1"]}
      summon area_effect_cloud ~ ~ ~ {Tags:["RndText","RndText2"]}
      summon area_effect_cloud ~ ~ ~ {Tags:["RndText","RndText3"]}
      summon area_effect_cloud ~ ~ ~ {Tags:["RndText","RndText4"]}
      summon area_effect_cloud ~ ~ ~ {Tags:["RndText","RndText5"]}
      
      entitydata @r[type=area_effect_cloud,tag=RndText] {CustomName:"RndText"}
      
      execute @e[name=RndText,tag=RndText1] ~ ~ ~ tellraw @a[c=1,r=0] ["1"]
      execute @e[name=RndText,tag=RndText2] ~ ~ ~ tellraw @a[c=1,r=0] ["2"]
      execute @e[name=RndText,tag=RndText3] ~ ~ ~ tellraw @a[c=1,r=0] ["3"]
      execute @e[name=RndText,tag=RndText4] ~ ~ ~ tellraw @a[c=1,r=0] ["4"]
      execute @e[name=RndText,tag=RndText5] ~ ~ ~ tellraw @a[c=1,r=0] ["5"]
      
      scoreboard players reset @s RndText
      

      and run these two commands in main loop.

      scoreboard players add @a RndText 1
      execute @a[score_RndText_min=1200] ~ ~ ~ function system:rndtext
      

      The latter did give us convenience. But things are quite different in Pre3.
      Hope you can consider about it.

            Unassigned Unassigned
            Civi Civi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: