krom

MineCraft - Mining Excavate+ - Controller

Feb 17th, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.90 KB | None | 0 0
  1. -- http://computercraft.info/wiki/Rednet_%28API%29
  2.  
  3. local botname = "Miner 01"
  4. local clientid = 23
  5.  
  6. -- -------------------------
  7. -- init wireless
  8. ----------------------------
  9. bRedNet = rednet.open("right")
  10. bRedNet = rednet.open("left")
  11.  
  12. local function sendCommand(sCommand)
  13.     local count = 0
  14.     local maxCount = 100
  15.     local delay = 0
  16.     for i=0,maxCount do
  17.         rednet.send(clientid, sCommand)
  18.         sleep(0.01)
  19.     end
  20. end
  21.  
  22. print("***************")
  23. print("* MineControl *")
  24. print("***************")
  25. print("Control for: "..botname)
  26. print("Available commands:")
  27. print("(h)ome")
  28. print("(t)erminate")
  29. print("")
  30. local valid = false
  31. while not valid do
  32.     print("Please enter command:")
  33.     bCommand = read()
  34.     if bCommand == "h" or bCommand == "t" then
  35.     valid = true
  36.     end
  37. end
  38.  
  39. if bCommand == "h" then
  40.     sendCommand("home")
  41. else
  42.     sendCommand("terminate")
  43. end
Advertisement
Add Comment
Please, Sign In to add comment