59 posts
Posted 20 November 2014 - 12:15 AM
I used to use the following method to determine if a wrapped computer was already on. It seems like in one of the recent updates h.getID() will always return the computers ID even if it is off. Does anyone know of another method to check to see if the computer is on without using rednet? I would like to do this as a peripheral to avoid having to modify any/all programs that may be running on the computers I'm wanting to use as peripherals as well.
local function isOn(side)
if peripheral.isPresent(side) then
comp = peripheral.wrap(side)
if not comp.getID() then
sState = "Off"
else
sState = "On"
end
return sState
end
end
1080 posts
Location
In the Matrix
Posted 20 November 2014 - 12:29 AM
If I'm not mistaken, if you attempt to turn said computer on, then if it's already on, it won't do anything. However they don't return values, perhaps you might make a suggestion for that?
7083 posts
Location
Tasmania (AU)
Posted 20 November 2014 - 01:36 AM
No method comes to mind, outside of network/redstone communications.
The
easiest method I can think of is to have each system rednet.open() their modems on boot, then register themselves with
rednet.host(). Other computers can then determine if they're running via
rednet.lookup().
59 posts
Posted 20 November 2014 - 03:24 AM
That's what I was afraid of.
Thanks for the Suggestion Bomb Bloke, seems to be a reasonable to solution. I'll go a head and implement that for the time being.
97 posts
Posted 20 November 2014 - 08:49 AM
What about using os.getComputerLabel() or will it still show a label if the computer is off? If oyu are using wired modems you can force the other computers to turn on. by using c = peripheral.wrap("side") c.turnOn()
7083 posts
Location
Tasmania (AU)
Posted 20 November 2014 - 09:22 AM
The idea is for one system to be able to detect whether a different system is booted up; os.getComputerLabel() cannot be applied to a remote computer.