Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ <Mnet>
- program: Mnet
- language: Lua - ComputerCraft
- Written by: Lebalusch <May 26th, 2014>
- http://www.computercraft.info/forums2/index.php?/user/26838-lebalusch/
- Contributors: apemanzilla: advised looking at and use of some peripheral API, wired modem API code. (thank you)
- Notes: Small script to provide the user with a list of attached peripherals and allow easy identification of monitors on a cabled network
- How To Use: Look at list provided and choose the monitor name you wish to help ID if its not on the list then its not on the network.
- size: 3.52 KB
- updates possible from:
- Online- http://pastebin.com/YtRRSzKP
- InGame- pastebin get YtRRSzKP Mnet
- ]]
- --[[ version 1.0.1 <major, minor, Tweak>
- Edits: 28/5/14 - added code to print to terminal a list of all peripherals on the network as you start program.
- ]]
- --[[ Licence: http://opensource.org/licenses/BSD-3-Clause
- Copyright (c) <2014>, <Lebalusch>
- All rights reserved.
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- --ALSO--
- IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR LOSS OF DIAMONDS ,YOUR BASE GOING BOOM OR ANY OTHER MAJOR MUCK UP IN YOUR WORLD. FEEL FREE TO CHOP IT, CHANGE IT, AND LEARN FROM IT. BUT REMEMBER HAVE FUN AT ALL TIMES AND KEEP CODING.
- ]]
- --
- --Program
- --
- --ask what monitor to check
- local periList = peripheral.getNames()
- term.clear()
- term.setCursorPos(1, 2)
- print("--Program To Check Presence of A\nNetworked Monitor.\n")
- for i = 1, #periList do
- print("I have a "..peripheral.getType(periList[i]).." attached as \""..periList[i].."\".")
- end
- print (" \nWhat is the Networked monitors name?")
- local Mlocation = read()
- --monitor code
- local Nmon = peripheral.wrap(Mlocation)
- Nmon.setTextScale(0.5)
- Nmon.setCursorPos(1,1)
- Nmon.clear()
- Nmon.write(Mlocation)
- Nmon.setCursorPos(1,2)
- Nmon.write("Is Connected")
- Nmon.setCursorPos(1,3)
- Nmon.write("To The Network")
- --pc code
- term.clear()
- term.setCursorPos(1,2)
- print(Mlocation," Is Connected on Network")
- print("program terminated-- \n")
- --end
Advertisement
Add Comment
Please, Sign In to add comment