This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
moneymaster2012's profile picture

Mag-Card -=- Immibis Peripherals

Started by moneymaster2012, 18 January 2015 - 01:51 AM
moneymaster2012 #1
Posted 18 January 2015 - 02:51 AM
I get this error when I type in my card id:
startup:30: attempt to index ? (a nil value)


--Variables
reader = peripheral.wrap("right")
version = "1.0"
password = "five5"
--Functions
clear = function()
  term.clear()
  term.setCursorPos(1,1)
end
menu = function()
  clear()
  print("[1] Create Key")
  sEvent, param = os.pullEvent("key")
    if sEvent == "key" then
	  if param == 2 then
	    sleep(0.01)
	    create()
	  end
    end
end
create = function()
  clear()
  write"Room ID:  "
  data = read()
  label = data
  clear()
  print("Creating key...")  
  reader.beginWrite(data,label)
  sleep(1)
  os.pullEvent("mag_write_done")
  print("Process Complete! Room key: "..data)
  clear()
end
	   
login = function()
  clear()
  print("logging in...")
  sleep(1)
  clear()
  term.setCursorPos(5,10)
  write"Password:  "
  pass = read("*")
  if pass == password then
    menu()
  else
    clear()
    login()
  end
end
--Mission Control
login()
GopherAtl #2
Posted 18 January 2015 - 03:00 AM
Are you sure the peripheral is on the right? that error suggests the peripheral.wrap("right") returned nil.
moneymaster2012 #3
Posted 18 January 2015 - 12:53 PM
Are you sure the peripheral is on the right? that error suggests the peripheral.wrap("right") returned nil.
Positive