52 posts
Posted 07 May 2013 - 03:50 PM
So I'm trying to get the output of commands from a turtle for an ssh program to mirror screens, and it always returns nil. Ask me for any further information and I will try my best to get it to you. Here is the code:
[EDIT] I have determined that it IS the server side but if you would like the client side let me know. Thank You! :)/>
Spoiler
rednet.open("right")
--function execute()
--return loadstring(msg)()
--end
while true do
id, msg = rednet.receive()
screen = loadstring(msg)()
stringscreen=tostring(screen)
print(stringscreen)
rednet.send(1608,stringscreen)
end
1511 posts
Location
Pennsylvania
Posted 07 May 2013 - 04:49 PM
rednet.open("right")
function execute(msg)
return loadstring(msg)
end
while true do
local id, msg = rednet.receive()
stringscreen = tostring(loadstring(msg))
print(stringscreen)
rednet.send(1608,stringscreen)
end
Try this?
8543 posts
Posted 07 May 2013 - 05:02 PM
rednet.open("right")
function execute(msg)
return loadstring(msg)
end
while true do
local id, msg = rednet.receive()
stringscreen = tostring(loadstring(msg))
print(stringscreen)
rednet.send(1608,stringscreen)
end
Try this?
That's even worse.
OP, if you're trying to get screen output, the best way to do it is terminal redirection. You could check out
nsh if you're interested in a working example.
52 posts
Posted 07 May 2013 - 06:02 PM
Yours looks nice, but I'd like to make my own. I thought of terminal redirection, but how would I do that over rednet?
2217 posts
Location
3232235883
Posted 07 May 2013 - 07:34 PM
google + the programs section
or just look through the programs section, your bound to find one
you cant do it yourself without knowing more about cc (its better to see how other peoples programs work)
3790 posts
Location
Lincoln, Nebraska
Posted 07 May 2013 - 07:37 PM
Don't bump topics. It is simply not allowed. If you want a response, wait a bit. We're not here 100% of the time, so please be patient.
8543 posts
Posted 07 May 2013 - 08:00 PM
Yours looks nice, but I'd like to make my own. I thought of terminal redirection, but how would I do that over rednet?
That's why I suggested taking a look at nsh. It uses terminal redirection over rednet, so looking at how it does it may give you inspiration.
52 posts
Posted 07 May 2013 - 08:03 PM
Don't bump topics. It is simply not allowed. If you want a response, wait a bit. We're not here 100% of the time, so please be patient.
Sorry I didn't know that I just saw it on lots of other forums.
Im new to forums (well, posting anyway)so I apologize.
52 posts
Posted 07 May 2013 - 08:54 PM
So I take it there's no even remotely simple way to do this?
52 posts
Posted 07 May 2013 - 09:12 PM
8543 posts
Posted 08 May 2013 - 12:43 PM
Uh, that's not an API. It's a (probably broken) implementation of nsh for my LyqydNet system. If you're looking for something more like an API, you might find the RFC I posted about the
Terminal Redirection over Rednet standard.
52 posts
Posted 08 May 2013 - 01:01 PM
lol I just found that before I checked back here.
52 posts
Posted 08 May 2013 - 01:19 PM
I found this:
http://www.computercraft.info/forums2/index.php?/topic/6484-rfc-tror-terminal-redirection-over-rednet/Could I run it in parallel with my remote control program to get full terminal redirection?
8543 posts
Posted 08 May 2013 - 01:35 PM
You'd ideally want to integrate it into your remote control program. The controlling computer sends keystrokes/commands/whatever and the controlled computer sends back what's on the screen.
52 posts
Posted 09 May 2013 - 11:55 AM
Ok I just found this as well:
https://github.com/lyqyd/LyqydNet-Programs/tree/master/apis with some documentation. I think this has what I want so thank you and I'm sorry for any trouble I have caused as I am good at programming but maybe not your version of good as I am only 13.
52 posts
Posted 09 May 2013 - 03:55 PM
I can't seem to get it to connect to anything. I'm sending connection requests to a turtle labeled "client" and it is listening for packets from "remote" but neither respond.
8543 posts
Posted 09 May 2013 - 05:03 PM
You'd have to post the code you're using. Your posts indicate that you're using stuff that isn't what I suggested would be helpful, so I suspect you're on the wrong track somewhat.
52 posts
Posted 10 May 2013 - 10:01 AM
The turtle is labeled: "client" and the computer is labeled: "remote"
turtle:
os.loadAPI("connection")
os.loadAPI("net")
shell.run("/modread")
shell.run("/netd")
net.netInit()
ncomputer = connection.listen("remote",24)
Computer:
os.loadAPI("connection")
os.loadAPI("net")
shell.run("/modread")
shell.run("/netd")
net.netInit()
nturtle = connection.open("client",24)
term.redirect(connection.text(nturtle))
8543 posts
Posted 10 May 2013 - 12:43 PM
Looks like you're on the right track if you're wanting to do it through LyqydNet. I'll sit down and figure out what you'll need next when I get home from work.
52 posts
Posted 10 May 2013 - 01:44 PM
Looks like you're on the right track if you're wanting to do it through LyqydNet. I'll sit down and figure out what you'll need next when I get home from work.
Thank you VERY much :D/>
52 posts
Posted 12 May 2013 - 11:32 AM
lyqyd? I don't mean to be rude but I'm kind of waiting on an answer.
8543 posts
Posted 12 May 2013 - 10:11 PM
It's been an unexpectedly busy weekend. I'll try to get to this tonight or tomorrow.
52 posts
Posted 13 May 2013 - 09:02 AM
It's been an unexpectedly busy weekend. I'll try to get to this tonight or tomorrow.
Ok thank you very much.
52 posts
Posted 16 May 2013 - 02:54 PM
I'm only bumping this 'cause it seems like this topic has been forgotten. If I cant even do it for that reason please let me know.