4 posts
Posted 14 March 2012 - 12:30 PM
How do i get the user to enter an id?
Spoiler
term.clear()
term.setCursorPos(1, 1)
rednet.open("back")
io.write("Enter a Messege: ")
m = io.read()
io.write("Enter PC ID: ")
i = io.read()
rednet.send(i, m) ^^^that code doesn't work^^^
How do i fix it?
473 posts
Location
Poland
Posted 14 March 2012 - 02:05 PM
try rednet.send(tonumber(i), m)
80 posts
Posted 14 March 2012 - 02:07 PM
You must use tonumber() to change the string to a number.
term.clear()
term.setCursorPos(1, 1)
rednet.open("back")
io.write("Enter a Message: ")
m = io.read()
io.write("Enter PC ID: ")
i = tonumber(io.read())
rednet.send(i, m)
4 posts
Posted 14 March 2012 - 03:01 PM
You must use tonumber() to change the string to a number.
term.clear()
term.setCursorPos(1, 1)
rednet.open("back")
io.write("Enter a Message: ")
m = io.read()
io.write("Enter PC ID: ")
i = tonumber(io.read())
rednet.send(i, m)
Thanks sooo much :mellow:/>/>
It works now.
I read about the tonumber function but i thought you could only use it like this
x = "blah"
tonumber(A NUMBER HERE)
print(x)
But any way, thanks again. ;)/>/>
EDIT:
BTW sorry i didn't use the
tags...
4 posts
Posted 15 March 2012 - 08:48 PM
One more thing, can i make a program to display text on monitor?
monitor right hello
[/code
obviously doesn't work.
473 posts
Location
Poland
Posted 15 March 2012 - 08:52 PM
you have to redirect the output:
local screen=peripheral.wrap(side)
term.redirect(screen)
Not sure whether that is correct, i don't know the monitors well
4 posts
Posted 16 March 2012 - 04:47 AM
you have to redirect the output:
local screen=peripheral.wrap(side)
term.redirect(screen)
do i put that inside the hello program or inside a different file (i.e
show.lua/show)?
and what do you mean by screen in "term.redirect(screen)"?