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

Turtle remote monitor

Started by shawnmick, 07 May 2015 - 06:05 PM
shawnmick #1
Posted 07 May 2015 - 08:05 PM
trying to make a program that displays what is in to turltle console on a wireless monitor else where.
CODE
so far though every time that i run the monitor program the turtle just shows a black screen.'
it should allow me to just go about my business on the turtle after i run the command
Edited on 07 May 2015 - 11:36 PM
Bomb Bloke #2
Posted 11 May 2015 - 03:45 PM
shell.run() runs a whole other script; I'm guessing you don't actually have the likes of "setCursorBlink" and so on saved as separate script files on your turtle's drive. The turtle will have a hard time displaying the resulting error, since you've replaced its text writing function with something that won't work…

It looks like you're wanting to do something along these lines:

rednet.open("right")

for key, value in pairs(term) do
	if type(value) == "function" then
		term[key] = function(...)
			rednet.broadcast({key, {...}})  -- Broadcast only accepts one parameter, so if you want to send more than that, tables are handy.
			return value(...)
		end
	end
end

… which you would capture and render with:

rednet.open("right")

local mon = peripheral.find("monitor")

while true do
	local id, msg = rednet.receive()

	if type(msg) == "table" and mon[msg[1]] then  -- If the message is a table, and the first index holds a valid monitor function, then...
		mon[msg[1]](unpack(msg[2]))
	end
end
shawnmick #3
Posted 11 May 2015 - 09:18 PM
this looks awesome im actually busy with class today but ill test it tonight and get back to you tommorow about how it works. i appreciate the reply and i hope i made it clear enough :D/>.
shawnmick #4
Posted 12 May 2015 - 08:47 AM
so i had a chance to test this out and it works decently but whenever it encounters spaces or a new line it kinda freaks out. instead of just continuing to print the line itl loop back to the start of the line for example if on my turtle i see

hello world.

on the monitor i see

hellohellohellohellohellohellohello

im not sure why it is doing this ;D
Edited on 12 May 2015 - 07:51 PM
Bomb Bloke #5
Posted 13 May 2015 - 02:54 AM
I would guess that you're somehow managing to run the first code block - the one intended for the turtle - multiple times. Make sure it's only executed one time per boot, no more than that.