Skip to main content
added 665 characters in body
Source Link
MegaCrafter10
  • 2.5k
  • 1
  • 9
  • 23

LastOutput represents the last line of output generated by the command block. Since that line is a string, the /execute store command returns the length of that line (which is 84 in your case).

Instead of reading the number from the output, you can access that number directly:

execute store result score <player> <objective> run fill <x> <y> <z> <x2> <y2> <z2> <block>

this will store the amount of blocks affected by the /fill command into the specified objective.

Edit:

if you want to keep track of how many blocks we're affected in total, here is how you can do that.

You need two scoreboard objectives of type dummy. I will call mine "count" and "total". Once you have two objectives, place down a command block (it can be an impulse or repeating command block) and paste this command in:

execute store result score @p count run fill ...

attach a chain command block to the one you just placed down and set it to always active. Paste this in:

execute as @p run scoreboard players operation @s total += @s count

this will store the number of affected blocks into "count" and add its value to "total".

LastOutput represents the last line of output generated by the command block. Since that line is a string, the /execute store command returns the length of that line (which is 84 in your case).

Instead of reading the number from the output, you can access that number directly:

execute store result score <player> <objective> run fill <x> <y> <z> <x2> <y2> <z2> <block>

this will store the amount of blocks affected by the /fill command into the specified objective.

LastOutput represents the last line of output generated by the command block. Since that line is a string, the /execute store command returns the length of that line (which is 84 in your case).

Instead of reading the number from the output, you can access that number directly:

execute store result score <player> <objective> run fill <x> <y> <z> <x2> <y2> <z2> <block>

this will store the amount of blocks affected by the /fill command into the specified objective.

Edit:

if you want to keep track of how many blocks we're affected in total, here is how you can do that.

You need two scoreboard objectives of type dummy. I will call mine "count" and "total". Once you have two objectives, place down a command block (it can be an impulse or repeating command block) and paste this command in:

execute store result score @p count run fill ...

attach a chain command block to the one you just placed down and set it to always active. Paste this in:

execute as @p run scoreboard players operation @s total += @s count

this will store the number of affected blocks into "count" and add its value to "total".

Source Link
MegaCrafter10
  • 2.5k
  • 1
  • 9
  • 23

LastOutput represents the last line of output generated by the command block. Since that line is a string, the /execute store command returns the length of that line (which is 84 in your case).

Instead of reading the number from the output, you can access that number directly:

execute store result score <player> <objective> run fill <x> <y> <z> <x2> <y2> <z2> <block>

this will store the amount of blocks affected by the /fill command into the specified objective.