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

Won't display the info after it gets it..

Started by X3ME, 15 March 2016 - 08:02 PM
X3ME #1
Posted 15 March 2016 - 09:02 PM
I'm making an ATM program, the server send this info through rednet:

{"<Dylan Washington>","<#56>","<345$>"}

And for some reason, the part that is suppost to show that isn't working..


-- ATM for CC-Oyster by hiperbolt (X3ME/X3ME03) and ry00000
-- Var
reader = peripheral.wrap("top")
modem = "back"
-- Func
local function cprint(text)
  local x,y = term.getSize()
  local x2,y2 = term.getCursorPos()
  term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
  write(text)
end
local function clear()
  term.clear()
  term.setCursorPos(1,1)
end
local function readmag()
  while true do
  reader.setInsertCardLight(true)
  local event,arg1,arg2,arg3 = os.pullEvent()
  if event == "mag_swipe" then
    reader.setInsertCardLight(false)
    break
  end
  end
end
local function rednetmessage()
while true do
rednet.open(modem)
local event,arg1,arg2,arg3 = os.pullEvent()
  if event == "rednet_message" then
    if arg1 == "2" then
	  rednet.close(modem)
	  arg2 = info
	  break
    end
  end
  end
end
-- Init
clear()
cprint("Please enter your CC-Oyster Card")
readmag()
clear()
rednet.open(modem)
rednet.send(2,"hi")
rednet.close(modem)
rednetmessage()
clear()
write("Name:")
cprint(info[1])
write("\n")
write("Card Number:")
cprint(info[2])
write("\n")
write("Account Ballance:")
cprint(info[3])
write("\n")
write("\n")
write("\n")
write("\n")
write("\n")
cprint("Press (q) to quit:")
input = read()
if input == "q" then
  error()
end

Thanks!
Sewbacca #2
Posted 15 March 2016 - 09:14 PM

local function rednetmessage()
while true do
rednet.open(modem)
local event,arg1,arg2,arg3 = os.pullEvent()
  if event == "rednet_message" then
    if arg1 == "2" then
		  rednet.close(modem)
		  arg2 = info
		  break
    end
  end
  end
end

You have to change arg2 = info in info = arg2 :D/>
X3ME #3
Posted 15 March 2016 - 09:17 PM
Still nothing, though that does make sence
X3ME #4
Posted 15 March 2016 - 10:03 PM
SOLVED, i was using "" in a number
Sewbacca #5
Posted 16 March 2016 - 12:37 PM
Good :D/>