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

Startup script sometimes only runs after computer activated by right click

Started by Umpani, 10 September 2012 - 05:29 PM
Umpani #1
Posted 10 September 2012 - 07:29 PM
Hello there,

I encountered the problem that under certain conditions (which i was not yet able to determine) the "startup" script in a computer's HDD root directory only runs after i right-click the computer to open the console.
The script is to ensure that the progam is always running when the chunk the comuter is in is loaded. The computer is running on a Bukkit server within a chunk which has a rather complex layout: lots of redstone circuits and machinery with chunk loader. The computer has 3 redstone bundled cables, a wireless modem and 1 peripheral cable (Xfel's peripherals) with 4 monitors and 5 digitals chests connected to it.

My question: Is this a known problem (possibly with a solution) or should I invest more time in finding the cause for it?

I don't need instructions on finding out whether this is caused by a 3rd party mod, I just want to make sure this is not an already known problem.

Cheers,
Umpani
D3matt #2
Posted 10 September 2012 - 08:02 PM
Was the computer on before it was right clicked?
Umpani #3
Posted 11 September 2012 - 02:20 AM
What do you mean by "on"? Aren't CC computers always sort of "on"? I can tell that the startup script didnt execute when the chunk loaded, otherwise there would be output on the attached monitors.
When I richt click the computer, i see the CraftOS string and shortly after the startup script executing (which should have already happend on chunk load).
Luanub #4
Posted 11 September 2012 - 03:01 AM
No they aren't always on. Make sure it is on, by right clicking it, prior to the chunk unloading, or logging out of the game. Then when the chunk loads the computer should be on and the startup script should execute. It should remember that it was on, it won't know where it was at in the code prior to the unload but it will start the script.

I do this on a good majority of my CC computers and turtles and it always works. I've done this on just minecraft with forge and CC, as well as on technic and tekkit.

From the sounds of it the computer was not on prior to the chunk unloading.
Umpani #5
Posted 12 September 2012 - 08:06 AM
Athough I did not know about the computers' on/off status I can tell that the computer was definitely on each time before unloading. I did not check the computer itself, but the monitors it directs output to: Text on monitors is updated (program is running).

When I logged in this morning, the computer was not running. I had to right-click to get the start script running, but then again, after I restarted the Bukkit server and logged back in, the script started just fine without any interaction.It's really strange, i just can't pinpoint the exact circumstances under which this happens.
Cranium #6
Posted 12 September 2012 - 03:50 PM
I have this happen too sometimes. Not sure if it is a problem with the bukkit port, or if it's just a config thing, but this never happens in my SSP worlds, only in SMP…We might have to look into that.
Falesh #7
Posted 15 September 2012 - 09:38 PM
I'm getting this issue too. I got it on the standard Tekkit install and I also still get it after upgrading to CC 1.41.
Falesh #8
Posted 15 September 2012 - 10:48 PM
Is it possible to code a work around that tells computercraft that any computer found in a chunk when it is loaded should always turned on regardless of its previous state?
Cloudy #9
Posted 15 September 2012 - 11:22 PM
Is it possible to code a work around that tells computercraft that any computer found in a chunk when it is loaded should always turned on regardless of its previous state?

That would be a stupid thing to do.

The problem with this bug is that I've not been able to reproduce it - but hopefully I've killed it in the next version.
Falesh #10
Posted 15 September 2012 - 11:53 PM
Is it possible to code a work around that tells computercraft that any computer found in a chunk when it is loaded should always turned on regardless of its previous state?

That would be a stupid thing to do.

The problem with this bug is that I've not been able to reproduce it - but hopefully I've killed it in the next version.
I didn't mean for you to do that, rather if it was possible for me since a hack like that wouldn't cause me a problem.
Nonsanity #11
Posted 02 October 2012 - 07:44 PM
I believe I'm seeing the same issue. Here are some examples.

On our Tekkit server, we have a nether ice road for rapid traversal of the world. I've set up each branch with a nice ComputerCraft monitor sign with a "startup" program on the labeled computer below that sets the text. None of these chunks are forceloaded, but they do of course get loaded often as people travel the road, and eventually unloaded by Minecraft. Sometimes the signs look correct and have their text. Other times they are blank and the attached computer also appears off. Right-clicking the computer boots it and starts up the program. (I did have them behind the wall, but had to expose part of them so this hack-fix could be done.) Also, sometimes the monitor blocks will apparently be facing the wrong direction, which is a client-specific condition. This seems separate from whether the program is running and the text is displayed or not. (The text can be over the side texture of the monitor in that case.)

Another instance of the not-starting-up problem is in a factory I've put together. A labeled computer's program "startup" handles distribution of fabricated uu matter into different portions of the factory to create the raw materials for solar panels in the correct ratios. The program uses the "http" API to report the flow of uu matter to an external program (monitored through a AJAX web page). The chunks containing the computer and the factory are loaded by chunk loaders. Both World Anchors and Dimentional Anchors have been used. The server is set to reboot twice a day (3am and 3pm my local time). During the reboot, my monitoring web page notes the lack of updates. When the reboot is complete, the computer resumes communications with the web page. But after a few minutes, this ceases. Visiting the computer in-world shows that it is off, and a right-click is required to restart it and get the program running again. I'm posting this at 2:20pm my time, so in forty mnutes this should repeat itself, as can be seen here. The "Time since last update:" value will be red if communication with the computercraft program has ceased for over a minute. I'll eventually ask someone who's online to take the ice road over and restart the computer after verifying that it is indeed off.

[That link is a work-in-progress and will not necessarily still be there in the future, so archives of this thread will probably not have access to it.]

I've been unable to think of any way to get it to auto-restart, and upgrading to a newer version of CC (as much as I'd like to) is imppossible given the large number of people that rely on Tekkit to make managing mods simple. Until Tekkit updates, we must continue to use this version. The only code update that could possibly fix the issue would have to be a server-side-only change to the 1.33 version (a 1.33r2 or some such). I'd be happy with a config change or something that can be done in-world to prevent this, if such is at all possible.

