This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
pofferman's profile picture

Command Block setblock help

Started by pofferman, 28 July 2015 - 07:50 PM
pofferman #1
Posted 28 July 2015 - 09:50 PM
Hey guys :)/>

So why does this not work?


for i = 1,5 do
	commands.async.setblock(1, 60+i, 1, "air")
end

The command Computer simply ignores the for loop.
Any ideas on how to fix it?

Thanks :D/>
RootSlayers #2
Posted 29 July 2015 - 12:08 AM
Hello !

Cheats are allowed ?
If yes, "[@: Block placed]" are displayed ?
If no, in these coordinates are there already nothing (air block) ? (If there is already nothing more to these coordinates, nothing will happen and it is normal that the loop is ignored)
Edited on 28 July 2015 - 10:13 PM
biggest yikes #3
Posted 29 July 2015 - 12:12 AM
Why are you using commands.async.setblock? Try using just commands.setblock.
MKlegoman357 #4
Posted 29 July 2015 - 07:31 AM
commands.async.setBlock would be faster than commands.seBlock. I see one problem, and one potential problem. The first problem is that you should be using the full name: "minecraft:air". The second, potential, problem is that you are setting the blocks located at x=1, y=61-65, z=1. These are not relative but absolute coordinates, so unless you teleported to those I really doubt you're in that area. To place blocks relative to the computer add '~' to the start of the numbers. You'll need to make those numbers into a string though:


commands.async.setBlock("~1", "~" .. (60 + i), "~1", " minecraft:air")
Edited on 29 July 2015 - 05:31 AM
biggest yikes #5
Posted 30 July 2015 - 06:09 PM
commands.async.setBlock would be faster than commands.setBlock
By a very small amount, I'd assume.
The first problem is that you should be using the full name: "minecraft:air".
Just "air" is valid. :mellow:/>
Edited on 30 July 2015 - 04:11 PM