Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Code for updater to go here.
- --[[info]]
- --[[
- -- Program: communication Tester Listener http://pastebin.com/Ju9Lgy7R
- -- Version: v1.0 Alpha
- -- Size: 3.0 KB
- -- Author: Leba Lusch
- -- Created: 25/05/15
- -- Dependencies: yes
- Communications Tester Broadcaster http://pastebin.com/hAHtp36n
- link :
- -- Use:
- Tests communications capacity of your wireless / wired network. Can be used to Test the range suitability.
- This script does the listening. It will tell you the distance to the computer running the Broadcaster script as well as other useful info.
- I have tried to make as many needed comments in the script to help people that want to learn.
- -- Credits:
- All those that have Created and contributed to making Lua & Computercraft what it is today.
- --Links:
- http://www.lua.org/
- http://www.computercraft.info/
- http://www.computercraft.info/forum2
- http://www.minecraft.net
- ]]
- --[[Licence]]
- --[[
- THE SOFTWARE IS PROVIDED "AS IS",
- WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED,
- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
- IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
- ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
- YOU MAY NOT USE ANY PART OF THIS SOFTWARE UNLESS YOU CREDIT THE AUTHOR FOUND ABOVE IN YOUR HEADER.
- YOU MAY NOT USE ANY PART OF THIS SOFTWARE IN A COMERCIAL PRODUCT FOR PROFIT,
- OR SOFTWARE THAT DOES NOT ALLOW THE USER FULL ACCESS TO THE CODE.
- ]]
- local programName = "Communication Tester Listener v1.0 Alpha"
- local modem = peripheral.wrap("top")
- local function newPage()-- clears page and sets cursor to top left of page (works)
- term.clear()
- term.setCursorPos(1,1)
- write(programName)
- write("\n") --new line
- end
- function ASK()
- print("Program Started...\n")
- print("\n Please make sure your modem is on the top of your pc\nor this can be changed in the script")
- print("Also set the broadcaster up first on the other PC")
- print("\nWhat Channel should I listen to 1 to 65535:\n")
- local RX =tonumber(read())
- whatChan = RX
- modem.open(RX)
- end
- --code
- modem.closeAll()
- newPage()
- ASK()
- while true do --The loop
- newPage()
- print ("\nNow listening channel "..whatChan)
- local event, modemSide, senderChannel,
- replyChannel, message, senderDistance = os.pullEvent("modem_message")
- print("\n\nI just received a message from Channel: "..senderChannel)
- print("I should apparently reply on Channel: "..replyChannel)
- print("The modem receiving this is located on the "..modemSide.." side")
- print("The message was: "..message)
- print("The sender is: "..senderDistance.." blocks away from me.")
- sleep(10)
- print("To exit you can ctrl + T out")
- sleep(1)
- print("\nResetting Listener---")
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment