Hello, I'm trying to make a arcade game where you swipe a Immibis Peripherals mag-card on a reader to play.
I'm still figuring out how to put together my own code (It took my 3 hours to complete the one below. :blink:/>/> )
I do suspect I will be referring to this post for help multiple times! :)/>/>
I don't get what the problem is with this one…
I have 1 mag-card reader, 1 adv. monitor, 1 adv. computer, hooked together with networking cables and wired modems. the wired modems do have the red band. Oh, and I'm running this on a disk.
What should happen is it displays "Your balance is: " the whole time accept when rebooting.
So the reader will be waiting for a swiped card. (Event: "mag_swipe") then it will display the value of the card below the
text, and after 5-6 seconds it will reboot (I set the startup to be this program). The code "os.reboot()" doesn't work in my case, so I put the waiting for read event into a function, so a reboot is just restarting the function.
Spoiler
[color=#00ffff]Code[/color]:
Resulting Error: bal:12 attempt to index ? (a nil value)
ready = true
m = peripheral.wrap("monitor_1")
m.clear()
m.setCursorPos(1,1)
m.setTextScale(0.8)
m.setTextColor(colors.white)
m.write("You Balance is:")
m.setCursorPos(1,3)
while true do
reader.setInputCardLight(true)
p1,p2,p3 = os.pullEvent("mag_swipe")
m.write("Points: "..p2)
end
sleep(5)
m.clear()
m.setCursorPos(1,1)