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

Command Block /testforblock suggestion

Started by 0099, 15 November 2014 - 02:44 PM
0099 #1
Posted 15 November 2014 - 03:44 PM
I like command blocks very much, so, for me, 1.7 is the update of /setblock and /testforblock. But, for now, extracting information from /testforblock is extremely inconvenient. It must be activated by redstone, not by runCommand, or else it won't update redstone. The comparator gives a delay. The only answer you get is "yes" or "no".
That's why I suggest to add a function to the command block API, that reads the "Previous Output" field of a command block. That's where the real information is.
For example, imagine you have coordinates and you need to know, what block is there. And you have no idea what it can be. So, the only way to do it is to go through all possible block IDs until the command block responds "yes". With 0.1 (or, more precisely, 0.100001) delay for each. But if a human looks into that command block after the very first command, he will see this:

The block at 949,57,-1648 is Redstone Lamp (expected: tile.air.name).
So, actually, all the information is there, you just can't read it.

P.S. Please, Dan, do it! It's very small change, you know. That's all I lack for to make my PVP map!
Edited on 15 November 2014 - 02:44 PM
Agent Silence #2
Posted 17 November 2014 - 05:11 PM
So basically return information that was given by commands?
That's a good idea, you could read info off the /whois command from essentials
0099 #3
Posted 19 November 2014 - 02:21 PM
So basically return information that was given by commands?
Either return it, or make it availible permanently with a function getOutput (like getCommand).
That's a good idea, you could read info off the /whois command from essentials
Well, yes. And from any other plugin too. But I believe, with /testfor, /clear and /testforblock a computer can fully replace any possible plugin.
Agent Silence #4
Posted 19 November 2014 - 06:20 PM
So basically return information that was given by commands?
Either return it, or make it availible permanently with a function getOutput (like getCommand).
That's a good idea, you could read info off the /whois command from essentials
Well, yes. And from any other plugin too. But I believe, with /testfor, /clear and /testforblock a computer can fully replace any possible plugin.
Yeah, it could replace factions, and it could replace mobarena too with /spawnmob
LupoCani #5
Posted 21 November 2014 - 11:17 PM
I'd just like to say I agree, commandblock.getResult() would be a perfectly reasonable addition.

Seeing as anyone who could actually use this would, presumably, be in a position to modify the server files, how would one go about adding this feature server-side without requiring additional client-side modification?
rik_mclightning1 #6
Posted 31 March 2015 - 08:16 AM
Command blocks can replace almost any plugin in 1.8. A lot of plugins would use a massive machine with a lot of command blocks, however, but with the command computer it's much easier to recreate plugins without much lag. Once computercraft is out for 1.8, the only plugins I can think of that could not be recreated are ones that deal with the entitydata of players.
dan200 #7
Posted 01 April 2015 - 12:23 AM
In 1.73, commands.exec (and commands.testforblock, etc), returns a table of chat output emitted during the command.