←  Ask a Pro

ComputerCraft | Programmable Computers for Minecraft

»

[Lua][Error] startup:27: attempt to call nil

Pricey123's Photo Pricey123 13 Jan 2013

Im not to sure but i guess that this maybe something linked to another problem im having?
http://www.computerc...pt-to-call-nil/
os.pullEvent = os.pullEventRaw
local locker = true
local failed = true
local attempted_login = true
local password_server = 0
rednet.open("right")
while locker do
attempted_login = false
term.clear()
term.setCursorPos(1,1)
print("Welcome to a USERS PC : Roaming Profile Enabled")
print("What would you like to do?")
print("[1] Login (*)")
print("[2] Shutdown")
write("> ")
local input = read()
if input == "2" then
  os.shutdown()
elseif input == "1" then
  attempted_login = true
  print("Please login...")
  write("Username: ")
  local username = read()
  write("Password: ")
  local password = read("*")
  rednet.send(password_server, username, true)
  senderId, message, distance = rednet.receive(5)
  if password == message then
   failed = false
   locker = false
   term.clear()
   term.setCursorPos(1,1)
   print("Welcome ", username)
  else
   print("Invalid Username or Password.")
   sleep(3)
  end
else
  print("Command not recognised...")
  sleep(2)
end
end
Quote

RunasSudo-AWOLindefinitely's Photo RunasSudo-AWOLindefinitely 13 Jan 2013

Odd, there doesn't seem to be any problem in line 27.
senderId, message, distance = rednet.receive(5)
Where are you calling this program? Is this the "startup" program, or is this in some other program you are running?
Quote

Pricey123's Photo Pricey123 13 Jan 2013

 RunasSudo, on 13 January 2013 - 01:56 PM, said:

Odd, there doesn't seem to be any problem in line 27.
senderId, message, distance = rednet.receive(5)
Where are you calling this program? Is this the "startup" program, or is this in some other program you are running?
I am using this as startup as i am trying to make a user interferance for my factory
Quote

crazyguymgd's Photo crazyguymgd 13 Jan 2013

Well I ran your program without any errors so I'm not too sure why you would be having a problem.
And I just spent a little while trying to force the error with no luck so something else you are doing must be wrong.
Sorry I couldn't find the problem, just letting you know I tried.
Quote

Pricey123's Photo Pricey123 14 Jan 2013

 crazyguymgd, on 13 January 2013 - 09:14 PM, said:

Well I ran your program without any errors so I'm not too sure why you would be having a problem.
And I just spent a little while trying to force the error with no luck so something else you are doing must be wrong.
Sorry I couldn't find the problem, just letting you know I tried.
Are you using tekkit?
because i am using tekkit and im not sure whether it is to be used on a updated version
Quote

crazyguymgd's Photo crazyguymgd 14 Jan 2013

how old of a version of cc are you using in that tekkit pack?
Quote

Pricey123's Photo Pricey123 15 Jan 2013

Tekkit uses version 1.33
Quote

Lyqyd's Photo Lyqyd 15 Jan 2013

Did you retype the program here or copy and paste it? Be sure the actual program has rednet.receive and not rednet.recieve.
Quote

remiX's Photo remiX 15 Jan 2013

 Pricey123, on 15 January 2013 - 07:09 AM, said:

Tekkit uses version 1.33

Download Tekkit lite :) It has CC 1.4+
Quote

Pricey123's Photo Pricey123 15 Jan 2013

 Lyqyd, on 15 January 2013 - 07:13 AM, said:

Did you retype the program here or copy and paste it? Be sure the actual program has rednet.receive and not rednet.recieve.

Hey thanks very much this seems to have fixed the error even on the other post.
Once again thanks
Quote

crazyguymgd's Photo crazyguymgd 15 Jan 2013

So you retyped the whole program to put it on here? Interesting... well glad it's fixed.
Quote

Pricey123's Photo Pricey123 15 Jan 2013

But now each time i type in the correct username and passwords it comes up with Invalid Username Or Password? have i done something wrong in the other code?
http://www.computerc...pt-to-call-nil/
Quote

ChunLing's Photo ChunLing 15 Jan 2013

Have this program (and the other one) print out what they're sending and receiving, so that you can confirm that they match up and so forth.
Quote