Jump to content




Turtle remote monitor

turtle wireless media

4 replies to this topic

#1 shawnmick

  • Members
  • 3 posts

Posted 07 May 2015 - 07: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 by shawnmick, 08 May 2015 - 12:36 AM.


#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 11 May 2015 - 02: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


#3 shawnmick

  • Members
  • 3 posts

Posted 11 May 2015 - 08: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.

#4 shawnmick

  • Members
  • 3 posts

Posted 12 May 2015 - 07: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 by shawnmick, 12 May 2015 - 08:51 PM.


#5 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 13 May 2015 - 01: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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users