You can't
In the current state of the game, Minecraft 1.8.8 or Snapshot 15w42a, there is no way to insert any sort of variable into commands.
There are definitely workarounds to this for many possible applications of variables in commands, mostly involving the use of execute
and armor stands, but there is no general way of using variables in commands. These workarounds are never simple, too, and brute-forcing the commands might actually be more efficient.
My first recommendation would be to use a different method of running three commands. Two other possibilities you could use are chained command blocks or a function. If you absolutely need it in one command block then use a function, otherwise, use a chain of command blocks as it is simpler. To do the latter, place three command blocks next to each other so that they point into each other. Then when putting commands into the final two blocks, click the buttons below until they say Chain / Conditional / Always Active.
If you still want to use the falling block method, there are several problems that I see with your command.
You used escaped quotation marks(\”
) which are not needed in this case and cause a problem. You also used the wrong kind of quotation marks (”
vs "
)
You used the @s
target selector which targets the entity executing the command. The command block would output Entity '@s' cannot be found
. You will have to use an appropriate target selector. You could use @p
to target the player nearest the command blocks.
The first use of Passengers
(Passengers [{id:falling_block
) is missing :
.
The last command block command fill ~ ~-5 ~-1 ~~50 ~-1 redstone_block
has no space between x2 and y2(~~50
should be ~ ~50
). Also, the redstone blocks only need to be next to the blocks that need to be activated. With the current coordinates, you are producing a stack from one below the original command block, all the way to 50 above the last command block. I changed the fill coordinates to ~ ~-3 ~-1 ~ ~-1 ~-1
and it only puts the blocks where they are needed.
Another change. While it is not required to be changed, command block commands do not need to start with /
With all of these changes the command is:
summon falling_block ~ ~1 ~ {Block:command_block,Time:1,TileEntityData:{Command:"give @p minecraft:bow 1"},Passengers:[{id:falling_block,Block:command_block,Time:1,TileEntityData:{Command:"give @p minecraft:arrow 64"},Passengers:[{id:falling_block,Block:command_block,Time:1,TileEntityData:{Command:"tp @p 384.700 7 400.700"},Passengers:[{id:falling_block,Block:command_block,Time:1,TileEntityData:{Command:"fill ~ ~-3 ~-1 ~ ~-1 ~-1 redstone_block"},Passengers:[{id:falling_block,Block:redstone_block,Time:1}]}]}]}]}
Note:This will only successfully run one time. After that, the command blocks and redstone blocks are already in place so if you run it again, it will cause command blocks and redstone blocks to break and be dropped as items.
You could correct this by removing all of the command blocks and redstone blocks that were created by the original command block. Either manually or with another command block.
Best Answer
Minecraft does not have good string handling (yet, I assume that will change soon). A command like you imagined it would be great, but doesn't exist. The best you could do would be hardcoding many different values for blocks and have one fill command for each of them.
In your case it might potentially be possible to summon an army of endermen, give them all the block by moving the NBT over, then forcing them to stay in one place until they put the block down. But I guess that's harder than just hardcoding a few different blocks. :D