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

Cannot change scoreboard value within "execute store"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • Minecraft 18w06a, Minecraft 1.13-pre4, Minecraft 1.14, Minecraft 1.14.1, Minecraft 1.14.2 Pre-Release 1, Minecraft 1.14.2 Pre-Release 2, Minecraft 1.14.2, Minecraft 1.14.3, Minecraft 1.14.4 Pre-Release 1, Minecraft 1.14.4 Pre-Release 3, Minecraft 1.14.4 Pre-Release 4, Minecraft 1.14.4 Pre-Release 5, Minecraft 1.14.4 Pre-Release 6, 1.14.4, 19w34a, 19w35a, 19w36a, 19w37a, 19w38b, 19w39a, 19w40a, 19w41a, 19w42a, 19w45b, 19w46b, 1.15 Pre-release 1, 1.15 Pre-Release 2, 1.15 Pre-release 3, 1.15 Pre-release 4, 1.15 Pre-release 5, 1.15 Pre-release 6, 1.15 Pre-release 7, 1.15, 1.15.1, 1.15.1 Pre-release 1, 1.15.2 Pre-Release 1, 1.15.2 Pre-release 2, 1.15.2, 20w06a, 20w07a, 20w08a, 20w09a, 20w10a, 20w11a, 20w13a, 20w13b, 20w15a, 20w17a, 20w18a, 20w19a, 20w20a, 20w20b, 20w21a, 1.16 Pre-release 3, 1.16 Release Candidate 1, 1.16, 1.16.1, 20w28a, 20w30a, 1.16.2 Pre-release 1, 1.16.2 Release Candidate 1, 1.16.2 Release Candidate 2, 1.16.2, 1.16.3 Release Candidate 1, 1.16.3, 1.16.4 Pre-release 1, 1.16.4 Pre-release 2, 1.16.4 Release Candidate 1, 1.16.4, 20w46a, 20w48a, 20w51a, 21w03a, 1.16.5, 21w05a, 21w05b, 21w06a, 21w07a, 21w11a, 1.17 Pre-release 2
    • Confirmed
    • Commands

      Note: This seems related to MC-123628, but not quite the same.

      The bug

      When running a function within an execute that stores the success value to a scoreboard objective, said objective cannot be changed.

      Setup

      scoreboard objectives add my_objective dummy
      

      How to reproduce

      Use the attached datapack MC-125145 datapack.zip or create the following functions within the namespace bug_test:

      func1.mcfunction

      scoreboard players set @s my_objective 0
      tellraw @a {"text": "value before calling func2: ", "extra": [{"score":{"name":"@s","objective":"my_objective"}}]}
      execute store success score @s my_objective run function bug_test:func2
      tellraw @a {"text": "value after calling func2: ", "extra": [{"score":{"name":"@s","objective":"my_objective"}}]}
      

      func2.mcfunction

      tellraw @a {"text": "value once inside func2: ", "extra": [{"score":{"name":"@s","objective":"my_objective"}}]}
      scoreboard players set @s my_objective 10
      tellraw @a {"text": "value reset to 10: ", "extra": [{"score":{"name":"@s","objective":"my_objective"}}]}
      

      Run bug_test:func1 as a player

      Expected output

      value before calling func2: 0
      value once inside func2: 0
      value reset to 10: 10
      value after calling func2: 1
      

      (I think it's also valid for "value once inside func2" to be 1, depends if the "success" value should get set immediately, or after. As long as "value after calling func2" represents whether it called the function or not)

      Actual output

      value before calling func2: 0
      value once inside func2: 1
      value reset to 10: 1
      value after calling func2: 1
      Executed 8 commands from function 'bug_test:func1'
      

      If you remove store success score @s my_objective such that the execute command is

      execute run function bug_test:func2
      

      Then the variable is set accordingly. (i.e. "value reset to 10: 10")

            Unassigned Unassigned
            simon816 Simon816
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: