#1
Posted 04 January 2013 - 10:41 AM
First of all, I intend to have some computers running continuously; but I've read in the forums some people are having a problem with computers randomly turning off and needing a manual reset. This of course is a bit inconvenient in a multiplayer server, requiring someone to be available to manually reset them when necessary. I have, however, read somewhere in the wiki that computers that have been running continuously without doing os.pullevent will be automatically shut down after ten minutes (may this be the problem some are experiencing, or did I understand wrong?). The issue here is that os.pullevent will freeze until an event or timeout occurs if I understood right, which would temporarily halt program execution. Am I understanding everything right about this? Is there a way around that?
Second, I saw in a mod highlight that placing a computer in the world will assign it an autoincremental numeric ID. When the computer is "mined" then replaced, if it doesn't have a Label it will receive a new numeric ID. The questions are:
> Is there a maximum ID? (or maximum number of computers that can ever be placed in a single world)
> If so, is there a way to reset the count so that new computers will take lower IDs from previously discarded computers?
From what I've seen, a possible way to reuse an old ID is to /give (or place with worldedit) a computerblockID:computerID, but it might not be the only one. This also brings me to the next question: Is it possible (just possible, not necessarily wanted or unwanted) that more than one computer has the same ID? Would this make two computers with the same contents or two instances of the same computer?
Sorry if I seem a bit too obsessed over details, but (especially with my background in IT) these are inevitable questions to me.
I've never programmed in Lua but seems easy enough to be worth a try! To the mod devs, this is a fantastic mod, congratulations.
Thanks in advance.
#3
Posted 04 January 2013 - 12:22 PM
#4
Posted 04 January 2013 - 12:29 PM
#5
Posted 04 January 2013 - 12:36 PM
#6
Posted 04 January 2013 - 12:47 PM
TheArchitect, on 04 January 2013 - 12:22 PM, said:
Maybe not hearing you right but i've heard of it shutting down after 10mins, unless there is some input from something...
Maybe you could do os.pullEvent(2)
waits two secound for an event then moves on, if you need a os.pullEvent to stop it haulting add a time out one for a short period....
IM PROBS TALKING [email protected]
#10
Posted 04 January 2013 - 12:58 PM
while not redstone do
if not rs.input(bla) then
redstone = true
end
sleep(1)
end
print("Redstone is on!")
would terminate after 10 minutes but
os.pullEvent("redstone")
print("Redstone is on!")
would not).
Please forgive the sloppy code, I was just making it up to explain my point.
#11
Posted 04 January 2013 - 01:04 PM
#12
Posted 04 January 2013 - 01:14 PM
local function pullEvent()
while true do
os.startTimer(100) --Starts a timer which will go off and activate os.pullEvent() after 100 seconds
local event, arg1, arg2 = os.pullEvent()
if event ~= "timer" then
return event, arg1, arg2
else
--Do whatever other code you wish to do here
end
end
end
As for computer IDs, there is no limit (or if there is, I doubt you could ever reach it). And yes, technically it is possible to get two computers with the same ID if they are labeled and you break them in creative mode. They will have the same files on them but their runtimes are separate meaning you could be running two different programs at the exact same time. You can not change the ID of a computer, but you can unlabel it (type in "label" without arguments in the command line to see different label commands).
#13
Posted 04 January 2013 - 01:17 PM
thislooksfun, on 04 January 2013 - 12:58 PM, said:
while not redstone do
if not rs.input(bla) then
redstone = true
end
sleep(1)
end
print("Redstone is on!")
would terminate after 10 minutes but
os.pullEvent("redstone")
print("Redstone is on!")
would not).
Please forgive the sloppy code, I was just ma
king it up to explain my point.
But what happens when there is no event with os.pullEvent for 10mins, will it shutdown? Ill go test my time out cmd i read it somewhere i think....
#14
Posted 04 January 2013 - 01:39 PM
x0pk1n, on 04 January 2013 - 01:17 PM, said:
thislooksfun, on 04 January 2013 - 12:58 PM, said:
while not redstone do
if not rs.input(bla) then
redstone = true
end
sleep(1)
end
print("Redstone is on!")
would terminate after 10 minutes but
os.pullEvent("redstone")
print("Redstone is on!")
would not).
Please forgive the sloppy code, I was just ma
king it up to explain my point.
But what happens when there is no event with os.pullEvent for 10mins, will it shutdown? Ill go test my time out cmd i read it somewhere i think....
It doesn't matter if you're using that code I just posted. It sends a timer event every 100 seconds so the computer will never turn off.
#15
Posted 04 January 2013 - 01:51 PM
#16
Posted 04 January 2013 - 02:19 PM
Which would be 2^32 = 2,147,483,647
So if you manage to get close, let me know, then I want your autograph
#17
Posted 04 January 2013 - 02:22 PM
W00dyR, on 04 January 2013 - 02:19 PM, said:
Which would be 2^32 = 2,147,483,647
So if you manage to get close, let me know, then I want your autograph
Might want to check your math on that one. I guaran-damn-tee you that 2^32 isn't an odd number. And it's approximately 4.3 billion anyway.
#18
Posted 04 January 2013 - 02:47 PM
#19
Posted 04 January 2013 - 03:04 PM
You can reset the ID assignments by deleting the computer folders in your world save.
#20
Posted 04 January 2013 - 03:37 PM
Next goal: Place 2^32 computers in a single world
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











