Jump to content




ERROR: Rednet 53: Expected Number


  • You cannot reply to this topic
7 replies to this topic

#1 ebernerd

  • Members
  • 262 posts
  • LocationBoston, MA

Posted 19 June 2013 - 09: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]

--(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)


#2 Spongy141

  • Members
  • 526 posts
  • Location'Merica

Posted 19 June 2013 - 09:20 PM

recPacket = rednet.recieve()
--Try using this instead
id, recPacket = rednet.recieve()


#3 ebernerd

  • Members
  • 262 posts
  • LocationBoston, MA

Posted 19 June 2013 - 09:24 PM

View PostSpongy141, on 19 June 2013 - 09:20 PM, said:

recPacket = rednet.recieve()
--Try using this instead
id, recPacket = rednet.recieve()

I did. Still the same. I realized that.

#4 ebernerd

  • Members
  • 262 posts
  • LocationBoston, MA

Posted 19 June 2013 - 09:32 PM

I have noticed that it isnt even sending the request for a packed ID. So, the rednet message never gets sent

#5 ElvishJerricco

  • Members
  • 803 posts

Posted 19 June 2013 - 09: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



#6 Spongy141

  • Members
  • 526 posts
  • Location'Merica

Posted 20 June 2013 - 12:20 AM

View PostElvishJerricco, on 19 June 2013 - 09:47 PM, said:

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

Why loop it? Anyways, OP, does the program give you that error when you try to run it, or when you input something?

#7 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 20 June 2013 - 01:10 AM

View PostSpongy141, on 20 June 2013 - 12:20 AM, said:

Why loop it?

Emphasis mine:

View PostElvishJerricco, on 19 June 2013 - 09:47 PM, said:

But remember that you've gotta check for the user error of entering non-numbers b[y] checking if tonumber returns nil.


#8 ebernerd

  • Members
  • 262 posts
  • LocationBoston, MA

Posted 20 June 2013 - 05:27 AM

Thanks so much guys! I fized it! Wanted to make an advertisement system for my tekkitserver





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users