Advertisement
Pro0761

pocket main

Dec 21st, 2020
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2.    This program is free software; you can redistribute it and/or modify
  3.    it under the terms of the GNU General Public License as published by
  4.    the Free Software Foundation; either version 3 of the License, or
  5.    (at your option) any later version.
  6. ]]
  7.  
  8. rednet.open("back")
  9. network= os.getComputerID()
  10.  
  11. function help()
  12.     shell.run("clear")
  13.     print("----------")
  14.     print("Welcome")
  15.     print("----------")
  16.     print("h - help")
  17.     print("p - placement")
  18.     print("m - mining")
  19.     print("l - looting")
  20.     print("r - recuperation")
  21.     print("----------")
  22. end
  23.  
  24. help()
  25.  
  26. while true do
  27.     input = io.read()
  28.  
  29.     if input == "h" then
  30.         help()
  31.     elseif input == "p" then
  32.         rednet.broadcast({network, "New Master"}, "DecaMiner")
  33.  
  34.     elseif input == "m" then
  35.         print("Length ?")
  36.         rednet.broadcast({"m", tonumber(io.read())}, tostring(network))
  37.  
  38.     elseif input == "debug" then
  39.         rednet.broadcast({network, "Debug"}, "DecaMiner")
  40.  
  41.     elseif input == "l" then
  42.         rednet.broadcast({"l"}, tostring(network))
  43.  
  44.     elseif input == "t" then
  45.         print("Test")
  46.         rednet.broadcast({"count"}, tostring(network).."s")
  47.  
  48.         n = 0
  49.         while true do
  50.             a = rednet.receive(tostring(network).."r", 0.2)
  51.             if a==nil then break end
  52.             n = n+1
  53.         end
  54.         print(n)
  55.  
  56.     else
  57.         print(input)
  58.         rednet.broadcast({input}, tostring(network))
  59.     end
  60.  
  61. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement