Posted 16 May 2014 - 05:48 PM
Hi there! I've been dabbling in ComputerCraft now and again, and with the addition of Pocket Computers in 1.6, I've been thinking of some ways to cause some harmless mischief on my friend's server (They've designated me our base's technician, because even though I don't have much ComputerCraft knowledge, I apparently have more than they do!)
What I have so far is a computer with a Startup program set to recieve a message over Rednet, which it then displays on the monitor for a few seconds, like so:
So far I've just been sending messages to the computer using the Pocket Wireless Computer in the lua interactive environment (By opening RedNet and then sending messages to the computer using rednet.send(1, "Hello there!"). This works perfectly well, but what I want to do is set up a program on my pocket computer to accept a string as an argument, and then send that string over rednet to the receiving computer, so instead of having to type that rednet.send line all the time, I could just for instance type it on the shell, like so:
And have it send that message to my main computer, so it'll get shown on the monitor. (In this way I'm hoping to pull a prank on my non-computercrafty friends by sending messages to the monitor while I'm not looking at it, making it seem like there's an AI chatting to them or something like that)
So far I have:
However, this shows up as {1.0, Hello World!} on my monitor, so I've probably messed something up. I know next to nothing about the args command, so I followed another thread I found on this board about arguments, and after wrestling with "Expected String" errors for a little bit I managed to get it half-working. All I want to show up on the monitor is the string I send in the args for the say command.
Any help with this would be appreciated!
What I have so far is a computer with a Startup program set to recieve a message over Rednet, which it then displays on the monitor for a few seconds, like so:
while true do
local monitor=peripheral.wrap('monitor_0')
rednet.open('right')
local chazid, chazmessage, chazdist=rednet.receive()
monitor.setCursorPos(1,1)
monitor.write(chazmessage)
sleep(3)
monitor.clear()
end
So far I've just been sending messages to the computer using the Pocket Wireless Computer in the lua interactive environment (By opening RedNet and then sending messages to the computer using rednet.send(1, "Hello there!"). This works perfectly well, but what I want to do is set up a program on my pocket computer to accept a string as an argument, and then send that string over rednet to the receiving computer, so instead of having to type that rednet.send line all the time, I could just for instance type it on the shell, like so:
say "Hello world!"
And have it send that message to my main computer, so it'll get shown on the monitor. (In this way I'm hoping to pull a prank on my non-computercrafty friends by sending messages to the monitor while I'm not looking at it, making it seem like there's an AI chatting to them or something like that)
So far I have:
args={...}
rednet.open(back)
rednet.send(1, args)
However, this shows up as {1.0, Hello World!} on my monitor, so I've probably messed something up. I know next to nothing about the args command, so I followed another thread I found on this board about arguments, and after wrestling with "Expected String" errors for a little bit I managed to get it half-working. All I want to show up on the monitor is the string I send in the args for the say command.
Any help with this would be appreciated!