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

Order in which computers yield

Started by KaoS, 28 March 2013 - 11:32 PM
KaoS #1
Posted 29 March 2013 - 12:32 AM
Hi guys, I was just wondering if anyone knew this offhand so I wouldn't have to go through a long and painful testing procedure. does anyone know in which order computers in the minecraft world are run? is it in order of ID or maybe location?

I need to find the computer that runs first when the server is started up because it may have some unique properties and permissions
Goof #2
Posted 29 March 2013 - 01:26 AM
Everytime you place a computer, and run it, it makes a new ID.

The computer system is based on ids.. like when you write a program on a computer, which id is 1, and then destroy it. all the code is saved to the saves/computer/id, folder. and that folder would be activated/booted, first. which then means that the computerID 0 is booting first.

i've actually tested this before on my friends server, and it seems to be the first created ids, which are booting first, and then the others.

i hope i could help :D/>
KaoS #3
Posted 29 March 2013 - 01:28 AM
I knew that but thanks for trying, the sentiment is appreciated. basically what I'm saying is that no 2 CC computers are ever running code simultaneously, that's why you cannot get 2 turtles to dig eachother. I need to know the order they run in
Goof #4
Posted 29 March 2013 - 01:37 AM
oh.. sorry.. i think i misunderstood your question.
Engineer #5
Posted 29 March 2013 - 02:00 AM
I would think by ID order, but when I try this setup:

And I reboot the world( startup = rs.setOutput("back", true) ) it is simultanously..
Maybe the Java loads it all in temp memory and then load everything at once into MC.
I dont know about the Java part though.

Edit: On those signs are the ID's, was for my testing part :P/>
theoriginalbit #6
Posted 29 March 2013 - 02:12 AM
And I reboot the world( startup = rs.setOutput("back", true) ) it is simultanously..
Its actually not. the rate at which the computers run is so fast that we think they run at the same time. one of these would have run first and its not by a matter of seconds, its by a matter of milliseconds. that is what KaoS is trying to find out which runs first..
Engineer #7
Posted 29 March 2013 - 02:22 AM
And I reboot the world( startup = rs.setOutput("back", true) ) it is simultanously..
Its actually not. the rate at which the computers run is so fast that we think they run at the same time. one of these would have run first and its not by a matter of seconds, its by a matter of milliseconds. that is what KaoS is trying to find out which runs first..
The test is, who first runs first, makes the other redstone signale impossible. You see the pistons?
And they were off at the same time..
Engineer #8
Posted 29 March 2013 - 02:39 AM
Okay tested it better, conclusion: [media]http://www.youtube.com/watch?v=wjqrgM5qg9c[/media]
I tested several times, it is always 19 that pops up.
theoriginalbit #9
Posted 29 March 2013 - 02:41 AM
Much better test! :)/>
KaoS #10
Posted 29 March 2013 - 02:50 AM
the redstone takes 0.2 seconds to update, more than long enough for 20 computers to run rs.setOutput

what I would try is attaching 4 computers to a disk drive via those wonderful peripheral cables and make sure there is a monitor above each computer, on the disk drive is a startup file:

local count
if fs.exists("disk/count") then
  local oFile=io.open("disk/count","r")
  count=tonumber(oFile:read())
  oFile:close()
end
count=count or 1
local mon=peripheral.wrap("top")
mon.clear()
mon.setCursorPos(1,1)
mon.write("ID: "..os.computerID())
mon.setCursorPos(1,2)
mon.write("count: "..count)
local oFile=io.open("disk/count","w")
oFile:write(count+1)
oFile:close()

I would make sure that there was no count file and restart the server
KaoS #11
Posted 29 March 2013 - 03:08 AM
oh well. looks like I need to fix my minecraft and get it all tested. thanks anyways guys
MysticT #12
Posted 29 March 2013 - 03:16 AM
This is only a guess, but I would think they are booted on block load/first update, so it really depends on how minecraft loads the chunks and its blocks.
KaoS #13
Posted 29 March 2013 - 03:19 AM
well that sucks :(/>
Cloudy #14
Posted 29 March 2013 - 04:17 AM
This is a bit of a weird question. Basically, computers start in the order Minecraft runs their first ticks. On bootup, an event is queued to start the process. As for redstone setting, any redstone change takes effect on the next minecraft tick (usually less than 0.05s).
KaoS #15
Posted 29 March 2013 - 04:32 AM
yeah, you are right… the position of the computer in the minecraft world makes the difference :(/> looks like my idea will not work unless I can find the one location in the minecraft world that is loaded first and that's just too much trouble