Posted 22 July 2012 - 11:17 PM
I'm very nooby at coding and whenever I try to run this code i get an error, but i didnt design the code and it seems to work for others. help? (code source: http://mccraftcpl.proboards.com/index.cgi?board=programsboard&action=display&thread=163 )
[left]side = "left"[/left]
[left]print ("Waiting for blank disk")[/left]
[left]while true do[/left]
[left]os.pullEvent()[/left]
[left]if disk.isPresent(side) then[/left]
[left]print ("Card Detected.")[/left]
[left]write ("What level is this card? >")[/left]
[left]input = read()[/left]
[left]disk.setLabel(side, "Level "..input.." Access card")[/left]
[left]file = io.open("disk/level", "w")[/left]
[left]file:write(input)[/left]
[left]file:close()[/left]
[left]print ("Disk has been altered.")[/left]
[left]sleep(1)[/left]
[left]print ("Please remove the disk")[/left]
[left]sleep(5)[/left]
[left]print ("Rebooting…")[/left]
[left]sleep(1)[/left]
[left]os.reboot()[/left]
[left]end[/left]
[left]end[/left]
[left]Read more:http://mccraftcpl.proboards.com/index.cgi?board=programsboard&action=display&thread=163#ixzz21OKI2Amb[/left]
[left]side = "left"[/left]
[left]print ("Waiting for blank disk")[/left]
[left]while true do[/left]
[left]os.pullEvent()[/left]
[left]if disk.isPresent(side) then[/left]
[left]print ("Card Detected.")[/left]
[left]write ("What level is this card? >")[/left]
[left]input = read()[/left]
[left]disk.setLabel(side, "Level "..input.." Access card")[/left]
[left]file = io.open("disk/level", "w")[/left]
[left]file:write(input)[/left]
[left]file:close()[/left]
[left]print ("Disk has been altered.")[/left]
[left]sleep(1)[/left]
[left]print ("Please remove the disk")[/left]
[left]sleep(5)[/left]
[left]print ("Rebooting…")[/left]
[left]sleep(1)[/left]
[left]os.reboot()[/left]
[left]end[/left]
[left]end[/left]
[left]Read more:http://mccraftcpl.proboards.com/index.cgi?board=programsboard&action=display&thread=163#ixzz21OKI2Amb[/left]