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

Help with mag card readers

Started by Woodside235, 02 October 2012 - 05:25 AM
Woodside235 #1
Posted 02 October 2012 - 07:25 AM
writecard = function(fname,uname,pass)
magreader.beginWrite(uname.." "..pass, fname)
print("Hello World")
while true do
event = os.pullEvent()
if event == "mag_write_done" then
break
end
end
end

When ever this function gets used "Hello world" gets printed but the yellow light on the reader/writer doesn't come on and using a card on it doesn't write. It just gets stuck at the loop because a card isn't able to be written.

Yes I have set a mag card reader/writer peripheral to "magreader".
Yes I give valid strings for "uname" "pass" and "fname".

magreader.beginWrite("test", "test")
while true do
event = os.pullEvent()
if event == "mag_write_done" then
break
end
end

This part works when it's alone though.

Sorry for the bad code formatting, I'm not sure how to embed code onto fourm posts.
KaoS #2
Posted 02 October 2012 - 07:52 AM
try executing the begin write in the lua prompt and see what it says, I have no clue what you are doing but that generally helps, perhaps your arguments are incorrect
GopherAtl #3
Posted 02 October 2012 - 02:31 PM
the function is fine, try restarting minecraft. If that doesn't fix it, something is wrong somewhere else in the program containing this.
Woodside235 #4
Posted 02 October 2012 - 07:18 PM
I was using rednet to get the variables. And apparently I set the variables to the sender's ID and not the message. So I didn't have valid strings, I tried to give it numbers. >.<

Thanks for the replies.