Thanks,
~ Nonsanity
Cranium #12
Posted 02 October 2012 - 07:51 PM
If I remember correctly, one way to fix this would be to have the computer on at unload or server restart. That way, it will remember that part. Not sure if this is true, but I do seem to remember this same question before….
Nonsanity #13
Posted 02 October 2012 - 07:58 PM
All of these computers are always on and in looping code. They are never shut down and the programs are ongoing. If they stop, it is because of something other than the program itself. It's coming up on restart time for the system. It's running now, so lets see what happens.
Cranium #14
Posted 02 October 2012 - 08:02 PM
I just read through your very long description…Is nobody in the area of your computers after restart? If not, you may want to put a chunkloader nearby, because if the computers are not in a loaded chunk, they can't turn on, and report….
Nonsanity #15
Posted 02 October 2012 - 08:13 PM
The factory does have chunk loaders, so that isn't the issue (as I mentioned in the long, detailed post :(/>/>) but as for the current state, it seems my web hosting provider has gone offline JUST as I needed them. Typical. Well, when they get it back up again, I should be able to immediately tell if the computercraft program is still running and attempting to contact the web site. My guess is that it won't be, despite being in a loaded chunk.

It DID resume communication with the web site immediately after the reboot of the tekkit server. I confirmed that. But previous instances (the twice-daily reboot every 12 hours for the last few days) it always stops working about 5 minutes or so after the restart, and is apparently off when someone goes to visit it.
Tr33x0rs #16
Posted 30 December 2012 - 09:53 PM
I have this exact same issue, which I've posted about here - http://www.computercraft.info/forums2/index.php?/topic/7509-select-computers-turning-off/page__pid__63923#entry63923

Has anyone found a fix for this issue? It's driving me nuts. I have replaced the entire /mods/computercraft folder, as well as deleting my /world/computer and starting a new. I notice that when the computer doesn't "start up" correctly, the computer does not show a cursor on the screen until you right click to access the console. No idea why this works fine on my other server host, although when I moved the server it's giving me a problem. I did delete my session.lock just incase it was causing issues. Thanks guys, I have been working on this for about a week now and I'm almost out of ideas.