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

/function SuccessCount stat depends only on last command in function



    • Confirmation Status:


      EDIT: Mark this as invalid - "On second though, this is probably an invalid report as the function itself is running commands off the executed entity, thus changing the successcount, instead of returning successcount based on the success of the function as a whole"

      When a function is called from an entity with SuccessCount stat from inside a function, the SuccessCount will only reflect the last command of the executed function.

      For example, if function 'test:test' has the commands:

      execute @e[type=area_effect_cloud,tag=conditional,c=1] ~ ~ ~ function test:test2
      execute @e[type=area_effect_cloud,tag=conditional,c=1,score_success_min=1] ~ ~ ~ say successful

      where the area_effect_cloud has SuccessCount stored on @s on the success objective, and function 'test:test2' has the commands:

      testfor @p
      testfor @e[tag=doesnotexist]

      where testfor @p will be successful but testfor @e[tag=doesnotexist] will not, the area_effect_cloud will not say 'successful' when 'test:test' is run.

      To test:

      1. download attached function zip
      2. put it in your world
      3. run /function test:test
      4. notice that chat will say 'ran test' 'ran test2' but will not say 'successful'
      5. remove 'testfor @e[tag=doesnotexist]' (so that the last command is now one that will run successfully) and run again
      6. notice it will now say 'successful'

      What should happen is it should be successful based on if the function itself was able to run at all.

      This issue is not present when tested with conditional command blocks where the first runs a function command and the second conditional prints to chat if successful. In the case of command blocks, the second command will always run if the function ran at all, and is not dependent only on the last command in the function.

      To compare to conditional command blocks:

      1. impulse: /function test:test2
      2. conditional chain: /say successful
      3. 'successful' will always output as long as test2 is a valid function with no errors




            Unassigned Unassigned
            onnowhere Onnowhere
            1 Vote for this issue
            1 Start watching this issue