Jump to content




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


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

#1 X3ME

  • Members
  • 82 posts
  • LocationBeing the stereotypical kid in forums.

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!

#2 Sewbacca

  • Members
  • 450 posts
  • LocationStar Wars

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

#3 X3ME

  • Members
  • 82 posts
  • LocationBeing the stereotypical kid in forums.

Posted 15 March 2016 - 09:17 PM

Still nothing, though that does make sence

#4 X3ME

  • Members
  • 82 posts
  • LocationBeing the stereotypical kid in forums.

Posted 15 March 2016 - 10:03 PM

SOLVED, i was using "" in a number

#5 Sewbacca

  • Members
  • 450 posts
  • LocationStar Wars

Posted 16 March 2016 - 12:37 PM

Good :D





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users