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

Network monitor detection and reporting.

Started by lebalusch, 26 May 2014 - 04:51 PM
lebalusch #1
Posted 26 May 2014 - 06:51 PM
Hi Guys and Girls

So this is my first mini program I am donating to the community. :)/>

I am sure there is loads out there that does a better job but this is a nice and small program that might fit someone's needs.


How To Use: Its fairly straight forward type when asked the name of the monitor you are trying to locate like "monitor_0". The program will then search for it on the cabled network and print the monitors name and that it is connected to the network. This should help identify it for you. The program will also let you know on the pc too. Currently You will get a error if the monitor is not on the network.



file MnetSearch: http://pastebin.com/YtRRSzKP

If anybody would like to contribute to any improvements feel free. I currently am working on a way to do a "cant find" message instead of using the error report.
apemanzilla #2
Posted 27 May 2014 - 04:43 PM
What? If you know "monitor_0" you already know the name.

Additionally, there are functions in the peripheral API and wired modem API to search for peripherals.
lebalusch #3
Posted 27 May 2014 - 09:33 PM
i designed it due to not wanting to rip up the floor looking for modems to turn off and on to find the name of the monitor out. You might have 2 or 3 in your base or might not be your base. It just helps to point out what ones what.

And thank you I didn't realise there was other API's that done similar things i just made this to solve a simple problem i had.
apemanzilla #4
Posted 27 May 2014 - 11:53 PM
i designed it due to not wanting to rip up the floor looking for modems to turn off and on to find the name of the monitor out. You might have 2 or 3 in your base or might not be your base. It just helps to point out what ones what.

And thank you I didn't realise there was other API's that done similar things i just made this to solve a simple problem i had.
I still don't get what you mean. If you know the name of the peripheral (monitor_0) why would you need to rip up the floors to find the name?
lebalusch #5
Posted 28 May 2014 - 12:57 AM
Ok say you are playing in a world where you have no rights to break blocks and you cant get to the monitor to check what its name is.You might also be in someone else's base and not really want to go breaking blocks to go find out the name of the modem the monitor is attached to. There are 3 monitors in the room. So you could use this program to effectively find out what one is what as it will write its name on the screen. Download it and give it a try.
apemanzilla #6
Posted 28 May 2014 - 01:46 AM
Ah. In that case it may be simpler to loop through the table returned by peripheral.getNames and check for monitor type peripherals, printing on the screens.
lebalusch #7
Posted 28 May 2014 - 04:49 PM
Yes after you mentioned

What? If you know "monitor_0" you already know the name.

Additionally, there are functions in the peripheral API and wired modem API to search for peripherals.


i had a look at the api and it does indeed make the program a little more better. I now make a point of listing all attached peripherals before asking for the monitor you are searching for.