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

[Peripheral]Capturing output of command block.

Started by NullSchritt, 31 May 2013 - 12:22 AM
NullSchritt #1
Posted 31 May 2013 - 02:22 AM
Hello all, in order to monitor the status of a command a program I made is executing, it needs to be able to capture the output of the command block it is activating, and then display it on the terminal/monitor, currently I am trying this

term.redirect(cb)

Where CB is the wrapped commandblock.
  • cb = peripheral.wrap("bottom")
However nothing is displayed on the terminal screen, normally, when a player activates the command the status is sent to their chat. One line at a time.

Thanks ahead of time!
CreeKsx3 #2
Posted 31 May 2013 - 10:32 AM
for monitor i would make it like this. maby it works maby not for d you hat to add your things (this deteckt every side) And if you need only the bottom side you can replace positions in the funktion with "bottom" and delet #positions
local tArgs = { ... }
local positions = {"top", "bottom", "left", "right", "front", "back"}
function ddddd()
	    for i=1, #positions do
        term.dddddd
	    if peripheral.getType(positions[i]) == "monitor" then
		    local mon = peripheral.wrap(positions[i])
		    if mon then
			   mon.setdddddddd
		    end
	    end
    end
end

can u pastebin the complete code so i can see more ?
Engineer #3
Posted 31 May 2013 - 12:04 PM
for monitor i would make it like this. maby it works maby not for d you hat to add your things (this deteckt every side) And if you need only the bottom side you can replace positions in the funktion with "bottom" and delet #positions
local tArgs = { ... }
local positions = {"top", "bottom", "left", "right", "front", "back"}
function ddddd()
		for i=1, #positions do
		term.dddddd
		if peripheral.getType(positions[i]) == "monitor" then
			local mon = peripheral.wrap(positions[i])
			if mon then
			   mon.setdddddddd
			end
		end
	end
end

can u pastebin the complete code so i can see more ?
where are all those ddddd for? 0_o
For monitor output I would use this:
Spoiler

local mon = nil
for k,v in pairs( peripheral.getNames()) do
  if peripheral.getType(v) == "monitor" then 
    mon = peripheral.wrap(v)
  end
end
if mon then
   term.redirect(mon)
   -- Use functions like you would when you are writing to the terminal
   term.restore()
end
But that as a side note..

To get back on the OP, I dont think that is possible within CC :/
Edited on 31 May 2013 - 10:05 AM
CreeKsx3 #4
Posted 01 June 2013 - 08:37 PM
The dddd's are for the function name and for things like term.clear() or mon.clear() or backgroundcolor or textcolor or cursorpos…
CreeKsx3 #5
Posted 01 June 2013 - 08:40 PM
It sould be possible in some complex ways