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

Autostart throws attempt to index ? but running startup does not

Started by Joeld98, 22 October 2016 - 01:01 AM
Joeld98 #1
Posted 22 October 2016 - 03:01 AM
My advanced computer is starting after a server reboot but errors with attempt to index ? (a nil value) when it tries to access the monitors the first time. If I run startup from the command prompt it works fine.

It's a basic billboard program using 4 network connected monitors (8X6). Should the network devices be accessible on boot?


http://pastebin.com/BJDjbGQu
Bomb Bloke #2
Posted 22 October 2016 - 03:33 AM
Just off the top of my head, does it make a difference if you add a sleep(0) to the top of the script?
Joeld98 #3
Posted 22 October 2016 - 01:00 PM
No difference. I've tried adding sleep steps up to 15 in the startup and in my billboard program.

When the server restarts or when I issue a reboot command I get the nil error at line 114 which is the first attempt to use a monitor.

I'll do some more testing to try to isolate it.
Bomb Bloke #4
Posted 22 October 2016 - 02:40 PM
I suppose another guess at a workaround might be to throw something like this under line five:

if #monitor < 4 then
  sleep(10)
  os.reboot()
end
Edited on 22 October 2016 - 12:41 PM
Joeld98 #5
Posted 24 October 2016 - 10:14 PM
I had a disk drive attached to the computer. As soon as I remove it the computer was able to start and find the monitors without throwing an error.