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

Cannot change scoreboard value within 'execute store'

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 18w06a, Minecraft 1.13-pre4
    • Fix Version/s: None
    • Labels:
    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      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
      

      Reproduction

      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")

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              simon816 Simon816
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                CHK: