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

keycard computers keep rebooting

Started by anwoke8204, 28 January 2013 - 09:01 PM
anwoke8204 #1
Posted 28 January 2013 - 10:01 PM
Hi I am using 2 keycard computers in 2 locations, it works for about 5 minutes, then the script resets its self and they stop working, attached below is my keycard script.



password = "my password"
debug_char = "0"
term.clear()
function mainLoop()
while(true) do
event, driveSide = os.pullEventRaw()
if(event=="disk" and driveSide) then
path = disk.getMountPath(driveSide)
if(path) then
path = path.."/access"
file = fs.exists(path) and io.open(path, "r") or nil
end
disk.eject(driveSide)
if(file and file:read()==password) then
rs.setOutput("left", true)
sleep(3)
rs.setOutput("left", false)
end
if(file) then file:close() file = nil end
elseif(debug_char and event=="char" and driveSide==debug_char) then return("break") end
end
end
rs.setOutput("left", false)
sfile = io.open("/startup", "w")
sfile:write('shell.run("keycard")')
sfile:close()
repeat
ok, err, val = pcall(mainLoop)
if(not ok and err) then
if(err=="Terminated") then print ("Access denied.")
else
print(err)
end
end
until(ok and err=="break")



when the computers restart they give a java error and the startup file (houses the script above) just shows
shell.run("keycard")

how can I fix this? I am running the latest tekkit server and client on a windows 2008 server with 2 gigs ram dedicated to tekkit and running McMyAdmin as the server admin interface
Lyqyd #2
Posted 29 January 2013 - 04:41 AM
Split into new topic.