I have a command block that will be summing sand when conditions are met - and removing sand if the condition is not met.
I thought sand would be the best way to count something - but - now the question is, is there a way to count how much sand is in the spot?
I'm summing the sand way up high, and its falling to land, it can stack to 64 blocks in total, so I need a way to "count" how much sand is vertical in a given location --- how? can it be done? thanks for help, tips, info etc.
You can use CommandStats in order to count the number of blocks to store as a scoreboard value, but in this situation it would be much less complex to simply use scoreboards as a counter to begin with. Quick example:
Well, the issue is that I am trying to make a scoreboard system that was less complex then what I had. I have made Othello (reversi) in minecraft, my first build using a TON of redstone to keep the score, and... sometimes it fails. So I was wanting to come up with a far more simple solution.
The problem is thus; I have 64 blocks to "check" for black or white wool. If it is black, +1 to black, if it is white +1 white, but if it is blank then no one gets anything, issue: I have 1 button that I press that cycles White/Black/Air. So my first build has adding to white, then subtracting from white and adding to black and finally subtracting from black (for when its clear)
The sand idea was to have a block of sand summoned if black is at (X) square, if not black at (X) then remove 1 sand. Same for white. That way I have a 64 tall sand structure that I could, just count and then say "Black is at (X)" score / "White is at (Y) score"
I'll describe how to use CommandStats then, which can count how much sand is in an area.
Command blocks, signs, and entities can hold a set of different "success stats", that will set a player's score depending on the success of the command that is run through that initiator (be it the command block running the command or the entity).
For example: a command block has the command "/testfor @a" and has the "SuccessCount" or "AffectedEntities" CommandStat applied to it. If the /testfor command finds 4 players, the CommandStat will set a player's score to 4.
First you'll need an objective to store a score in:
/scoreboard objectives add BLOCKS dummy
A fake player is going to be used to store the score. In order for CommandStats to function, the target must already be tracked in the objective. A fake player called "SAND" will be used:
/scoreboard players set SAND BLOCKS 0
Now for the main command block. The /clone command will be used to count the number of blocks. What it does is clones the blocks into the same exact position they were in. Visually it does absolutely nothing, but it provides us with the number of blocks cloned (which is equal to the number of sand blocks there are). You'll need to fill in the coordinates ("X1 Y1 Z1" needs to be identical to "x y z"), "masked" is used so it doesn't count air blocks, and "force" has to be used so it can overlap the clone:
/clone X1 Y1 Z1 X2 Y2 Z2 x y z masked force
And finally, the CommandStat to be used. Stand atop the command block and run the following /stats command:
/stats block ~ ~-1 ~ set AffectedBlocks SAND BLOCKS
Every time the command block is activated it's /clone command is run, finds the number of blocks cloned, and the CommandStat will set the "BLOCKS" score of fake player "SAND" equal to the number of blocks cloned.
I have an old video demonstration here (it uses /blockdata to apply the stats, as /stats hadn't been implemented during that time):