--(C)2013 14Studios interRed
function clear( x,y )
term.clear()
term.setCursorPos(x,y)
end
function c()
clear(1,1)
end
rednet.open("back")
clear(17,1)
write("Welcome to the InterRed System")
print("")
write("ID Hookup: ")
idHookup = read()
clear(17,9)
print("Loading...")
sleep(.5)
rednet.send(idHookup, "receivePacketID")
recPacket = rednet.receive()
c()
print(recPacket)
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
ERROR: Rednet 53: Expected Number
Started by ebernerd, 19 June 2013 - 08:17 PMPosted 19 June 2013 - 10:17 PM
So, I am trying to make my own "internet" for advertising on my tekkit server. What am I doing wrong here? The server program (on a different computer) is alright. So, what is wrong? [ps. both programs are running]
Posted 19 June 2013 - 10:20 PM
recPacket = rednet.recieve()
--Try using this instead
id, recPacket = rednet.recieve()
Posted 19 June 2013 - 10:24 PM
recPacket = rednet.recieve() --Try using this instead id, recPacket = rednet.recieve()
I did. Still the same. I realized that.
Posted 19 June 2013 - 10:32 PM
I have noticed that it isnt even sending the request for a packed ID. So, the rednet message never gets sent
Posted 19 June 2013 - 10:47 PM
read() returns a string, rednet.send requires a number. Try tonumber(read()). But remember that you've gotta check for the user error of entering non-numbers but checking if tonumber returns nil.
local idHookup -- also, learn about locals and use them. They are faster and safer.
repeat
idHookup = tonumber(read())
until idHookup
Posted 20 June 2013 - 01:20 AM
Why loop it? Anyways, OP, does the program give you that error when you try to run it, or when you input something?read() returns a string, rednet.send requires a number. Try tonumber(read()). But remember that you've gotta check for the user error of entering non-numbers but checking if tonumber returns nil.local idHookup -- also, learn about locals and use them. They are faster and safer. repeat idHookup = tonumber(read()) until idHookup
Posted 20 June 2013 - 02:10 AM
Why loop it?
Emphasis mine:
But remember that you've gotta check for the user error of entering non-numbers b[y] checking if tonumber returns nil.
Posted 20 June 2013 - 06:27 AM
Thanks so much guys! I fized it! Wanted to make an advertisement system for my tekkitserver