Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Turtle Remote Controle Computer
- -- Minecraft 1.16.5
- -- Forge 36.1.66
- -- Mod: cc-tweaked-1.16.4-1.96.0.jar
- local Version = "1.0.6"
- local System = os -- Used for System things like os.time() to System.time()
- local Screen = term -- Used for Screen thing on the turtle or computer like term.clear() to Screen.clear()
- local Per = peripheral -- Used shortcut for peripheral
- local Text = textutils -- Used shortcut for textilils
- local Pack = Text.serialize -- Makes a new command for packing ( shortcut used from local Text)
- local UnPack = Text.unserialize -- Makes a new command for unpacking ( shortcut used from local Text)
- local Monitor = {}
- Monitor[0] = Screen -- sets Monitor[0] to term
- local file = fs.exists("/API/Logo.lua")
- if not(file) then
- shell.run("pastebin get s3aBGUVr /API/Logo.lua")
- Monitor[0].clear()
- Monitor[0].setCursorPos(1,1)
- end
- System.loadAPI("/API/Logo.lua")
- local w, h = Monitor[0].getSize()
- Monitor[0].clear()
- Logo.drawLogo(Monitor[0], "Head", math.floor(w/2)-6, math.floor(h/2)-4)
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- Monitor[0].setBackgroundColor(colors.white)
- Monitor[0].setTextColor(colors.black)
- Monitor[0].setCursorPos(math.floor((w - string.len("Looking for file...")) /2), (h-1))
- print("Looking for files...")
- local file0 = fs.exists("/API/Functions.lua")
- local file1 = fs.exists("/API/Button.lua")
- local file2 = fs.exists("/API/MonButton.lua")
- Monitor[0].setBackgroundColor(colors.black)
- Monitor[0].setTextColor(colors.white)
- sleep(1)
- if not(file0) then
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- Monitor[0].setBackgroundColor(colors.white)
- Monitor[0].setTextColor(colors.black)
- Monitor[0].setCursorPos(math.floor((w - string.len("Downloading Function file...")) /2), (h-1))
- print("Downloading Function file...")
- shell.run("pastebin get sujHjqXC /API/Functions.lua")
- Monitor[0].setBackgroundColor(colors.black)
- Monitor[0].setTextColor(colors.white)
- sleep(1)
- end
- if not(file1) then
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- Monitor[0].setBackgroundColor(colors.white)
- Monitor[0].setTextColor(colors.black)
- Monitor[0].setCursorPos(math.floor((w - string.len("Downloading Button file...")) /2), (h-1))
- print("Downloading Button file...")
- shell.run("pastebin get mKpxpWmZ /API/Button.lua")
- Monitor[0].setBackgroundColor(colors.black)
- Monitor[0].setTextColor(colors.white)
- sleep(1)
- end
- if not(file2) then
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- Monitor[0].setBackgroundColor(colors.white)
- Monitor[0].setTextColor(colors.black)
- Monitor[0].setCursorPos(math.floor((w - string.len("Downloading Monitor Button file...")) /2), (h-1))
- print("Downloading Monitor Button file...")
- shell.run("pastebin get mKpxpWmZ /API/MonButton.lua")
- Monitor[0].setBackgroundColor(colors.black)
- Monitor[0].setTextColor(colors.white)
- sleep(1)
- end
- Monitor[0].clear()
- Logo.drawLogo(Monitor[0], "Head", math.floor(w/2)-6, math.floor(h/2)-4)
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- Monitor[0].setBackgroundColor(colors.white)
- Monitor[0].setTextColor(colors.black)
- Monitor[0].setCursorPos(math.floor((w - string.len("Installing files...")) /2), (h-1))
- print("Installing files...")
- System.loadAPI("/API/Functions.lua")
- System.loadAPI("/API/Button.lua")
- System.loadAPI("/API/MonButton.lua")
- Button.setMonitor(false)
- Functions.SetColors(Monitor[0], colors.black, colors.white)
- sleep(1)
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- local Disk = Functions.FindDisk()
- sleep(1)
- if Disk then
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- Functions.SetColors(Monitor[0], colors.white, colors.black)
- Monitor[0].setCursorPos(math.floor((w - string.len("Installing Disk...")) /2), (h-1))
- print("Installing Disk...")
- Disk = Per.wrap(Disk)
- Functions.SetColors(Monitor[0], colors.black, colors.white)
- sleep(1)
- end
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- local Modem = Functions.FindModem()
- sleep(1)
- if Modem then
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- Functions.SetColors(Monitor[0], colors.white, colors.black)
- Monitor[0].setCursorPos(math.floor((w - string.len("Installing Modem...")) /2), (h-1))
- print("Installing Modem...")
- Modem = Per.wrap(Modem)
- Modem.Send = Modem.transmit
- Modem.closeAll()
- Functions.SetColors(Monitor[0], colors.black, colors.white)
- sleep(1)
- end
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- local WModem = Functions.FindWirelessModem()
- sleep(1)
- if WModem then
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- Functions.SetColors(Monitor[0], colors.white, colors.black)
- Monitor[0].setCursorPos(math.floor((w - string.len("Installing Wireless Modem...")) /2), (h-1))
- print("Installing Wireless Modem...")
- WModem = Per.wrap(WModem)
- WModem.Send = WModem.transmit
- WModem.closeAll()
- Functions.SetColors(Monitor[0], colors.black, colors.white)
- sleep(1)
- end
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- Monitor[1] = Functions.FindMonitor()
- sleep(1)
- if Monitor[1] then
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- Functions.SetColors(Monitor[0], colors.white, colors.black)
- Monitor[0].setCursorPos(math.floor((w - string.len("Installing Monitor...")) /2), (h-1))
- print("Installing Monitor...")
- Monitor[1] = Per.wrap(Monitor[1])
- MonButton.setMonitor(true)
- Functions.SetColors(Monitor[0], colors.black, colors.white)
- local mw, mh = Monitor[1].getSize()
- Logo.drawLogo(Monitor[1], "Head", math.floor(mw/2)-6, math.floor(mh/2)-3)
- sleep(1)
- end
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- local Printer = Functions.FindPrinter()
- sleep(1)
- if Printer then
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- Functions.SetColors(Monitor[0], colors.white, colors.black)
- Monitor[0].setCursorPos(math.floor((w - string.len("Installing Printer...")) /2), (h-1))
- print("Installing Printer...")
- Printer = Per.wrap(Printer)
- Functions.SetColors(Monitor[0], colors.black, colors.white)
- sleep(1)
- end
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- local Speaker = Functions.FindSpeaker()
- sleep(1)
- if Speaker then
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- Functions.SetColors(Monitor[0], colors.white, colors.black)
- Monitor[0].setCursorPos(math.floor((w - string.len("Installing Speaker...")) /2), (h-1))
- print("Installing Speaker...")
- Speaker = Per.wrap(Speaker)
- Functions.SetColors(Monitor[0], colors.black, colors.white)
- sleep(1)
- end
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- Functions.SetColors(Monitor[0], colors.white, colors.black)
- Monitor[0].setCursorPos(math.floor((w - string.len("Done")) /2), (h-1))
- print("Done")
- Functions.SetColors(Monitor[0], colors.black, colors.white)
- sleep(1)
- local Computer = { System = {ComputerName = "R_Controle_Turtles ",
- OldComputerName = System.getComputerLabel(),
- Status = true,
- LogOn = false,
- Modem = {ServerID = 0,
- SharedID = 0,
- OwnID = 1000,
- foundWireless = false
- },
- First = true,
- Nether = false,
- StateMonitor = false
- },
- Connection = {Connected = false,
- ConnectedID = 0,
- ConnectedTurtle = {}
- }
- }
- local Turtles = {}
- local TreeFarms = {}
- local OverworldFarms = {}
- local NetherFarms = {}
- local TravelHeight = 250
- local Color = { Green = colors.green,
- Red = colors.red,
- Black = colors.black,
- White = colors.white,
- Orange = colors.orange,
- Magenta = colors.magenta,
- LightBlue = colors.lightBlue,
- Yellow = colors.yellow,
- Lime = colors.lime,
- Pink = colors.pink,
- Gray = colors.gray,
- LightGray = colors.lightGray,
- Cyan = colors.cyan,
- Purple = colors.purple,
- Blue = colors.blue,
- Brown = colors.brown,
- }
- local Temp = {}
- local Timer = {}
- local Tool = {
- PickAxe = "minecraft:diamond_pickaxe",
- Shovel = "minecraft:diamond_shovel",
- Axe = "minecraft:diamond_axe",
- Hoe = "minecraft:diamond_hoe",
- Sword = "minecraft:diamond_sword"
- }
- local GoToX, GoToY, GoToZ, Radius, Layer = 0, 0, 0, 3, 6
- local MinRadius = 3
- local MaxRadius = 129
- local FreeGroupT = {}
- local Enter
- local Number
- local ButtonForward
- local ButtonBack
- local ButtonLeft
- local ButtonRight
- local ButtonUp
- local ButtonDown
- local Sec = 1
- local Min = Sec * 60
- local HalfHour = Min * 30
- local Hour = HalfHour * 2
- local w, h = Screen.getSize()
- local NameLen = 17
- local nMonitorOption = 0
- local nMonitorTurtleInventoryOption = 0
- local nOption = 1
- local nSystemOption = 1
- local nTurtlesOption = 1
- local nTurtleInfoOption = 1
- local nTurtleSystemOption = 1
- local nTurtleEquipOption = 1
- local nTurtleDetectOption = 1
- local mTurtleInspectOption = 1
- local nTurtleCompareOption = 1
- local nTurtleMovementsOption = 1
- local nTurtleAttackOption = 1
- local nTurtleDigOption = 1
- local nTurtleSuckOption = 1
- local nTurtleDropOption = 1
- local nTurtlePlaceOption = 1
- local nTurtleProgramsOption = 1
- local MaxOptions = 5
- local MaxSystemOptions = 4
- local MaxTurtlesOptions
- local MaxTurtleInfoOptions = 2
- local MaxTurtleSystemOptions = 13
- local MaxTurtleEquipOptions = 2
- local MaxTurtleDetectOptions = 3
- local MaxTurtleInspectOptions = 3
- local MaxTurtleCompareOptions = 3
- local MaxTurtleMovementsOptions = 9
- local MaxTurtleAttackOptions = 3
- local MaxTurtleDigOptions = 3
- local MaxTurtleSuckOptions = 3
- local MaxTurtleDropOptions = 3
- local MaxTurtlePlaceOptions = 3
- local MaxTurtleProgramsOptions = 5
- Temp.FarmTimer = Hour * 2
- System.setComputerLabel(Computer.System.ComputerName)
- function HadError(Mess)
- print(Mess)
- Function.SetColors(Monitor[0], Color.Black, Color.White)
- Monitor[0].setCursorPos(1, h)
- error()
- end
- local InventoryButton = {}
- function ConfigInventoryBottons()
- local mx, my = Monitor[1].getSize()
- local BottomMonitor = my - 1
- local TopMonitor = 1 + 1
- local EndMonitor = mx + 1
- local BeginMonitor = 1 + 1
- -- Inventory Buttons on monitor
- MINVButton.clearButtons()
- for i = 1, 16 do
- InventoryButton[i] = false
- end
- MINVButton.setButton("1", ClickedInventoryButton, BeginMonitor, BeginMonitor + 4, TopMonitor + 3, TopMonitor + 5, true, "1")
- MINVButton.setButton("2", ClickedInventoryButton, BeginMonitor + 6, BeginMonitor + 10, TopMonitor + 3, TopMonitor + 5, true, "2")
- MINVButton.setButton("3", ClickedInventoryButton, BeginMonitor + 12, BeginMonitor + 16, TopMonitor + 3, TopMonitor + 5, true, "3")
- MINVButton.setButton("4", ClickedInventoryButton, BeginMonitor + 18, BeginMonitor + 22, TopMonitor + 3, TopMonitor + 5, true, "4")
- MINVButton.setButton("5", ClickedInventoryButton, BeginMonitor, BeginMonitor + 4, TopMonitor + 7, TopMonitor + 9, true, "5")
- MINVButton.setButton("6", ClickedInventoryButton, BeginMonitor + 6, BeginMonitor + 10, TopMonitor + 7, TopMonitor + 9, true, "6")
- MINVButton.setButton("7", ClickedInventoryButton, BeginMonitor + 12, BeginMonitor + 16, TopMonitor + 7, TopMonitor + 9, true, "7")
- MINVButton.setButton("8", ClickedInventoryButton, BeginMonitor + 18, BeginMonitor + 22, TopMonitor + 7, TopMonitor + 9, true, "8")
- MINVButton.setButton("9", ClickedInventoryButton, BeginMonitor, BeginMonitor + 4, TopMonitor + 11, TopMonitor + 13, true, "9")
- MINVButton.setButton("10", ClickedInventoryButton, BeginMonitor + 6, BeginMonitor + 10, TopMonitor + 11, TopMonitor + 13, true, "10")
- MINVButton.setButton("11", ClickedInventoryButton, BeginMonitor + 12, BeginMonitor + 16, TopMonitor + 11, TopMonitor + 13, true, "11")
- MINVButton.setButton("12", ClickedInventoryButton, BeginMonitor + 18, BeginMonitor + 22, TopMonitor + 11, TopMonitor + 13, true, "12")
- MINVButton.setButton("13", ClickedInventoryButton, BeginMonitor, BeginMonitor + 4, TopMonitor + 15, TopMonitor + 17, true, "13")
- MINVButton.setButton("14", ClickedInventoryButton, BeginMonitor + 6, BeginMonitor + 10, TopMonitor + 15, TopMonitor + 17, true, "14")
- MINVButton.setButton("15", ClickedInventoryButton, BeginMonitor + 12, BeginMonitor + 16, TopMonitor + 15, TopMonitor + 17, true, "15")
- MINVButton.setButton("16", ClickedInventoryButton, BeginMonitor + 18, BeginMonitor + 22, TopMonitor + 15, TopMonitor + 17, true, "16")
- MINVButton.setButton("Refuel", Do, BeginMonitor + 24, BeginMonitor + 33, TopMonitor + 3, TopMonitor + 5, true, "Fuel")
- MINVButton.setButton("Empty", Do, BeginMonitor + 24, BeginMonitor + 33, TopMonitor + 7, TopMonitor + 9, true, "EmptyInventory")
- MINVButton.setButton("Slot", Do, BeginMonitor + 35, BeginMonitor + 40, TopMonitor + 5, TopMonitor + 7, false, "EmptyInventorySlot")
- MINVButton.setButton("All", Do, BeginMonitor + 35, BeginMonitor + 40, TopMonitor + 9, TopMonitor + 11, false, "EmptyInventoryAll")
- MINVButton.setButton("Equip", Do, BeginMonitor + 24, BeginMonitor + 33, TopMonitor + 11, TopMonitor + 13, true, "EquipLeft")
- MINVButton.setButton("Transfer", Do, BeginMonitor + 24, BeginMonitor + 33, TopMonitor + 15, TopMonitor + 17, true, "Transfer")
- if nMonitorTurtleInventoryOption == 0 then
- nMonitorTurtleInventoryOption = Computer.Connection.ConnectedTurtle.SlotSelected
- InventoryButton[nMonitorTurtleInventoryOption] = true
- MINVButton.toggleButton(tostring(nMonitorTurtleInventoryOption))
- end
- end
- local MButtonn = false
- local ButtonInfo = false
- local ButtonInventory = false
- local ButtonQuarry2 = false
- function ConfigMonitor()
- local mx, my = Monitor[1].getSize()
- local BottomMonitor = my - 1
- local TopMonitor = 1 + 1
- local EndMonitor = mx + 1
- local BeginMonitor = 1 + 1
- MMenuButton.clearButtons()
- MMoveButton.clearButtons()
- MStripMineButton.clearButtons()
- -- Menu Buttons on monitor
- MMenuButton.setButton("M", MoveMentOption, BeginMonitor + 3, BeginMonitor + 5, BottomMonitor - 9, BottomMonitor - 7, true)
- MMenuButton.setButton("Info", TurtleInfo, BeginMonitor - 1, BeginMonitor + 4, TopMonitor - 1, TopMonitor + 1, true)
- MMenuButton.setButton("Inventory", InventoryInfo, BeginMonitor + 5, BeginMonitor + 16, TopMonitor - 1, TopMonitor + 1, true)
- MMenuButton.setButton("Strip Mine", Quarry2, BeginMonitor + 17, BeginMonitor + 28, TopMonitor - 1, TopMonitor + 1, true)
- -- Strip Mine Buttons on monitor
- local ButtonMinStart = 16
- local ButtonPlusStart = 36
- local ButtonEditStart = 48
- local ButtonLength = 10
- local ButtonHeight = 2
- MStripMineButton.setButton("- X", Quarry, ButtonMinStart, ButtonMinStart + ButtonLength, 5, 5 + ButtonHeight, true, "XMin")
- MStripMineButton.setButton("+ X", Quarry, ButtonPlusStart, ButtonPlusStart + ButtonLength, 5, 5 + ButtonHeight, true, "XPlus")
- MStripMineButton.setButton("E X", Edit, ButtonEditStart, ButtonEditStart + ButtonLength, 5, 5 + ButtonHeight, true, "XEdit")
- MStripMineButton.setButton("- Z", Quarry, ButtonMinStart, ButtonMinStart + ButtonLength, 5 + 3, (5 + 3) + ButtonHeight, true, "ZMin")
- MStripMineButton.setButton("+ Z", Quarry, ButtonPlusStart, ButtonPlusStart + ButtonLength, 5 + 3, (5 + 3) + ButtonHeight, true, "ZPlus")
- MStripMineButton.setButton("E Z", Edit, ButtonEditStart, ButtonEditStart + ButtonLength, 5 + 3, (5 + 3) + ButtonHeight, true, "ZEdit")
- MStripMineButton.setButton("- Layer", Quarry, ButtonMinStart, ButtonMinStart + ButtonLength, 5 + 7, (5 + 7) + ButtonHeight, true, "LayerMin")
- MStripMineButton.setButton("+ Layer", Quarry, ButtonPlusStart, ButtonPlusStart + ButtonLength, 5 + 7, (5 + 7) + ButtonHeight, true, "LayerPlus")
- MStripMineButton.setButton("E Layer", Edit, ButtonEditStart, ButtonEditStart + ButtonLength, 5 + 7, (5 + 7) + ButtonHeight, true, "LayerEdit")
- MStripMineButton.setButton("- Radius", Quarry, ButtonMinStart, ButtonMinStart + ButtonLength, 5 + 11, (5 + 11) + ButtonHeight, true, "RadiusMin")
- MStripMineButton.setButton("+ Radius", Quarry, ButtonPlusStart, ButtonPlusStart + ButtonLength, 5 + 11, (5 + 11) + ButtonHeight, true, "RadiusPlus")
- MStripMineButton.setButton("E Radius", Edit, ButtonEditStart, ButtonEditStart + ButtonLength, 5 + 11, (5 + 11) + ButtonHeight, true, "RadiusEdit")
- MStripMineButton.setButton("Start", Quarry, ButtonMinStart, ButtonMinStart + ButtonLength, 5 + 15, (5 + 15) + ButtonHeight, true, "Start")
- MStripMineButton.setButton("Reset", Quarry, ButtonPlusStart, ButtonPlusStart + ButtonLength, 5 + 15, (5 + 15) + ButtonHeight, true, "Reset")
- -- Move Buttons on monitor
- MMoveButton.setButton("H", Do, BeginMonitor, BeginMonitor + 2, BottomMonitor - 5, BottomMonitor - 3, true, "GoHome")
- MMoveButton.setButton("G", Do, BeginMonitor + 6, BeginMonitor + 8, BottomMonitor - 5, BottomMonitor - 3, true, "GoTo")
- MMoveButton.setButton("W", Move, BeginMonitor + 3, BeginMonitor + 5, BottomMonitor - 5, BottomMonitor - 3, true, "forward")
- MMoveButton.setButton("S", Move, BeginMonitor + 3, BeginMonitor + 5, BottomMonitor - 2, BottomMonitor, true, "back")
- MMoveButton.setButton("A", Move, BeginMonitor, BeginMonitor + 2, BottomMonitor - 2, BottomMonitor, true, "left")
- MMoveButton.setButton("D", Move, BeginMonitor + 6, BeginMonitor + 8, BottomMonitor - 2, BottomMonitor, true, "right")
- MMoveButton.setButton("R", Move, BeginMonitor + 10, BeginMonitor + 12, BottomMonitor - 5, BottomMonitor - 3, true, "up")
- MMoveButton.setButton("F", Move, BeginMonitor + 10, BeginMonitor + 12, BottomMonitor - 2, BottomMonitor, true, "down")
- MMoveButton.setButton("-) ^", Dig, BeginMonitor + 14, BeginMonitor + 18, BottomMonitor - 8, BottomMonitor - 6, true, "up")
- MMoveButton.setButton("-) ", Dig, BeginMonitor + 14, BeginMonitor + 18, BottomMonitor - 5, BottomMonitor - 3, true, "forward")
- MMoveButton.setButton("-) v", Dig, BeginMonitor + 14, BeginMonitor + 18, BottomMonitor - 2, BottomMonitor, true, "down")
- MMoveButton.setButton("P ^", Place, BeginMonitor + 20, BeginMonitor + 23, BottomMonitor - 8, BottomMonitor - 6, true, "up")
- MMoveButton.setButton("P ", Place, BeginMonitor + 20, BeginMonitor + 23, BottomMonitor - 5, BottomMonitor - 3, true, "forward")
- MMoveButton.setButton("P v", Place, BeginMonitor + 20, BeginMonitor + 23, BottomMonitor - 2, BottomMonitor, true, "down")
- MMoveButton.setButton("S ^", Suck, BeginMonitor + 25, BeginMonitor + 28, BottomMonitor - 8, BottomMonitor - 6, true, "up")
- MMoveButton.setButton("S ", Suck, BeginMonitor + 25, BeginMonitor + 28, BottomMonitor - 5, BottomMonitor - 3, true, "forward")
- MMoveButton.setButton("S v", Suck, BeginMonitor + 25, BeginMonitor + 28, BottomMonitor - 2, BottomMonitor, true, "down")
- MMoveButton.setButton("D ^", Drop, BeginMonitor + 30, BeginMonitor + 33, BottomMonitor - 8, BottomMonitor - 6, true, "up")
- MMoveButton.setButton("D ", Drop, BeginMonitor + 30, BeginMonitor + 33, BottomMonitor - 5, BottomMonitor - 3, true, "forward")
- MMoveButton.setButton("D v", Drop, BeginMonitor + 30, BeginMonitor + 33, BottomMonitor - 2, BottomMonitor, true, "down")
- end
- function Load()
- if not(WModem) then
- print("No WirelessModem Found !")
- error()
- end
- end
- function checkForTurtles()
- local Event, Side, SId, RId, Message
- while Message == nil do
- local Data = {What = "Command", Command = "/CH3CK/"}
- WModem.Send(Computer.System.Modem.ServerID, Computer.System.Modem.OwnID, Pack(Data))
- local timer = System.startTimer(5)
- Event, Side, SId, RId, Message = System.pullEvent("modem_message")
- end
- Turtles = UnPack(Message)
- end
- function LoadSettings()
- local File = fs.exists("/Progs/.Data/.Settings.set")
- local Data
- if File then
- Data = Functions.LoadFile("/Progs/.Data/.Settings.set")
- Computer.System.First = Data.First
- Computer.System.Modem.OwnID = Data.ComputerId
- Computer.System.Modem.ServerID = Data.ServerId
- Computer.System.Nether = Data.Nether
- Computer.System.Modem.SharedID = Data.CharedChannelId
- Computer.System.ComputerName = Data.ComputerName
- else
- if Computer.System.First == true then
- Asking()
- Computer.System.First = false
- end
- SaveSettings()
- end
- end
- function SaveSettings()
- local Data = {First = Computer.System.First, ComputerName = Computer.System.ComputerName, ServerId = Computer.System.Modem.ServerID, ComputerId = Computer.System.Modem.OwnID, CharedChannelId = Computer.System.Modem.SharedID, Nether = Computer.System.Nether}
- local Map = fs.exists("/Progs/.Data")
- if not(Map) then
- fs.makeDir("/Progs/.Data")
- end
- Functions.SaveFile("/Progs/.Data/.Settings.set", "w", Data)
- end
- function Asking()
- Monitor[0].clear()
- Monitor[0].setCursorPos(1, 1)
- print("Welcome :-D")
- print(" ")
- write("Computer name: ")
- Computer.System.ComputerName = read()
- write("Computer ID: ")
- Computer.System.Modem.OwnID = tonumber(read())
- write("Chared Channel Id: ")
- Computer.System.Modem.SharedID = tonumber(read())
- write("ServerId: ")
- Computer.System.Modem.ServerID = tonumber(read())
- write("Nether Y/N: ")
- local Event, Key, IsHeld = System.pullEvent("key")
- if Key == keys.y then
- Computer.System.Nether = true
- else
- Computer.System.Nether = false
- end
- print(tostring(Nether))
- end
- -- Script Check and Update from the Server
- function CheckVersion()
- Temp.OldVersion = {}
- Temp.OldVersion.A = tonumber(string.sub (Version, 1, 1))
- Temp.OldVersion.B = tonumber(string.sub (Version, 3, 3))
- Temp.OldVersion.C = tonumber(string.sub (Version, 5, 5))
- local file = fs.exists("/Progs/.Data/.Version.txt")
- if not(file) then
- local map = fs.exists("/Progs/.Data/")
- if not(map) then
- fs.makeDir("/Progs/.Data/")
- end
- shell.run("pastebin get tRmvEU8B /Progs/.Data/.Version.txt")
- local NewComputerVersion
- NewComputerVersion = Functions.LoadFile("/Progs/.Data/.Version.txt")
- Temp.NewVersion = {}
- Temp.NewVersion.A = tonumber(string.sub(NewComputerVersion, 1, 1))
- Temp.NewVersion.B = tonumber(string.sub(NewComputerVersion, 3, 3))
- Temp.NewVersion.C = tonumber(string.sub(NewComputerVersion, 5, 5))
- if Temp.NewVersion.A == nil or Temp.NewVersion.B == nil or Temp.NewVersion.C == nil or Temp.NewVersion.A > Temp.OldVersion.A or Temp.NewVersion.B > Temp.OldVersion.B or Temp.NewVersion.C > Temp.OldVersion.C then
- file = fs.exists("/Progs/.RCT.lua")
- if file then
- Functions.DelFile("/Progs/.RCT.lua")
- end
- shell.run("pastebin get FK9CTc1z /Progs/.RCT.lua")
- Text = "Rebooting..."
- Monitor[0].setCursorPos((w - string.len(Text)) /2, (h/2) + 1)
- Monitor[0].write(Text)
- sleep(3)
- System.reboot()
- end
- elseif file then
- local NewComputerVersion
- Functions.DelFile("/Progs/.Data/.Version.txt")
- shell.run("pastebin get tRmvEU8B /Progs/.Data/.Version.txt")
- NewComputerVersion = Functions.LoadFile("/Progs/.Data/.Version.txt")
- Temp.NewVersion = {}
- Temp.NewVersion.A = tonumber(string.sub(NewComputerVersion, 1, 1))
- Temp.NewVersion.B = tonumber(string.sub(NewComputerVersion, 3, 3))
- Temp.NewVersion.C = tonumber(string.sub(NewComputerVersion, 5, 5))
- if Temp.NewVersion.A == nil or Temp.NewVersion.B == nil or Temp.NewVersion.C == nil or Temp.NewVersion.A > Temp.OldVersion.A or Temp.NewVersion.B > Temp.OldVersion.B or Temp.NewVersion.C > Temp.OldVersion.C then
- file = fs.exists("/Progs/.RCT.lua")
- if file then
- Functions.DelFile("/Progs/.RCT.lua")
- end
- shell.run("pastebin get FK9CTc1z /Progs/.RCT.lua")
- Text = "Rebooting..."
- Monitor[0].setCursorPos((w - string.len(Text)) /2, (h/2) + 1)
- Monitor[0].write(Text)
- sleep(3)
- System.reboot()
- end
- end
- end
- function TestMonitor()
- Monitor[1].setTextScale(1)
- local mx, my = Monitor[1].getSize()
- if mx < 40 or my < 27 then
- Monitor[1].setTextScale(0.5)
- else
- Monitor[1].setTextScale(1)
- end
- MMoveButton.setMonitor(true)
- MMoveButton.setColors(Color.Red, Color.Black, Color.Lime, Color.Black)
- MMenuButton.setMonitor(true)
- MMenuButton.setColors(Color.Blue, Color.Black, Color.White, Color.Black)
- MINVButton.setMonitor(true)
- MINVButton.setColors(Color.Yellow, Color.Black, Color.Lime, Color.Black)
- MExtraButton.setMonitor(true)
- MExtraButton.setColors(Color.Orange, Color.Black, Color.Red, Color.Black)
- MStripMineButton.setMonitor(true)
- MStripMineButton.setColors(Color.Yellow, Color.Black, Color.Lime, Color.Black)
- end
- function Startup()
- Functions.SetColors(Monitor[0], Color.Black, Color.White)
- Monitor[0].clear()
- Monitor[0].setCursorPos(1, 1)
- local Text = "Loading..."
- Monitor[0].clear()
- Monitor[0].setCursorPos((w - string.len(Text)) /2, (h/2) - 1)
- print(Text)
- System.pullEvent = System.pullEventRaw
- Text = "Settings"
- Monitor[0].setCursorPos((w - string.len(Text)) /2, (h/2) + 1)
- Monitor[0].clearLine()
- Monitor[0].write(Text)
- sleep(math.random(0.5, 2.0))
- LoadSettings()
- Monitor[0].clear()
- Monitor[0].setCursorPos(1, 1)
- if (WModem) then
- Text = "Setting Channel"
- Monitor[0].setCursorPos((w - string.len(Text)) /2, (h/2) + 1)
- Monitor[0].clearLine()
- Monitor[0].write(Text)
- sleep(math.random(0.5, 2.0))
- WModem.closeAll()
- WModem.open(Computer.System.Modem.OwnID)
- elseif not(WModem) then
- Text = "No Wireless Modem Found !"
- Monitor[0].clear()
- Monitor[0].setCursorPos((w - string.len(Text)) /2, (h/2) + 1)
- if (Monitor[0].isColor) then
- C1 = Color.Red
- C2 = Color.Black
- end
- Functions.SetColors(Monitor[0], C1, C2)
- HadError(Text)
- end
- if (Monitor[1]) then
- Text = "Setting Monitor Files"
- Monitor[0].setCursorPos((w - string.len(Text)) /2, (h/2) + 1)
- Monitor[0].clearLine()
- Monitor[0].write(Text)
- sleep(math.random(0.5, 2.0))
- file = fs.exists("/Progs/Api/MMoveButton.lua")
- if not(file) then
- shell.run("pastebin get mKpxpWmZ /Progs/Api/MMoveButton.lua")
- end
- file = fs.exists("/Progs/Api/MMenuButton.lua")
- if not(file) then
- shell.run("pastebin get mKpxpWmZ /Progs/Api/MMenuButton.lua")
- end
- file = fs.exists("/Progs/Api/MINVButton.lua")
- if not(file) then
- shell.run("pastebin get mKpxpWmZ /Progs/Api/MINVButton.lua")
- end
- file = fs.exists("/Progs/Api/MExtraButton.lua")
- if not(file) then
- shell.run("pastebin get mKpxpWmZ /Progs/Api/MExtraButton.lua")
- end
- file = fs.exists("/Progs/Api/MStripMineButton.lua")
- if not(file) then
- shell.run("pastebin get mKpxpWmZ /Progs/Api/MStripMineButton.lua")
- end
- System.loadAPI("/Progs/Api/MMoveButton.lua")
- System.loadAPI("/Progs/Api/MMenuButton.lua")
- System.loadAPI("/Progs/Api/MINVButton.lua")
- System.loadAPI("/Progs/Api/MExtraButton.lua")
- System.loadAPI("/Progs/Api/MStripMineButton.lua")
- TestMonitor()
- elseif not(Monitor[1]) then
- Text = "No Monitor Found !"
- Monitor[0].clear()
- Monitor[0].setCursorPos((w - string.len(Text)) /2, (h/2) + 1)
- if (Monitor[0].isColor) then
- C1 = Color.Red
- C2 = Color.Black
- end
- Functions.SetColors(Monitor[0], C1, C2)
- Monitor[0].write(Text)
- sleep(math.random(0.5, 2.0))
- Functions.SetColors(Monitor[0], Color.Black, Color.White)
- end
- Functions.SetColors(Monitor[0], Color.Black, Color.White)
- Text = "Computer/Turtle Name"
- Monitor[0].setCursorPos((w - string.len(Text)) /2, (h/2) + 1)
- Monitor[0].write(Text)
- sleep(math.random(0.5, 2.0))
- System.setComputerLabel(Computer.System.ComputerName)
- Text = "Updating Version"
- Monitor[0].setCursorPos((w - string.len(Text)) /2, (h/2) + 1)
- Monitor[0].clearLine()
- Monitor[0].write(Text)
- sleep(math.random(0.5, 2.0))
- CheckVersion()
- Text = "Check Turtles"
- Monitor[0].setCursorPos((w - string.len(Text)) /2, (h/2) + 1)
- Monitor[0].clearLine()
- Monitor[0].write(Text)
- sleep(math.random(0.5, 2.0))
- end
- function drawMonitor()
- Monitor[1].clear()
- Monitor[1].setCursorPos(1, 1)
- local mx, my = Monitor[1].getSize()
- local BottomMonitor = my - 1
- local TopMonitor = 1 + 1
- local EndMonitor = mx + 1
- local BeginMonitor = 1 + 1
- if (Computer.Connection.Connected) then
- if nMonitorOption == 1 then
- Monitor[1].setCursorPos(BeginMonitor, TopMonitor + 2)
- Monitor[1].write("Conneted ID: "..tostring(Computer.Connection.ConnectedTurtle.Id))
- Monitor[1].setCursorPos(BeginMonitor, TopMonitor + 3)
- Monitor[1].write("Conneted Name: "..Computer.Connection.ConnectedTurtle.Name)
- Monitor[1].setCursorPos(BeginMonitor, TopMonitor + 4)
- Monitor[1].write("Doing: "..Computer.Connection.ConnectedTurtle.Doing)
- Monitor[1].setCursorPos(BeginMonitor, TopMonitor + 5)
- Monitor[1].write("Fuel Level: "..Computer.Connection.ConnectedTurtle.FuelLevel)
- Monitor[1].setCursorPos(BeginMonitor, TopMonitor + 6)
- Monitor[1].write("Cor: X: "..tostring(Computer.Connection.ConnectedTurtle.Cor.X).." Y: "..tostring(Computer.Connection.ConnectedTurtle.Cor.Y).." Z: "..tostring(Computer.Connection.ConnectedTurtle.Cor.Z))
- local R = GetOrientNames(Computer.Connection.ConnectedTurtle.Cor.R)
- Monitor[1].setCursorPos(BeginMonitor, TopMonitor + 7)
- Monitor[1].write("Orientation: "..R)
- Monitor[1].setCursorPos(BeginMonitor, TopMonitor + 8)
- Monitor[1].write("Up: "..Computer.Connection.ConnectedTurtle.Inspect.Up.name)
- Monitor[1].setCursorPos(BeginMonitor, TopMonitor + 9)
- Monitor[1].write("Forward: "..Computer.Connection.ConnectedTurtle.Inspect.Forward.name)
- Monitor[1].setCursorPos(BeginMonitor, TopMonitor + 10)
- Monitor[1].write("Down: "..Computer.Connection.ConnectedTurtle.Inspect.Down.name)
- Monitor[1].setCursorPos(BeginMonitor, TopMonitor + 11)
- Monitor[1].write("Compare: "..Computer.Connection.ConnectedTurtle.Compare)
- Monitor[1].setCursorPos(BeginMonitor, TopMonitor + 12)
- Monitor[1].write("Detect: "..Computer.Connection.ConnectedTurtle.Detect)
- elseif nMonitorOption == 2 then
- MINVButton.onScreen()
- if nMonitorTurtleInventoryOption >= 1 and nMonitorTurtleInventoryOption <= 16 then
- if Computer.Connection.ConnectedTurtle.Slot[nMonitorTurtleInventoryOption] == nil then
- Computer.Connection.ConnectedTurtle.Slot[nMonitorTurtleInventoryOption] = { Count = 0, Data = { name = ":Nothing" }}
- else
- if Computer.Connection.ConnectedTurtle.Slot[nMonitorTurtleInventoryOption].Count == nil then
- Computer.Connection.ConnectedTurtle.Slot[nMonitorTurtleInventoryOption].Count = 0
- end
- if Computer.Connection.ConnectedTurtle.Slot[nMonitorTurtleInventoryOption].Data == nil then
- Computer.Connection.ConnectedTurtle.Slot[nMonitorTurtleInventoryOption].Data = { name = ":Nothing" }
- end
- end
- MINVButton.setLabel(BeginMonitor, TopMonitor + 19, "Name: "..string.sub(Computer.Connection.ConnectedTurtle.Slot[nMonitorTurtleInventoryOption].Data.name, string.find(Computer.Connection.ConnectedTurtle.Slot[nMonitorTurtleInventoryOption].Data.name, ":")+1))
- MINVButton.setLabel(BeginMonitor, TopMonitor + 20, "Count: "..tostring(Computer.Connection.ConnectedTurtle.Slot[nMonitorTurtleInventoryOption].Count))
- end
- elseif nMonitorOption == 3 then
- if Computer.Connection.ConnectedTurtle.Status then
- MStripMineButton.onScreen()
- MStripMineButton.setLabel(BeginMonitor, TopMonitor + 5, "Cor:")
- MStripMineButton.setLabel(BeginMonitor + 5, TopMonitor + 4, "X:")
- MStripMineButton.setLabel(BeginMonitor + 26, TopMonitor + 4, tostring(GoToX))
- MStripMineButton.setLabel(BeginMonitor + 5, TopMonitor + 7, "Z:")
- MStripMineButton.setLabel(BeginMonitor + 26, TopMonitor + 7, tostring(GoToZ))
- MStripMineButton.setLabel(BeginMonitor + 5, TopMonitor + 11, "Layer: ")
- MStripMineButton.setLabel(BeginMonitor + 26, TopMonitor + 11, tostring(Layer))
- MStripMineButton.setLabel(BeginMonitor + 5, TopMonitor + 15, "Radius: ")
- MStripMineButton.setLabel(BeginMonitor + 26, TopMonitor + 15, tostring(Radius))
- end
- end
- MMenuButton.onScreen()
- if MButtonn and Computer.Connection.ConnectedTurtle.Status then
- MMoveButton.onScreen()
- end
- end
- end
- function drawMenu()
- Monitor[0].clear()
- Logo.drawLogo(Monitor[0], "Sub", 1, 1)
- Monitor[0].setCursorPos(w-(NameLen+3), 2)
- if (Computer.Connection.Connected) then
- if nOption == 1 then
- Monitor[0].write("System")
- elseif nOption == 2 then
- Monitor[0].write("Info Turtle")
- elseif nOption == 3 then
- Monitor[0].write("Turtle System")
- elseif nOption == 4 then
- Monitor[0].write("Turtle Movements")
- elseif nOption == 5 then
- Monitor[0].write("Turtle Program's")
- else
- end
- else
- if nOption == 1 then
- Monitor[0].write("System")
- else
- end
- end
- Functions.SetColors(Monitor[0], Color.White, Color.Black)
- Monitor[0].setCursorPos(1, h)
- Monitor[0].write("Press 'Q' to quit.")
- Functions.SetColors(Monitor[0], Color.Black, Color.White)
- end
- function drawFrontend()
- Functions.printCentered(Monitor[0], math.floor(h/2) -3, Functions.PadString(" Head Menu",NameLen))
- if (Computer.Connection.Connected) then
- Functions.printCentered(Monitor[0], math.floor(h/2) -1, ((nOption == 1) and string.format("%s%s",Functions.PadString("[ System",NameLen-1),"]") or Functions.PadString(" System",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +0, ((nOption == 2) and string.format("%s%s",Functions.PadString("[ T Info",NameLen-1),"]") or Functions.PadString(" T Info",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +1, ((nOption == 3) and string.format("%s%s",Functions.PadString("[ T System",NameLen-1),"]") or Functions.PadString(" T System",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +2, ((nOption == 4) and string.format("%s%s",Functions.PadString("[ T Movements",NameLen-1),"]") or Functions.PadString(" T Movements",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +3, ((nOption == 5) and string.format("%s%s",Functions.PadString("[ T Program's",NameLen-1),"]") or Functions.PadString(" T Program's",NameLen)))
- else
- Functions.printCentered(Monitor[0], math.floor(h/2) -1, ((nOption == 1) and string.format("%s%s",Functions.PadString("[ System",NameLen-1),"]") or Functions.PadString(" System",NameLen)))
- end
- end
- function drawSystemMenu()
- Monitor[0].clear()
- Monitor[0].setCursorPos(1, 1)
- Monitor[0].write("Name: "..Computer.System.ComputerName)
- Monitor[0].setCursorPos(w-(NameLen+3), 2)
- if (Computer.Connection.Connected) then
- if nSystemOption == 1 then
- Monitor[0].write("Disconnect")
- elseif nSystemOption == 2 then
- Monitor[0].write("Reboot")
- elseif nSystemOption == 3 then
- Monitor[0].write("Reset")
- elseif nSystemOption == 4 then
- Monitor[0].write("Uninstall")
- else
- end
- else
- if nSystemOption == 1 then
- Monitor[0].write("Connect")
- elseif nSystemOption == 2 then
- Monitor[0].write("Reboot")
- elseif nSystemOption == 3 then
- Monitor[0].write("Reset")
- else
- end
- end
- Functions.SetColors(Monitor[0], Color.White, Color.Black)
- Monitor[0].setCursorPos(1, h)
- Monitor[0].write("Press 'B' to go back.")
- Functions.SetColors(Monitor[0], Color.Black, Color.White)
- end
- function drawSystemFrontend()
- Functions.printCentered(Monitor[0], math.floor(h/2) -3, Functions.PadString(" System Menu",NameLen))
- if (Computer.Connection.Connected) then
- Functions.printCentered(Monitor[0], math.floor(h/2) -1, ((nSystemOption == 1) and string.format("%s%s",Functions.PadString("[ Disconnect",NameLen-1),"]") or Functions.PadString(" Disconnect",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +0, ((nSystemOption == 2) and string.format("%s%s",Functions.PadString("[ Reboot",NameLen-1),"]") or Functions.PadString(" Reboot",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +1, ((nSystemOption == 3) and string.format("%s%s",Functions.PadString("[ Reset",NameLen-1),"]") or Functions.PadString(" Reset",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +2, ((nSystemOption == 4) and string.format("%s%s",Functions.PadString("[ Uninstall",NameLen-1),"]") or Functions.PadString(" Uninstall",NameLen)))
- else
- Functions.printCentered(Monitor[0], math.floor(h/2) -1, ((nSystemOption == 1) and string.format("%s%s",Functions.PadString("[ Connect",NameLen-1),"]") or Functions.PadString(" Connect",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +0, ((nSystemOption == 2) and string.format("%s%s",Functions.PadString("[ Reboot",NameLen-1),"]") or Functions.PadString(" Reboot",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +1, ((nSystemOption == 3) and string.format("%s%s",Functions.PadString("[ Reset",NameLen-1),"]") or Functions.PadString(" Reset",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +2, ((nSystemOption == 4) and string.format("%s%s",Functions.PadString("[ Uninstall",NameLen-1),"]") or Functions.PadString(" Uninstall",NameLen)))
- end
- end
- function drawTurtlesFrontend()
- checkForTurtles()
- Functions.printCentered(Monitor[0], 1, "Turtles ID's: ")
- for i = 1, #Turtles do
- Functions.printCentered(Monitor[0], i+2, ((nTurtlesOption == i) and string.format("%s%s",Functions.PadString("[ "..tostring(Turtles[i].Id),NameLen-1),"]") or Functions.PadString(" "..tostring(Turtles[i].Id),NameLen)))
- end
- end
- function drawTurtleInfo()
- checkForTurtles()
- for i = 1, #Turtles do
- if Turtles[i].Id == Computer.Connection.ConnectedTurtle.Id then
- Computer.Connection.ConnectedTurtle = Turtles[i]
- end
- end
- Monitor[0].clear()
- if nTurtleInfoOption == 1 then
- local a = 1
- Functions.printCentered(Monitor[0], a, "Turtle Info page "..tostring(nTurtleInfoOption))
- a = a + 2
- Functions.printCentered(Monitor[0], a, "Conneted ID: "..tostring(Computer.Connection.ConnectedTurtle.Id))
- a = a + 1
- Functions.printCentered(Monitor[0], a, "Conneted Name: "..Computer.Connection.ConnectedTurtle.Name)
- a = a + 1
- Functions.printCentered(Monitor[0], a, "Groupstate: "..tostring(Computer.Connection.ConnectedTurtle.GroupState))
- a = a + 1
- Functions.printCentered(Monitor[0], a, "Doing: "..Computer.Connection.ConnectedTurtle.Doing)
- a = a + 1
- Functions.printCentered(Monitor[0], a, "Fuel Level: "..Computer.Connection.ConnectedTurtle.FuelLevel)
- a = a + 1
- Functions.printCentered(Monitor[0], a, "Cor: X: "..tostring(Computer.Connection.ConnectedTurtle.Cor.X).." Y: "..tostring(Computer.Connection.ConnectedTurtle.Cor.Y).." Z: "..tostring(Computer.Connection.ConnectedTurtle.Cor.Z))
- local R = GetOrientNames(Computer.Connection.ConnectedTurtle.Cor.R)
- a = a + 1
- Functions.printCentered(Monitor[0], a, "Orientation: "..R)
- a = a + 1
- Functions.printCentered(Monitor[0], a, "Up: "..Computer.Connection.ConnectedTurtle.Inspect.Up.name)
- a = a + 1
- Functions.printCentered(Monitor[0], a, "Forward: "..Computer.Connection.ConnectedTurtle.Inspect.Forward.name)
- a = a + 1
- Functions.printCentered(Monitor[0], a, "Down: "..Computer.Connection.ConnectedTurtle.Inspect.Down.name)
- a = a + 1
- Functions.printCentered(Monitor[0], a, "Compare: "..Computer.Connection.ConnectedTurtle.Compare)
- a = a + 1
- Functions.printCentered(Monitor[0], a, "Detect: "..Computer.Connection.ConnectedTurtle.Detect)
- a = a + 1
- Functions.printCentered(Monitor[0], a, "")
- a = a + 1
- Functions.printCentered(Monitor[0], a, "")
- a = a + 1
- Functions.printCentered(Monitor[0], a, "")
- a = a + 1
- Functions.printCentered(Monitor[0], a, "")
- elseif nTurtleInfoOption == 2 then
- local a = 1
- Functions.printCentered(Monitor[0], a, "Turtle Info page "..tostring(nTurtleInfoOption))
- a = a + 2
- Functions.printCentered(Monitor[0], a, "Test")
- a = a + 1
- Functions.printCentered(Monitor[0], a, "")
- a = a + 1
- Functions.printCentered(Monitor[0], a, "")
- a = a + 1
- Functions.printCentered(Monitor[0], a, "")
- a = a + 1
- Functions.printCentered(Monitor[0], a, "")
- a = a + 1
- Functions.printCentered(Monitor[0], a, "")
- a = a + 1
- Functions.printCentered(Monitor[0], a, "")
- a = a + 1
- Functions.printCentered(Monitor[0], a, "")
- a = a + 1
- Functions.printCentered(Monitor[0], a, "")
- a = a + 1
- Functions.printCentered(Monitor[0], a, "")
- a = a + 1
- Functions.printCentered(Monitor[0], a, "")
- a = a + 1
- Functions.printCentered(Monitor[0], a, "")
- a = a + 1
- Functions.printCentered(Monitor[0], a, "")
- a = a + 1
- Functions.printCentered(Monitor[0], a, "")
- a = a + 1
- Functions.printCentered(Monitor[0], a, "")
- a = a + 1
- Functions.printCentered(Monitor[0], a, "")
- end
- Functions.SetColors(Monitor[0], Color.White, Color.Black)
- Monitor[0].setCursorPos(1, h)
- Monitor[0].write("Press 'B' to go back.")
- Functions.SetColors(Monitor[0], Color.Black, Color.White)
- end
- function drawTurtleSystemMenu()
- checkForTurtles()
- for i = 1, #Turtles do
- if Turtles[i].Id == Computer.Connection.ConnectedTurtle.Id then
- Computer.Connection.ConnectedTurtle = Turtles[i]
- end
- end
- Monitor[0].clear()
- Monitor[0].setCursorPos(1, 1)
- Monitor[0].write("Name: "..Computer.System.ComputerName)
- Monitor[0].setCursorPos(1, 3)
- Monitor[0].write("Compare: "..Computer.Connection.ConnectedTurtle.Compare)
- Monitor[0].setCursorPos(1, 4)
- Monitor[0].write("Detect: "..Computer.Connection.ConnectedTurtle.Detect)
- Monitor[0].setCursorPos(w-NameLen, 2)
- if nTurtleSystemOption == 1 then
- Monitor[0].write("GroupState")
- elseif nTurtleSystemOption == 2 then
- Monitor[0].write("Refuel")
- elseif nTurtleSystemOption == 3 then
- Monitor[0].write("Select Slot")
- elseif nTurtleSystemOption == 4 then
- Monitor[0].write("Equip")
- elseif nTurtleSystemOption == 5 then
- Monitor[0].write("Transfer To")
- elseif nTurtleSystemOption == 6 then
- Monitor[0].write("Craft")
- elseif nTurtleSystemOption == 7 then
- Monitor[0].write("Detect")
- elseif nTurtleSystemOption == 8 then
- Monitor[0].write("Inspect")
- elseif nTurtleSystemOption == 9 then
- Monitor[0].write("Compare")
- elseif nTurtleSystemOption == 10 then
- Monitor[0].write("Print Log")
- elseif nTurtleSystemOption == 11 then
- Monitor[0].write("Reboot")
- elseif nTurtleSystemOption == 12 then
- Monitor[0].write("Shutdown")
- elseif nTurtleSystemOption == 13 then
- Monitor[0].write("Reset Turtle")
- elseif nTurtleSystemOption == 14 then
- Monitor[0].write("")
- elseif nTurtleSystemOption == 15 then
- Monitor[0].write("")
- elseif nTurtleSystemOption == 16 then
- Monitor[0].write("")
- else
- end
- Functions.SetColors(Monitor[0], Color.White, Color.Black)
- Monitor[0].setCursorPos(1, h)
- Monitor[0].write("Press 'B' to go back.")
- Functions.SetColors(Monitor[0], Color.Black, Color.White)
- end
- function drawTurtleSystemFrontend()
- Functions.printCentered(Monitor[0], math.floor(h/2) -3, Functions.PadString(" System Menu",NameLen))
- Functions.printQuart(Monitor[0], math.floor(h/2) -1, ((nTurtleSystemOption == 1) and string.format("%s%s",Functions.PadString("[ GroupState",NameLen-1),"]") or Functions.PadString(" GroupState",NameLen)))
- Functions.printQuart(Monitor[0], math.floor(h/2) +0, ((nTurtleSystemOption == 2) and string.format("%s%s",Functions.PadString("[ Refuel",NameLen-1),"]") or Functions.PadString(" Refuel",NameLen)))
- Functions.printQuart(Monitor[0], math.floor(h/2) +1, ((nTurtleSystemOption == 3) and string.format("%s%s",Functions.PadString("[ Select Slot",NameLen-1),"]") or Functions.PadString(" Select Slot",NameLen)))
- Functions.printQuart(Monitor[0], math.floor(h/2) +2, ((nTurtleSystemOption == 4) and string.format("%s%s",Functions.PadString("[ Equip",NameLen-1),"]") or Functions.PadString(" Equip",NameLen)))
- Functions.printQuart(Monitor[0], math.floor(h/2) +3, ((nTurtleSystemOption == 5) and string.format("%s%s",Functions.PadString("[ Transfer To",NameLen-1),"]") or Functions.PadString(" Transfer To",NameLen)))
- Functions.printQuart(Monitor[0], math.floor(h/2) +4, ((nTurtleSystemOption == 6) and string.format("%s%s",Functions.PadString("[ Craft",NameLen-1),"]") or Functions.PadString(" Craft",NameLen)))
- Functions.printQuart(Monitor[0], math.floor(h/2) +5, ((nTurtleSystemOption == 7) and string.format("%s%s",Functions.PadString("[ Detect",NameLen-1),"]") or Functions.PadString(" Detect",NameLen)))
- Functions.printQuart(Monitor[0], math.floor(h/2) +6, ((nTurtleSystemOption == 8) and string.format("%s%s",Functions.PadString("[ Inspect",NameLen-1),"]") or Functions.PadString(" Inspect",NameLen)))
- Functions.printQuart(Monitor[0], math.floor(h/2) +7, ((nTurtleSystemOption == 9) and string.format("%s%s",Functions.PadString("[ Compare",NameLen-1),"]") or Functions.PadString(" Compare",NameLen)))
- Functions.printQuart(Monitor[0], math.floor(h/2) +8, ((nTurtleSystemOption == 10) and string.format("%s%s",Functions.PadString("[ Print Log",NameLen-1),"]") or Functions.PadString(" Print Log",NameLen)))
- Functions.printThreeQuartNC(Monitor[0], math.floor(h/2) -1, ((nTurtleSystemOption == 11) and string.format("%s%s",Functions.PadString("[ Reboot",NameLen-1),"]") or Functions.PadString(" Reboot",NameLen)))
- Functions.printThreeQuartNC(Monitor[0], math.floor(h/2) +0, ((nTurtleSystemOption == 12) and string.format("%s%s",Functions.PadString("[ Shutdown",NameLen-1),"]") or Functions.PadString(" Shutdown",NameLen)))
- Functions.printThreeQuartNC(Monitor[0], math.floor(h/2) +1, ((nTurtleSystemOption == 13) and string.format("%s%s",Functions.PadString("[ Reset Turtle",NameLen-1),"]") or Functions.PadString(" Reset Turtle",NameLen)))
- Functions.printThreeQuartNC(Monitor[0], math.floor(h/2) +2, ((nTurtleSystemOption == 14) and string.format("%s%s",Functions.PadString("[ ",NameLen-1),"]") or Functions.PadString(" ",NameLen)))
- Functions.printThreeQuartNC(Monitor[0], math.floor(h/2) +3, ((nTurtleSystemOption == 15) and string.format("%s%s",Functions.PadString("[ ",NameLen-1),"]") or Functions.PadString(" ",NameLen)))
- Functions.printThreeQuartNC(Monitor[0], math.floor(h/2) +4, ((nTurtleSystemOption == 16) and string.format("%s%s",Functions.PadString("[ ",NameLen-1),"]") or Functions.PadString(" ",NameLen)))
- end
- function drawTurtleEquipFrontend()
- Functions.printQuart(Monitor[0], math.floor(h/2) +1, Functions.PadString(" ",NameLen))
- Functions.printQuart(Monitor[0], math.floor(h/2) +2, ((nTurtleEquipOption == 1) and string.format("%s%s",Functions.PadString("[ Left",NameLen-1),"]") or Functions.PadString(" Left",NameLen)))
- Functions.printQuart(Monitor[0], math.floor(h/2) +3, ((nTurtleEquipOption == 2) and string.format("%s%s",Functions.PadString("[ Right",NameLen-1),"]") or Functions.PadString(" Right",NameLen)))
- Functions.printQuart(Monitor[0], math.floor(h/2) +4, Functions.PadString(" ",NameLen))
- end
- function drawTurtleDetectFrontend()
- Functions.printQuart(Monitor[0], math.floor(h/2) +3, Functions.PadString(" ",NameLen))
- Functions.printQuart(Monitor[0], math.floor(h/2) +4, ((nTurtleDetectOption == 1) and string.format("%s%s",Functions.PadString("[ Forward",NameLen-1),"]") or Functions.PadString(" Forward",NameLen)))
- Functions.printQuart(Monitor[0], math.floor(h/2) +5, ((nTurtleDetectOption == 2) and string.format("%s%s",Functions.PadString("[ Up",NameLen-1),"]") or Functions.PadString(" Up",NameLen)))
- Functions.printQuart(Monitor[0], math.floor(h/2) +6, ((nTurtleDetectOption == 3) and string.format("%s%s",Functions.PadString("[ Down",NameLen-1),"]") or Functions.PadString(" Down",NameLen)))
- Functions.printQuart(Monitor[0], math.floor(h/2) +7, Functions.PadString(" ",NameLen))
- end
- function drawTurtleInspectFrontend()
- Functions.printQuart(Monitor[0], math.floor(h/2) +4, Functions.PadString(" ",NameLen))
- Functions.printQuart(Monitor[0], math.floor(h/2) +5, ((nTurtleInspectOption == 1) and string.format("%s%s",Functions.PadString("[ Forward",NameLen-1),"]") or Functions.PadString(" Forward",NameLen)))
- Functions.printQuart(Monitor[0], math.floor(h/2) +6, ((nTurtleInspectOption == 2) and string.format("%s%s",Functions.PadString("[ Up",NameLen-1),"]") or Functions.PadString(" Up",NameLen)))
- Functions.printQuart(Monitor[0], math.floor(h/2) +7, ((nTurtleInspectOption == 3) and string.format("%s%s",Functions.PadString("[ Down",NameLen-1),"]") or Functions.PadString(" Down",NameLen)))
- Functions.printQuart(Monitor[0], math.floor(h/2) +8, Functions.PadString(" ",NameLen))
- end
- function drawTurtleCompareFrontend()
- Functions.printQuart(Monitor[0], math.floor(h/2) +4, Functions.PadString(" ",NameLen))
- Functions.printQuart(Monitor[0], math.floor(h/2) +5, ((nTurtleCompareOption == 1) and string.format("%s%s",Functions.PadString("[ Forward",NameLen-1),"]") or Functions.PadString(" Forward",NameLen)))
- Functions.printQuart(Monitor[0], math.floor(h/2) +6, ((nTurtleCompareOption == 2) and string.format("%s%s",Functions.PadString("[ Up",NameLen-1),"]") or Functions.PadString(" Up",NameLen)))
- Functions.printQuart(Monitor[0], math.floor(h/2) +7, ((nTurtleCompareOption == 3) and string.format("%s%s",Functions.PadString("[ Down",NameLen-1),"]") or Functions.PadString(" Down",NameLen)))
- Functions.printQuart(Monitor[0], math.floor(h/2) +8,Functions. PadString(" ",NameLen))
- end
- function drawTurtleInspectInfoFrontend(Table)
- Monitor[0].clear()
- local a = 1
- local HeightA = 19
- Functions.printCentered(Monitor[0], a, "Inspect")
- a = a + 2
- for Mame, Deta in pairs(Table) do
- if a == HeightA then break end
- if type(Deta) == "table" then
- Functions.printCentered(Monitor[0], a, Functions.PadString(Mame.."| ", w-4))
- a = a + 1
- if a == HeightA then break end
- for MName, DEata in pairs(Deta) do
- if a == HeightA then break end
- if type(DEata) == "table" then
- Functions.printCentered(Monitor[0], a, Functions.PadString(MName.."| ", w-4))
- a = a + 1
- if a == HeightA then break end
- for MMname, DeAta in pairs(DEata) do
- if a == HeightA then break end
- if type(DeAta) == "table" then
- Functions.printCentered(Monitor[0], a, Functions.PadString(MMname.."| ", w-4))
- a = a + 1
- if a == HeightA then break end
- for MMnameA, DeAtaA in pairs(DeAta) do
- if a == HeightA then break end
- if type(DeAtaA) == "table" then
- Functions.printCentered(Monitor[0], a, Functions.PadString(MMnameA.."| ", w-4))
- a = a + 1
- if a == HeightA then break end
- for MMnameB, DeAtaB in pairs(DeAtaA) do
- if a == HeightA then break end
- if type(DeAtaB) == "table" then
- Functions.printCentered(Monitor[0], a, Functions.PadString(MMnameB.."| ", w-4))
- a = a + 1
- if a == HeightA then break end
- for MMnameC, DeAtaC in pairs(DeAtaB) do
- if a == HeightA then break end
- if type(DeAtaC) ~= "table" then
- Functions.printCentered(Monitor[0], a, Functions.PadString(MMnameC.."| ", w-4))
- a = a + 1
- if a == HeightA then break end
- if MMnameC ~= nil and DeAtaC ~= nil then
- Functions.printCentered(Monitor[0], a, Functions.PadString(tostring(DeAtaC), w-4))
- a = a + 1
- if a == HeightA then break end
- end
- else
- if a == HeightA then break end
- Functions.printCentered(Monitor[0], a, Functions.PadString(MMnameC.."| Table Cant Read", w-4))
- a = a + 1
- if a == HeightA then break end
- end
- end
- else
- if a == HeightA then break end
- if MMnameB ~= nil and DeAtaB ~= nil then
- Functions.printCentered(Monitor[0], a, Functions.PadString(MMnameB.."| "..tostring(DeAtaB), w-4))
- a = a + 1
- if a == HeightA then break end
- end
- end
- end
- else
- if a == HeightA then break end
- if MMnameA ~= nil and DeAtaA ~= nil then
- Functions.printCentered(Monitor[0], a, Functions.PadString(MMnameA.."| "..tostring(DeAtaA), w-4))
- a = a + 1
- if a == HeightA then break end
- end
- end
- end
- else
- if a == HeightA then break end
- if MMname ~= nil and DeAta ~= nil then
- Functions.printCentered(Monitor[0], a, Functions.PadString(MMname.."| "..tostring(DeAta), w-4))
- a = a + 1
- if a == HeightA then break end
- end
- end
- end
- else
- if a == HeightA then break end
- if MName ~= nil and DEata ~= nil then
- Functions.printCentered(Monitor[0], a, Functions.PadString(MName.."| "..tostring(DEata), w-4))
- a = a + 1
- if a == HeightA then break end
- end
- end
- end
- else
- if a == HeightA then break end
- if Mame ~= nil and Deta ~= nil then
- Functions.printCentered(Monitor[0], a, Functions.PadString(Mame.."| "..tostring(Deta), w-4))
- a = a + 1
- if a == HeightA then break end
- end
- end
- end
- a = a + 1
- Functions.printCentered(Monitor[0], a, " ")
- end
- function drawTurtleMovementsMenu()
- checkForTurtles()
- for i = 1, #Turtles do
- if Turtles[i].Id == Computer.Connection.ConnectedTurtle.Id then
- Computer.Connection.ConnectedTurtle = Turtles[i]
- end
- end
- Monitor[0].clear()
- Monitor[0].setCursorPos(1,1)
- Monitor[0].write("Computer Name: "..Computer.System.ComputerName)
- local R = GetOrientNames(Computer.Connection.ConnectedTurtle.Cor.R)
- Functions.printQuart(Monitor[0], 3,"Turtle Name: "..Computer.Connection.ConnectedTurtle.Name)
- Functions.printQuart(Monitor[0], 4,"Facing: "..R)
- Functions.printQuart(Monitor[0], 5,"Cor: X: "..Computer.Connection.ConnectedTurtle.Cor.X.." Y: "..Computer.Connection.ConnectedTurtle.Cor.Y.." Z: "..Computer.Connection.ConnectedTurtle.Cor.Z)
- Functions.printThreeQuartNC(Monitor[0], 6, "Up: "..Computer.Connection.ConnectedTurtle.Inspect.Up.name)
- Functions.printThreeQuartNC(Monitor[0], 7, "Forward: "..Computer.Connection.ConnectedTurtle.Inspect.Forward.name)
- Functions.printThreeQuartNC(Monitor[0], 8, "Down: "..Computer.Connection.ConnectedTurtle.Inspect.Down.name)
- Functions.SetColors(Monitor[0], Color.White, Color.Black)
- Monitor[0].setCursorPos(1, h)
- Monitor[0].write("Press 'B' to go back.")
- Functions.SetColors(Monitor[0], Color.Black, Color.White)
- end
- function drawTurtleMovementsFrontend()
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) -1, ((nTurtleMovementsOption == 1) and string.format("%s%s",Functions.PadString("[ Attack",NameLen-1),"]") or Functions.PadString(" Attack",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +0, ((nTurtleMovementsOption == 2) and string.format("%s%s",Functions.PadString("[ Dig",NameLen-1),"]") or Functions.PadString(" Dig",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +1, ((nTurtleMovementsOption == 3) and string.format("%s%s",Functions.PadString("[ Suck",NameLen-1),"]") or Functions.PadString(" Suck",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +2, ((nTurtleMovementsOption == 4) and string.format("%s%s",Functions.PadString("[ Drop",NameLen-1),"]") or Functions.PadString(" Drop",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +3, ((nTurtleMovementsOption == 5) and string.format("%s%s",Functions.PadString("[ Place",NameLen-1),"]") or Functions.PadString(" Place",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +4, ((nTurtleMovementsOption == 6) and string.format("%s%s",Functions.PadString("[ Go To",NameLen-1),"]") or Functions.PadString(" Go To",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +5, ((nTurtleMovementsOption == 7) and string.format("%s%s",Functions.PadString("[ Go Home",NameLen-1),"]") or Functions.PadString(" Go Home",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +6, ((nTurtleMovementsOption == 8) and string.format("%s%s",Functions.PadString("[ Turn Direction",NameLen-1),"]") or Functions.PadString(" Turn Direction",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +7, ((nTurtleMovementsOption == 9) and string.format("%s%s",Functions.PadString("[ Empty Inventory",NameLen-1),"]") or Functions.PadString(" Empty Inventory",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +8, ((nTurtleMovementsOption == 10) and string.format("%s%s",Functions.PadString("[ ",NameLen-1),"]") or Functions.PadString(" ",NameLen)))
- Button.onScreen()
- end
- function drawTurtleAttackFrontend()
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) -3, Functions.PadString(" ",NameLen))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) -2, ((nTurtleAttackOption == 1) and string.format("%s%s",Functions.PadString("[ Forward",NameLen-1),"]") or Functions.PadString(" Forward",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) -1, ((nTurtleAttackOption == 2) and string.format("%s%s",Functions.PadString("[ Up",NameLen-1),"]") or Functions.PadString(" Up",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +0, ((nTurtleAttackOption == 3) and string.format("%s%s",Functions.PadString("[ Down",NameLen-1),"]") or Functions.PadString(" Down",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +1, Functions.PadString(" ",NameLen))
- Button.onScreen()
- end
- function drawTurtleDigFrontend()
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) -2, Functions.PadString(" ",NameLen))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) -1, ((nTurtleDigOption == 1) and string.format("%s%s",Functions.PadString("[ Forward",NameLen-1),"]") or Functions.PadString(" Forward",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +0, ((nTurtleDigOption == 2) and string.format("%s%s",Functions.PadString("[ Up",NameLen-1),"]") or Functions.PadString(" Up",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +1, ((nTurtleDigOption == 3) and string.format("%s%s",Functions.PadString("[ Down",NameLen-1),"]") or Functions.PadString(" Down",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +2, Functions.PadString(" ",NameLen))
- Button.onScreen()
- end
- function drawTurtleSuckFrontend()
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) -1, Functions.PadString(" ",NameLen))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +0, ((nTurtleSuckOption == 1) and string.format("%s%s",Functions.PadString("[ Forward",NameLen-1),"]") or Functions.PadString(" Forward",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +1, ((nTurtleSuckOption == 2) and string.format("%s%s",Functions.PadString("[ Up",NameLen-1),"]") or Functions.PadString(" Up",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +2, ((nTurtleSuckOption == 3) and string.format("%s%s",Functions.PadString("[ Down",NameLen-1),"]") or Functions.PadString(" Down",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +3, Functions.PadString(" ",NameLen))
- Button.onScreen()
- end
- function drawTurtleDropFrontend()
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +0, Functions.PadString(" ",NameLen))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +1, ((nTurtleDropOption == 1) and string.format("%s%s",Functions.PadString("[ Forward",NameLen-1),"]") or Functions.PadString(" Forward",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +2, ((nTurtleDropOption == 2) and string.format("%s%s",Functions.PadString("[ Up",NameLen-1),"]") or Functions.adString(" Up",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +3, ((nTurtleDropOption == 3) and string.format("%s%s",Functions.PadString("[ Down",NameLen-1),"]") or Functions.PadString(" Down",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +4, Functions.PadString(" ",NameLen))
- Button.onScreen()
- end
- function drawTurtlePlaceFrontend()
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +1, Functions.PadString(" ",NameLen))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +2, ((nTurtlePlaceOption == 1) and string.format("%s%s",Functions.PadString("[ Forward",NameLen-1),"]") or Functions.PadString(" Forward",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +3, ((nTurtlePlaceOption == 2) and string.format("%s%s",Functions.PadString("[ Up",NameLen-1),"]") or Functions.PadString(" Up",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +4, ((nTurtlePlaceOption == 3) and string.format("%s%s",Functions.PadString("[ Down",NameLen-1),"]") or Functions.PadString(" Down",NameLen)))
- Functions.printThreeQuart(Monitor[0], math.floor(h/2) +5, Functions.PadString(" ",NameLen))
- Button.onScreen()
- end
- function drawTurtleProgramsMenu()
- Monitor[0].clear()
- Monitor[0].setCursorPos(1, 1)
- Monitor[0].write("Name: "..Computer.System.ComputerName)
- Monitor[0].setCursorPos(w-(NameLen+3), 2)
- if not(Computer.System.Nether) then
- if nTurtleProgramsOption == 1 then
- Monitor[0].write("Quarry")
- elseif nTurtleProgramsOption == 2 then
- Monitor[0].write("Tunner 3 By 3")
- elseif nTurtleProgramsOption == 3 then
- Monitor[0].write("3D Paint Pro")
- elseif nTurtleProgramsOption == 4 then
- Monitor[0].write("Farm")
- elseif nTurtleProgramsOption == 5 then
- Monitor[0].write("TreeFarm")
- else
- end
- else
- if nTurtleProgramsOption == 1 then
- Monitor[0].write("Quarry")
- elseif nTurtleProgramsOption == 2 then
- Monitor[0].write("Tunner 3 By 3")
- elseif nTurtleProgramsOption == 3 then
- Monitor[0].write("3D Paint Pro")
- else
- end
- end
- Functions.SetColors(Monitor[0], Color.White, Color.Black)
- Monitor[0].setCursorPos(1, h)
- Monitor[0].write("Press 'B' to go back.")
- Functions.SetColors(Monitor[0], Color.Black, Color.White)
- end
- function drawTurtleProgramsFrontend()
- Functions.printCentered(Monitor[0], math.floor(h/2) -3, Functions.PadString(" Program's Menu",NameLen))
- if not(Computer.System.Nether) then
- Functions.printCentered(Monitor[0], math.floor(h/2) -1, ((nTurtleProgramsOption == 1) and string.format("%s%s",Functions.PadString("[ Quarry",NameLen-1),"]") or Functions.PadString(" Quarry",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +0, ((nTurtleProgramsOption == 2) and string.format("%s%s",Functions.PadString("[ Tunner 3 By 3",NameLen-1),"]") or Functions.PadString(" Tunner 3 By 3",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +1, ((nTurtleProgramsOption == 3) and string.format("%s%s",Functions.PadString("[ 3D Paint Pro",NameLen-1),"]") or Functions.PadString(" 3D Paint Pro",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +2, ((nTurtleProgramsOption == 4) and string.format("%s%s",Functions.PadString("[ Farm",NameLen-1),"]") or Functions.PadString(" Farm",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +3, ((nTurtleProgramsOption == 5) and string.format("%s%s",Functions.PadString("[ TreeFarm",NameLen-1),"]") or Functions.PadString(" TreeFarm",NameLen)))
- else
- Functions.printCentered(Monitor[0], math.floor(h/2) -1, ((nTurtleProgramsOption == 1) and string.format("%s%s",Functions.PadString("[ Quarry",NameLen-1),"]") or Functions.PadString(" Quarry",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +0, ((nTurtleProgramsOption == 2) and string.format("%s%s",Functions.PadString("[ Tunner 3 By 3",NameLen-1),"]") or Functions.PadString(" Tunner 3 By 3",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +1, ((nTurtleProgramsOption == 3) and string.format("%s%s",Functions.PadString("[ 3D Paint Pro",NameLen-1),"]") or Functions.PadString(" 3D Paint Pro",NameLen)))
- end
- end
- function MoveMentOption()
- if MButtonn and Computer.Connection.ConnectedTurtle.Status then
- MButtonn = false
- elseif not(MButtonn) and Computer.Connection.ConnectedTurtle.Status then
- MButtonn = true
- end
- sleep(0.5)
- MMenuButton.toggleButton("M")
- end
- function TurtleInfo()
- if nMonitorOption == 1 then
- nMonitorOption = 0
- ButtonInfo = false
- else
- nMonitorOption = 1
- ButtonInfo = true
- end
- MMenuButton.toggleButton("Info")
- if ButtonInventory then
- MMenuButton.toggleButton("Inventory")
- ButtonInventory = false
- end
- if ButtonQuarry2 then
- MMenuButton.toggleButton("Strip Mine")
- ButtonQuarry2 = false
- end
- end
- function InventoryInfo()
- if nMonitorOption == 2 then
- nMonitorOption = 0
- ButtonInventory = false
- else
- nMonitorOption = 2
- ButtonInventory = true
- end
- MMenuButton.toggleButton("Inventory")
- if ButtonInfo then
- MMenuButton.toggleButton("Info")
- ButtonInfo = false
- end
- if ButtonQuarry2 then
- MMenuButton.toggleButton("Strip Mine")
- ButtonQuarry2 = false
- end
- end
- function Quarry2()
- if nMonitorOption == 3 then
- nMonitorOption = 0
- ButtonQuarry2 = false
- else
- nMonitorOption = 3
- ButtonQuarry2 = true
- end
- MMenuButton.toggleButton("Strip Mine")
- if ButtonInventory then
- MMenuButton.toggleButton("Inventory")
- ButtonInventory = false
- end
- if ButtonInfo then
- MMenuButton.toggleButton("Info")
- ButtonInfo = false
- end
- end
- function ClickedInventoryButton(Slot)
- if Computer.Connection.ConnectedTurtle.Status then
- local Data = {What = "Command", Command = "/SelectSlot/", Data = tonumber(Slot)}
- WModem.transmit(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- nMonitorTurtleInventoryOption = tonumber(Slot)
- InventoryButton[nMonitorTurtleInventoryOption] = true
- sleep(1)
- checkForTurtles()
- for i = 1, #Turtles do
- if Turtles[i].Id == Computer.Connection.ConnectedTurtle.Id then
- Computer.Connection.ConnectedTurtle = Turtles[i]
- end
- end
- for i = 1, 16 do
- if InventoryButton[i] == true and i ~= nMonitorTurtleInventoryOption then
- MINVButton.toggleButton(tostring(i))
- InventoryButton[i] = false
- end
- if Computer.Connection.ConnectedTurtle.Slot == nil then
- Computer.Connection.ConnectedTurtle.Slot = {}
- end
- if Computer.Connection.ConnectedTurtle.Slot[i] == nil then
- Computer.Connection.ConnectedTurtle.Slot[i] = { Count = 0, Data = { name = ":Nothing" }}
- else
- if Computer.Connection.ConnectedTurtle.Slot[i].Count == nil then
- Computer.Connection.ConnectedTurtle.Slot[i].Count = 0
- end
- if Computer.Connection.ConnectedTurtle.Slot[i].Data == nil then
- Computer.Connection.ConnectedTurtle.Slot[i].Data = { name = ":Nothing" }
- end
- end
- end
- end
- end
- function Edit(What)
- Enter = false
- Number = "0 "
- local Wich
- local ax, ay
- if What == "XEdit" then
- ax, ay = 60, 6
- Wich = "X"
- elseif What == "ZEdit" then
- ax, ay = 60, 9
- Wich = "Z"
- elseif What == "YEdit" then
- ax, ay = 60, 13
- Wich = "Y"
- elseif What == "LayerEdit" then
- ax, ay = 60, 13
- Wich = "Layer"
- elseif What == "RadiusEdit" then
- ax, ay = 60, 17
- Wich = "Radius"
- end
- MExtraButton.clearButtons()
- MExtraButton.setButton("1", DoEdit, 68, 68 + 4, 5 , 5 + 4, true, "1")
- MExtraButton.setButton("2", DoEdit, 68 + 6, 68 + 10, 5, 5 + 4, true, "2")
- MExtraButton.setButton("3", DoEdit, 68 + 12, 68 + 16, 5, 5 + 4, true, "3")
- MExtraButton.setButton("4", DoEdit, 68, 68 + 4, 5 + 6, 5 + 10, true, "4")
- MExtraButton.setButton("5", DoEdit, 68 + 6, 68 + 10, 5 + 6, 5 + 10, true, "5")
- MExtraButton.setButton("6", DoEdit, 68 + 12, 68 + 16, 5 + 6, 5 + 10, true, "6")
- MExtraButton.setButton("7", DoEdit, 68, 68 + 4, 5 + 12, 5 + 16, true, "7")
- MExtraButton.setButton("8", DoEdit, 68 + 6, 68 + 10, 5 + 12, 5 + 16, true, "8")
- MExtraButton.setButton("9", DoEdit, 68 + 12, 68 + 16, 5 + 12, 5 + 16, true, "9")
- MExtraButton.setButton("R", DoEdit, 68, 68 + 4, 5 + 18, 5 + 22, true, "R")
- MExtraButton.setButton("0", DoEdit, 68 + 6, 68 + 10, 5 + 18, 5 + 22, true, "0")
- MExtraButton.setButton("OK", DoEdit, 68 + 12, 68 + 16, 5 + 18, 5 + 22, true, {What = "OK", W = Wich})
- MExtraButton.setButton("-", DoEdit, 68 + 6, 68 + 10, 5 + 24, 5 + 28, true, "-")
- while not(Enter) do
- MExtraButton.onScreen()
- Monitor[1].setCursorPos(ax, ay)
- Monitor[1].write(Number)
- local Event, p1, p2, p3 = System.pullEvent("monitor_touch")
- if Event == "monitor_touch" then
- local Button, MX, MY = p1, p2, p3
- MExtraButton.buttonPressed(MX, MY)
- end
- end
- Enter = false
- end
- function DoEdit(What)
- if type(What) == "string" then
- if What == "R" then
- Number = "0 "
- else
- if Number == "0 " then
- Number = ""
- end
- Number = Number..What
- end
- elseif type(What) == "table" then
- if What.What == "OK" then
- if Number ~= "0 " then
- if What.W == "X" then
- GoToX = tonumber(Number)
- elseif What.W == "Z" then
- GoToZ = tonumber(Number)
- elseif What.W == "Y" then
- if tonumber(Number) < 251 and tonumber(Number) > 4 then
- GoToY = tonumber(Number)
- else
- if tonumber(Number) > 250 then
- GoToY = 250
- elseif tonumber(Number) < 5 then
- GoToY = 5
- end
- end
- elseif What.W == "Layer" then
- if tonumber(Number) < 251 and tonumber(Number) > 4 then
- Layer = tonumber(Number)
- else
- if tonumber(Number) > 250 then
- Layer = 250
- elseif tonumber(Number) < 5 then
- Layer = 5
- end
- end
- elseif What.W == "Radius" then
- if tonumber(Number) <= MaxRadius and tonumber(Number) >= MinRadius then
- if (tonumber(Number)%2) == 1 then
- Radius = tonumber(Number)
- else
- Radius = tonumber(Number) + 1
- end
- else
- if tonumber(Number) > MaxRadius then
- Radius = MaxRadius
- elseif tonumber(Number) < MinRadius then
- Radius = MinRadius
- end
- end
- end
- end
- Enter = true
- end
- end
- end
- function Quarry(What)
- if What == "Reset" then
- GoToX, GoToY, GoToZ, Radius, Layer = Computer.Connection.ConnectedTurtle.Cor.X, Computer.Connection.ConnectedTurtle.Cor.Y, Computer.Connection.ConnectedTurtle.Cor.Z, 3, 6
- elseif What == "XMin" then
- GoToX = GoToX - 1
- elseif What == "XPlus" then
- GoToX = GoToX + 1
- elseif What == "ZMin" then
- GoToZ = GoToZ - 1
- elseif What == "ZPlus" then
- GoToZ = GoToZ + 1
- elseif What == "LayerMin" then
- if Layer > 5 then
- Layer = Layer - 1
- end
- elseif What == "LayerPlus" then
- if Layer < 250 then
- Layer = Layer + 1
- end
- elseif What == "RadiusMin" then
- if Radius > MinRadius then
- Radius = Radius - 2
- end
- elseif What == "RadiusPlus" then
- if Radius < MaxRadius then
- Radius = Radius + 2
- end
- elseif What == "Start" then
- FreeGroupT = {}
- local oldname = {}
- checkForTurtles()
- for i = 1, #Turtles do
- if Turtles[i].GroupState and Turtles[i].Status then
- table.insert(FreeGroupT, Turtles[i])
- sleep(0.5)
- end
- end
- SendInfo(FreeGroupT[1].Id, "Function", "GTH", Computer.System.Modem.OwnID)
- local Event, p1, p2, p3, p4, p5 = System.pullEvent("modem_message")
- TravelHeight = UnPack(p4)
- sleep(1)
- for i = 1, #FreeGroupT do
- SendInfo(FreeGroupT[i].Id, "Function", "StripMine")
- sleep(1)
- oldname[i] = FreeGroupT[i].Name
- SendInfo(FreeGroupT[i].Id, "Function", "NS", FreeGroupT[i].Name.."Strip Mine")
- sleep(1)
- SendInfo(FreeGroupT[i].Id, "Function", "GT", Tool.PickAxe)
- end
- sleep(10)
- local x, y = Monitor[0].getSize()
- local mx, my = Monitor[1].getSize()
- Monitor[0].clear()
- Monitor[1].clear()
- Monitor[0].setCursorPos(1,math.floor(y/2)+0)
- Monitor[1].setCursorPos(1,math.floor(my/2)+0)
- Monitor[0].write("GoTo Qaurry")
- Monitor[1].write("GoTo Quarry")
- local Cor = {X = GoToX, Y = TravelHeight, Z = GoToZ}
- for i = 1, #FreeGroupT do
- SendInfo(FreeGroupT[i].Id, "Function", "GoTo", Cor)
- sleep(1)
- end
- Cor = {X = GoToX, Y = Layer, Z = GoToZ}
- for i = 1, #FreeGroupT do
- local Event, p1, p2, p3, p4, p5 = System.pullEvent("modem_message")
- SendInfo(p3, "Function", "MQ", Cor)
- end
- sleep(1)
- local Beam = math.floor((Radius - 1) / 2)
- local RadiusA = Radius
- Cor.Z = Cor.Z + Beam
- local done = false
- for i = 1, #FreeGroupT do
- local yes = false
- local Id
- while not(yes) do
- local Event, p1, p2, p3, p4, p5 = System.pullEvent("modem_message")
- Id = p3
- if not(done) then
- done = {}
- table.insert(done, p3)
- yes = true
- else
- local found = false
- for ii = 1, #done do
- if p3 == done[ii] then
- found = true
- break
- end
- end
- if not(found) then
- table.insert(done, p3)
- yes = true
- end
- end
- end
- SendInfo(Id, "Function", "GoTo", Cor)
- if RadiusA > 0 then
- RadiusA = RadiusA - 3
- Cor.Z = Cor.Z - 3
- end
- end
- local Event, p1, p2, p3, p4, p5 = System.pullEvent("modem_message")
- for i = 1, #FreeGroupT do
- SendInfo(FreeGroupT[i].Id, "Function", "TD", 1)
- end
- UpDaTe()
- for i = 1, #FreeGroupT do
- SendInfo(FreeGroupT[i].Id, "Function", "TD", 1)
- end
- sleep(2)
- local On = true
- while On do
- Monitor[0].setCursorPos(1,math.floor(y/2)+0)
- Monitor[1].setCursorPos(1,math.floor(my/2)+0)
- Monitor[0].clearLine()
- Monitor[1].clearLine()
- Monitor[0].write("Getting Information")
- Monitor[1].write("Getting Information")
- local FunctionSend = {}
- table.insert(FunctionSend, "A")
- for i = 1, Beam do
- table.insert(FunctionSend, "DFW")
- table.insert(FunctionSend, "A")
- for a = 1, 2 do
- table.insert(FunctionSend, "D")
- end
- table.insert(FunctionSend, "A")
- end
- for i = 1, Beam do
- table.insert(FunctionSend, "S")
- end
- for i = 1, 2 do
- table.insert(FunctionSend, "D")
- end
- for i = 1, Beam do
- table.insert(FunctionSend, "DFW")
- table.insert(FunctionSend, "A")
- for a = 1, 2 do
- table.insert(FunctionSend, "D")
- end
- table.insert(FunctionSend, "A")
- end
- for i = 1, Beam do
- table.insert(FunctionSend, "S")
- end
- table.insert(FunctionSend, "A")
- table.insert(FunctionSend, "CINV")
- table.insert(FunctionSend, "Fuel")
- Monitor[0].setCursorPos(1,math.floor(y/2)+0)
- Monitor[1].setCursorPos(1,math.floor(my/2)+0)
- Monitor[0].clearLine()
- Monitor[1].clearLine()
- Monitor[0].write("Doing Qaurry on Layer: "..Layer.." Radius: "..Radius)
- Monitor[1].write("Doing Quarry on Layer: "..Layer.." Radius: "..Radius)
- for i = 1, #FreeGroupT do
- SendInfo(FreeGroupT[i].Id, "Function", FunctionSend)
- sleep(0.5)
- end
- UpDaTe()
- if RadiusA > 0 then
- for i = 1, #FreeGroupT do
- SendInfo(FreeGroupT[i].Id, "Function", "GoTo", Cor)
- RadiusA = RadiusA - 3
- Cor.Z = Cor.Z - 3
- end
- for i = 1, #FreeGroupT do
- local Event, p1, p2, p3, p4, p5 = System.pullEvent("modem_message")
- SendInfo(p3, "Function", "TD", 1)
- end
- else
- On = false
- end
- sleep(1)
- end
- Monitor[0].setCursorPos(1,math.floor(y/2)+0)
- Monitor[1].setCursorPos(1,math.floor(my/2)+0)
- Monitor[0].clearLine()
- Monitor[1].clearLine()
- Monitor[0].write("Done, Going Home")
- Monitor[1].write("Done, Going Home")
- Cor = {X = GoToX, Y = Layer, Z = GoToZ}
- for i = 1, #FreeGroupT do
- SendInfo(FreeGroupT[i].Id, "Function", "GoTo", Cor)
- end
- for i = 1, #FreeGroupT do
- local Event, p1, p2, p3, p4, p5 = System.pullEvent("modem_message")
- SendInfo(FreeGroupT[i].Id, "Function", "Home")
- end
- UpDaTe()
- for i = 1, #FreeGroupT do
- SendInfo(FreeGroupT[i].Id, "Function", "INV")
- end
- UpDaTe()
- for i = 1, #FreeGroupT do
- SendInfo(FreeGroupT[i].Id, "Function", "PTA")
- end
- UpDaTe()
- for i = 1, #FreeGroupT do
- SendInfo(FreeGroupT[i].Id, "Function", "NS", oldname[i])
- end
- UpDaTe()
- for i = 1, #FreeGroupT do
- SendInfo(FreeGroupT[i].Id, "Function", "StripMineDone")
- end
- end
- end
- local MINVButtonShow = false
- function Do(What)
- if What == "EmptyInventory" then
- if not(MINVButtonShow) then
- MINVButton.setButtonShow("Slot", true)
- MINVButton.setButtonShow("All", true)
- MINVButtonShow = true
- else
- MINVButton.setButtonShow("Slot", false)
- MINVButton.setButtonShow("All", false)
- MINVButtonShow = false
- end
- elseif What == "EmptyInventorySlot" then
- local Data = {What = "Function", Function = "DRD", Data = 64}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- sleep (0.5)
- MINVButton.toggleButton("Slot")
- MINVButton.setButtonShow("Slot", false)
- MINVButton.setButtonShow("All", false)
- MINVButtonShow = false
- MINVButton.toggleButton("Empty")
- elseif What == "EmptyInventoryAll" then
- local Data = {What = "Command", Command = "/EmptyInventory/"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- sleep (0.5)
- MINVButton.toggleButton("All")
- MINVButton.setButtonShow("Slot", false)
- MINVButton.setButtonShow("All", false)
- MINVButtonShow = false
- MINVButton.toggleButton("Empty")
- elseif What == "EquipLeft" then
- local Data = {What = "Command", Command = "/EqUip/", Data = "left"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- sleep (0.5)
- MINVButton.toggleButton("Equip")
- elseif What == "Fuel" then
- local Data = {What = "Function", Function = "Fuel"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- sleep (0.5)
- MINVButton.toggleButton("Refuel")
- elseif What == "Transfer" then
- local mx, my = Monitor[1].getSize()
- local BottomMonitor = my - 1
- local TopMonitor = 1 + 1
- local EndMonitor = mx + 1
- local BeginMonitor = 1 + 1
- MExtraButton.clearTable()
- MExtraButton.setButton("1", TransferTo, BeginMonitor + 35, BeginMonitor + 39, TopMonitor + 3, TopMonitor + 5, 1, true)
- MExtraButton.setButton("2", TransferTo, BeginMonitor + 41, BeginMonitor + 45, TopMonitor + 3, TopMonitor + 5, 2, true)
- MExtraButton.setButton("3", TransferTo, BeginMonitor + 47, BeginMonitor + 51, TopMonitor + 3, TopMonitor + 5, 3, true)
- MExtraButton.setButton("4", TransferTo, BeginMonitor + 53, BeginMonitor + 57, TopMonitor + 3, TopMonitor + 5, 4, true)
- MExtraButton.setButton("5", TransferTo, BeginMonitor + 35, BeginMonitor + 39, TopMonitor + 7, TopMonitor + 9, 5, true)
- MExtraButton.setButton("6", TransferTo, BeginMonitor + 41, BeginMonitor + 45, TopMonitor + 7, TopMonitor + 9, 6, true)
- MExtraButton.setButton("7", TransferTo, BeginMonitor + 47, BeginMonitor + 51, TopMonitor + 7, TopMonitor + 9, 7, true)
- MExtraButton.setButton("8", TransferTo, BeginMonitor + 53, BeginMonitor + 57, TopMonitor + 7, TopMonitor + 9, 8, true)
- MExtraButton.setButton("9", TransferTo, BeginMonitor + 35, BeginMonitor + 39, TopMonitor + 11, TopMonitor + 13, 9, true)
- MExtraButton.setButton("10", TransferTo, BeginMonitor + 41, BeginMonitor + 45, TopMonitor + 11, TopMonitor + 13, 10, true)
- MExtraButton.setButton("11", TransferTo, BeginMonitor + 47, BeginMonitor + 51, TopMonitor + 11, TopMonitor + 13, 11, true)
- MExtraButton.setButton("12", TransferTo, BeginMonitor + 53, BeginMonitor + 57, TopMonitor + 11, TopMonitor + 13, 12, true)
- MExtraButton.setButton("13", TransferTo, BeginMonitor + 35, BeginMonitor + 39, TopMonitor + 15, TopMonitor + 17, 13, true)
- MExtraButton.setButton("14", TransferTo, BeginMonitor + 41, BeginMonitor + 45, TopMonitor + 15, TopMonitor + 17, 14, true)
- MExtraButton.setButton("15", TransferTo, BeginMonitor + 47, BeginMonitor + 51, TopMonitor + 15, TopMonitor + 17, 15, true)
- MExtraButton.setButton("16", TransferTo, BeginMonitor + 53, BeginMonitor + 57, TopMonitor + 15, TopMonitor + 17, 16, true)
- MExtraButton.onScreen()
- local Event, p1, p2, p3 = System.pullEvent("monitor_touch")
- if Event == "monitor_touch" then
- local Button, MX, MY = p1, p2, p3
- MExtraButton.buttonPressed(MX, MY)
- end
- sleep (0.5)
- MINVButton.toggleButton("Transfer")
- elseif What == "GoHome" then
- local Data = {What = "Command", Command = "/GoHome/"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif What == "GoTo" then
- GoToX, GoToY, GoToZ = Computer.Connection.ConnectedTurtle.Cor.X, Computer.Connection.ConnectedTurtle.Cor.Y, Computer.Connection.ConnectedTurtle.Cor.Z
- Enter = false
- while not(Enter) do
- local mw, mh = Monitor[1].getSize()
- MExtraButton.clearButtons()
- MExtraButton.setButton("X Up", Change, 10, 16, (mh/2)-5, (mh/2)-3, true, "X Up")
- MExtraButton.setButton("X Down", Change, 10, 16, (mh/2)+3, (mh/2)+5, true, "X Down")
- MExtraButton.setButton("X Edit", Edit, 10, 16, (mh/2)+6, (mh/2)+8, true, "XEdit")
- MExtraButton.setButton("Y Up", Change, 17, 23, (mh/2)-5, (mh/2)-3, true, "Y Up")
- MExtraButton.setButton("Y Down", Change, 17, 23, (mh/2)+3, (mh/2)+5, true, "Y Down")
- MExtraButton.setButton("Y Edit", Edit, 17, 23, (mh/2)+6, (mh/2)+8, true, "YEdit")
- MExtraButton.setButton("Z Up", Change, 24, 30, (mh/2)-5, (mh/2)-3, true, "Z Up")
- MExtraButton.setButton("Z Down", Change, 24, 30, (mh/2)+3, (mh/2)+5, true, "Z Down")
- MExtraButton.setButton("Z Edit", Edit, 24, 30, (mh/2)+6, (mh/2)+8, true, "ZEdit")
- MExtraButton.setButton("Enter", Change, 32, 37, (mh/2)-1, (mh/2)+1, true, "Enter")
- Monitor[1].clear()
- MExtraButton.onScreen()
- Monitor[1].setCursorPos(1, mh/2)
- Monitor[1].write("Goto: X: ".. GoToX.." Y: "..GoToY.." Z: "..GoToZ)
- local Event, p1, p2, p3 = System.pullEvent("monitor_touch")
- if Event == "monitor_touch" then
- local Button, MX, MY = p1, p2, p3
- MExtraButton.buttonPressed(MX, MY)
- end
- end
- local Cor = {X = GoToX, Y = GoToY, Z = GoToZ}
- local Data = {What = "Command", Command = "/GoTo/", Data = Cor}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- end
- function TransferTo(What)
- local Data = {What = "Command", Command = "/TransferTo/", Data = tonumber(What)}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- function Change(What)
- if What == "X Up" then
- GoToX = GoToX + 1
- elseif What == "X Down" then
- GoToX = GoToX - 1
- elseif What == "Y Up" then
- if GoToY < 250 then
- GoToY = GoToY + 1
- end
- elseif What == "Y Down" then
- if GoToY > 5 then
- GoToY = GoToY - 1
- end
- elseif What == "Z Up" then
- GoToZ = GoToZ + 1
- elseif What == "Z Down" then
- GoToZ = GoToZ - 1
- elseif What == "Enter" then
- Enter = true
- end
- end
- function GetOrientNames(R)
- if R == 1 then
- return "North"
- elseif R == 2 then
- return "East"
- elseif R == 3 then
- return "South"
- elseif R == 4 then
- return "West"
- end
- end
- function Move(What)
- if What == "up" then
- local Data = {What = "Function", Function = "R"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif What == "down" then
- local Data = {What = "Function", Function = "F"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif What == "forward" then
- local Data = {What = "Function", Function = "W"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif What == "back" then
- local Data = {What = "Function", Function = "S"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif What == "left" then
- local Data = {What = "Function", Function = "A"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif What == "right" then
- local Data = {What = "Function", Function = "D"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- end
- function Dig(What)
- if What == "up" then
- local Data = {What = "Function", Function = "DU"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif What == "forward" then
- local Data = {What = "Function", Function = "DF"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif What == "down" then
- local Data = {What = "Function", Function = "DD"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- end
- function Place(What)
- if What == "up" then
- local Data = {What = "Function", Function = "PU"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif What == "forward" then
- local Data = {What = "Function", Function = "PF"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif What == "down" then
- local Data = {What = "Function", Function = "PD"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- end
- function Suck(What)
- if What == "up" then
- local Data = {What = "Function", Function = "SU"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif What == "forward" then
- local Data = {What = "Function", Function = "SF"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif What == "down" then
- local Data = {What = "Function", Function = "SD"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- end
- function Drop(What)
- if What == "up" then
- local Data = {What = "Function", Function = "DRU"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif What == "forward" then
- local Data = {What = "Function", Function = "DRF"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif What == "down" then
- local Data = {What = "Function", Function = "DRD"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- end
- function SendInfo(ID, What, Data1, Data2)
- local Data
- if What == "Function" then
- if not(Data2) then
- Data = {What = What, Function = Data1}
- else
- Data = {What = What, Function = Data1, Data = Data2}
- end
- WModem.Send(ID, Computer.System.Modem.OwnID, Pack(Data))
- elseif What == "Command" then
- if not(Data2) then
- Data = {What = What, Command = Data1}
- else
- Data = {What = What, Command = Data1, Data = Data2}
- end
- WModem.Send(ID, Computer.System.Modem.OwnID, Pack(Data))
- end
- end
- function UpDaTe()
- local done = false
- for i = 1, #FreeGroupT do
- local yes = false
- local Id
- while not(yes) do
- local Event, p1, p2, p3, p4, p5 = System.pullEvent("modem_message")
- Id = p3
- if not(done) then
- done = {}
- table.insert(done, p3)
- yes = true
- else
- local found = false
- for ii = 1, #done do
- if p3 == done[ii] then
- found = true
- break
- end
- end
- if not(found) then
- table.insert(done, p3)
- yes = true
- end
- end
- end
- end
- end
- function onEnter()
- if (Computer.Connection.Connected) then
- if nOption == 1 then
- -- System
- nSystemOption = 1
- local Back = false
- Monitor[0].clear()
- Monitor[0].setCursorPos(1, 1)
- while not(Back) do
- drawSystemMenu()
- drawSystemFrontend()
- local Event, p1, p2, p3, p4, p5 = System.pullEvent()
- if Event == "key" then
- if p1 == keys.up or p1 == keys.numPad8 then
- if nSystemOption > 1 then
- nSystemOption = nSystemOption - 1
- end
- elseif p1 == keys.down or p1 == keys.numPad2 then
- if nSystemOption < MaxSystemOptions then
- nSystemOption = nSystemOption + 1
- end
- elseif p1 == keys.enter or p1 == keys.numPadEnter then
- if nSystemOption == 1 then
- -- DisConnection turtle
- nMonitorTurtleInventoryOption = 0
- nMonitorOption = 0
- MButtonn = false
- ButtonInfo = false
- ButtonInventory = false
- Button.clearButtons()
- ConnectedID = 0
- ConnectedTurtle = {}
- Computer.Connection.Connected = false
- Back = true
- elseif nSystemOption == 2 then
- -- Reboot
- SaveSettings()
- System.reboot()
- elseif nSystemOption == 3 then
- -- Reset
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "Rest Computer? ... Y/N")
- local Event, p1, p2, p3 = System.pullEvent("key")
- if p1 == keys.y then
- local File = fs.exists("/Progs/.Data/.Settings.set", "r")
- if File then
- Functions.DelFile("/Progs/.Data/.Settings.set")
- end
- System.reboot()
- end
- elseif nSystemOption == 4 then
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "Run Uninstaller? ... Y/N")
- local Event, p1, p2, p3 = System.pullEvent("key")
- if p1 == keys.y then
- shell.run("/OS/Unintall.lua")
- end
- end
- elseif p1 == keys.b then
- Back = true
- end
- end
- end
- elseif nOption == 2 then
- -- Turtle Info
- nTurtleInfoOption = 1
- local Back = false
- Monitor[0].clear()
- Monitor[0].setCursorPos(1, 1)
- while not(Back) do
- drawTurtleInfo()
- Timer[1] = System.startTimer(5)
- local Event, p1, p2, p3, p4, p5 = System.pullEvent()
- if Event == "key" then
- if p1 == keys.up or p1 == keys.numPad8 then
- System.cancelTimer(Timer[1])
- if nTurtleInfoOption > 1 then
- nTurtleInfoOption = nTurtleInfoOption - 1
- end
- elseif p1 == keys.down or p1 == keys.numPad2 then
- System.cancelTimer(Timer[1])
- if nTurtleInfoOption < MaxTurtleInfoOptions then
- nTurtleInfoOption = nTurtleInfoOption + 1
- end
- elseif p1 == keys.b or p1 == keys.enter or p1 == keys.numPadEnter then
- System.cancelTimer(Timer[1])
- Back = true
- end
- elseif Event == "timer" then
- System.cancelTimer(Timer[1])
- end
- end
- elseif nOption == 3 then
- -- Turtle System
- if Computer.Connection.ConnectedTurtle.Status then
- nTurtleSystemOption = 1
- local Back = false
- Monitor[0].clear()
- Monitor[0].setCursorPos(1, 1)
- while not(Back) do
- drawTurtleSystemMenu()
- drawTurtleSystemFrontend()
- local Event, p1, p2, p3, p4, p5 = System.pullEvent()
- if Event == "key" then
- if p1 == keys.up or p1 == keys.numPad8 then
- if nTurtleSystemOption > 1 then
- nTurtleSystemOption = nTurtleSystemOption - 1
- end
- elseif p1 == keys.down or p1 == keys.numPad2 then
- if nTurtleSystemOption < MaxTurtleSystemOptions then
- nTurtleSystemOption = nTurtleSystemOption + 1
- end
- elseif p1 == keys.enter or p1 == keys.numPadEnter then
- if nTurtleSystemOption == 1 then
- local Data = {What = "Command", Command = "/GroupState/"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- sleep(1)
- checkForTurtles()
- for i = 1, #Turtles do
- if Turtles[i].Id == Computer.Connection.ConnectedTurtle.Id then
- Computer.Connection.ConnectedTurtle = Turtles[i]
- end
- end
- elseif nTurtleSystemOption == 2 then
- local Data = {What = "Command", Command = "/ReFuel/"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- sleep(1)
- checkForTurtles()
- for i = 1, #Turtles do
- if Turtles[i].Id == Computer.Connection.ConnectedTurtle.Id then
- Computer.Connection.ConnectedTurtle = Turtles[i]
- end
- end
- elseif nTurtleSystemOption == 3 then
- local Number = ""
- while type(Number) ~= "number" do
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "Number 1/16: ")
- Number = tonumber(read())
- end
- local Data = {What = "Command", Command = "/SelectSlot/", Data = Number}
- WModem.Send(Computer.Connection.ConnectedID, Computer.System.Modem.OwnID, Pack(Data))
- elseif nTurtleSystemOption == 4 then
- nTurtleEquipOption = 1
- local TurtleEquipBack = false
- while not(TurtleEquipBack) do
- drawTurtleEquipFrontend()
- local Event, p1, p2, p3, p4, p5 = System.pullEvent()
- if Event == "key" then
- if p1 == keys.up or p1 == keys.numPad8 then
- if nTurtleEquipOption > 1 then
- nTurtleEquipOption = nTurtleEquipOption - 1
- end
- elseif p1 == keys.down or p1 == keys.numPad2 then
- if nTurtleEquipOption < MaxTurtleEquipOptions then
- nTurtleEquipOption = nTurtleEquipOption + 1
- end
- elseif p1 == keys.enter or p1 == keys.numPadEnter then
- if nTurtleEquipOption == 1 then
- local Data = {What = "Command", Command = "/EqUip/", Data = "left"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif nTurtleEquipOption == 2 then
- local Data = {What = "Command", Command = "/EqUip/", Data = "right"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- TurtleEquipBack = true
- elseif p1 == keys.b then
- TurtleEquipBack = true
- end
- end
- end
- elseif nTurtleSystemOption == 5 then
- local Number = ""
- while type(Number) ~= "number" do
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "Number 1/16: ")
- Number = tonumber(read())
- end
- local Data = {What = "Command", Command = "/TransferTo/", Data = Number}
- WModem.Send(Computer.Connection.ConnectedID, Computer.System.Modem.OwnID, Pack(Data))
- elseif nTurtleSystemOption == 6 then
- local Data = {What = "Command", Command = "/CrAft/"}
- WModem.Send(Computer.Connection.ConnectedID, Computer.System.Modem.OwnID, Pack(Data))
- elseif nTurtleSystemOption == 7 then
- nTurtleDetectOption = 1
- local TurtleDetectBack = false
- while not(TurtleDetectBack) do
- drawTurtleDetectFrontend()
- local Event, p1, p2, p3, p4, p5 = System.pullEvent()
- if Event == "key" then
- if p1 == keys.up or p1 == keys.numPad8 then
- if nTurtleDetectOption > 1 then
- nTurtleDetectOption = nTurtleDetectOption - 1
- end
- elseif p1 == keys.down or p1 == keys.numPad2 then
- if nTurtleDetectOption < MaxTurtleDetectOptions then
- nTurtleDetectOption = nTurtleDetectOption + 1
- end
- elseif p1 == keys.enter or p1 == keys.numPadEnter then
- if nTurtleDetectOption == 1 then
- local Data = {What = "Command", Command = "/DeTect/", Data = "forward"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif nTurtleDetectOption == 2 then
- local Data = {What = "Command", Command = "/DeTect/", Data = "up"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif nTurtleDetectOption == 3 then
- local Data = {What = "Command", Command = "/DeTect/", Data = "down"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- sleep(1)
- checkForTurtles()
- for i = 1, #Turtles do
- if Turtles[i].Id == Computer.Connection.ConnectedTurtle.Id then
- Computer.Connection.ConnectedTurtle = Turtles[i]
- end
- end
- TurtleDetectBack = true
- elseif p1 == keys.b then
- TurtleDetectBack = true
- end
- end
- end
- elseif nTurtleSystemOption == 8 then
- nTurtleInspectOption = 1
- local TurtleInspectBack = false
- while not(TurtleInspectBack) do
- drawTurtleInspectFrontend()
- local Event, p1, p2, p3, p4, p5 = System.pullEvent()
- if Event == "key" then
- if p1 == keys.up or p1 == keys.numPad8 then
- if nTurtleInspectOption > 1 then
- nTurtleInspectOption = nTurtleInspectOption - 1
- end
- elseif p1 == keys.down or p1 == keys.numPad2 then
- if nTurtleInspectOption < MaxTurtleInspectOptions then
- nTurtleInspectOption = nTurtleInspectOption + 1
- end
- elseif p1 == keys.enter or p1 == keys.numPadEnter then
- local Side
- if nTurtleInspectOption == 1 then
- local Data = {What = "Command", Command = "/InSpect/", Data = "forward"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- Side = "forward"
- elseif nTurtleInspectOption == 2 then
- local Data = {What = "Command", Command = "/InSpect/", Data = "up"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- Side = "up"
- elseif nTurtleInspectOption == 3 then
- local Data = {What = "Command", Command = "/InSpect/", Data = "down"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- Side = "down"
- end
- sleep(1)
- checkForTurtles()
- for i = 1, #Turtles do
- if Turtles[i].Id == Computer.Connection.ConnectedTurtle.Id then
- Computer.Connection.ConnectedTurtle = Turtles[i]
- end
- end
- local TurtleInspectInfoBack = false
- local Table = {}
- if Side == "forward" then
- Table = Computer.Connection.ConnectedTurtle.Inspect.Forward
- elseif Side == "up" then
- Table = Computer.Connection.ConnectedTurtle.Inspect.Up
- elseif Side == "down" then
- Table = Computer.Connevtion.ConnectedTurtle.Inspect.Down
- end
- while not(TurtleInspectInfoBack) do
- drawTurtleInspectInfoFrontend(Table)
- local Event, p1, p2, p3, p4, p5 = System.pullEvent()
- if Event == "key" then
- if p1 == keys.b or p1 == keys.enter or p1 == keys.numPadEnter then
- TurtleInspectInfoBack = true
- end
- end
- end
- elseif p1 == keys.b then
- TurtleInspectBack = true
- end
- end
- end
- elseif nTurtleSystemOption == 9 then
- nTurtleCompareOption = 1
- local TurtleCompareBack = false
- while not(TurtleCompareBack) do
- drawTurtleCompareFrontend()
- local Event, p1, p2, p3, p4, p5 = System.pullEvent()
- if Event == "key" then
- if p1 == keys.up or p1 == keys.numPad8 then
- if nTurtleCompareOption > 1 then
- nTurtleCompareOption = nTurtleCompareOption - 1
- end
- elseif p1 == keys.down or p1 == keys.numPad2 then
- if nTurtleCompareOption < MaxTurtleCompareOptions then
- nTurtleCompareOption = nTurtleCompareOption + 1
- end
- elseif p1 == keys.enter or p1 == keys.numPadEnter then
- if nTurtleCompareOption == 1 then
- local Data = {What = "Command", Command = "/ComPare/", Data = "forward"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif nTurtleCompareOption == 2 then
- local Data = {What = "Command", Command = "/ComPare/", Data = "up"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif nTurtleCompareOption == 3 then
- local Data = {What = "Command", Command = "/ComPare/", Data = "down"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- sleep(1)
- checkForTurtles()
- for i = 1, #Turtles do
- if Turtles[i].Id == Computer.Connection.ConnectedTurtle.Id then
- Computer.Connection.ConnectedTurtle = Turtles[i]
- end
- end
- TurtleCompareBack = true
- elseif p1 == keys.b then
- TurtleCompareBack = true
- end
- end
- end
- elseif nTurtleSystemOption == 10 then
- if Computer.Connection.ConnectedTurtleId ~= Computer.System.Modem.SharedID then
- local Data = {What = "Command", Command = "/PrintLog/"}
- WModem.Send(Computer.Connection.ConnectedID, Computer.System.Modem.OwnID, Pack(Data))
- end
- elseif nTurtleSystemOption == 11 then
- local Data = {What = "Command", Command = "/ReBoot/"}
- WModem.Send(Computer.Connection.ConnectedID, Computer.System.Modem.OwnID, Pack(Data))
- elseif nTurtleSystemOption == 12 then
- local Data = {What = "Command", Command = "/ShutDown/"}
- WModem.Send(Computer.Connection.ConnectedID, Computer.System.Modem.OwnID, Pack(Data))
- nOption = 1
- ConnectedID = 0
- ConnectedTurtle = {}
- Computer.Connection.Connected = false
- Back = true
- elseif nTurtleSystemOption == 13 then
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "Reset Turtle? ... Y/N")
- local Event, p1, p2, p3 = System.pullEvent("key")
- if p1 == keys.y then
- local Data = {What = "Command", Command = "/ReSet/"}
- WModem.Send(Computer.Connection.ConnectedID, Computer.System.Modem.OwnID, Pack(Data))
- nOption = 1
- ConnectedID = 0
- ConnectedTurtle = {}
- Computer.Connection.Connected = false
- Back = true
- end
- end
- elseif p1 == keys.b then
- Back = true
- end
- end
- end
- end
- elseif nOption == 4 then
- -- Turtle Movements
- if Computer.Connection.ConnectedTurtle.Status then
- nTurtleMovementsOption = 1
- local Back = false
- Monitor[0].clear()
- Monitor[0].setCursorPos(1, 1)
- while not(Back) do
- drawTurtleMovementsMenu()
- drawTurtleMovementsFrontend()
- local Event, p1, p2, p3, p4, p5 = System.pullEvent()
- if Event == "key" then
- if p1 == keys.up or p1 == keys.numPad8 then
- if nTurtleMovementsOption > 1 then
- nTurtleMovementsOption = nTurtleMovementsOption - 1
- end
- elseif p1 == keys.down or p1 == keys.numPad2 then
- if nTurtleMovementsOption < MaxTurtleMovementsOptions then
- nTurtleMovementsOption = nTurtleMovementsOption + 1
- end
- elseif p1 == keys.enter or p1 == keys.numPadEnter then
- if nTurtleMovementsOption == 1 then
- nTurtleAttackOption = 1
- local AttackBack = false
- while not(AttackBack) do
- drawTurtleAttackFrontend()
- local Event, p1, p2, p3, p4, p5 = System.pullEvent()
- if Event == "key" then
- if p1 == keys.up or p1 == keys.numPad8 then
- if nTurtleAttackOption > 1 then
- nTurtleAttackOption = nTurtleAttackOption - 1
- end
- elseif p1 == keys.down or p1 == keys.numPad2 then
- if nTurtleAttackOption < MaxTurtleAttackOptions then
- nTurtleAttackOption = nTurtleAttackOption + 1
- end
- elseif p1 == keys.enter or p1 == keys.numPadEnter then
- if nTurtleAttackOption == 1 then
- local Data = {What = "Command", Command = "/AtTack/", Data = "forward"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif nTurtleAttackOption == 2 then
- local Data = {What = "Command", Command = "/AtTack/", Data = "up"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif nTurtleAttackOption == 3 then
- local Data = {What = "Command", Command = "/AtTack/", Data = "down"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- AttackBack = true
- elseif p1 == keys.b then
- AttackBack = true
- end
- end
- end
- elseif nTurtleMovementsOption == 2 then
- nTurtleDigOption = 1
- local DigBack = false
- while not(DigBack) do
- drawTurtleDigFrontend()
- local Event, p1, p2, p3, p4, p5 = System.pullEvent()
- if Event == "key" then
- if p1 == keys.up or p1 == keys.numPad8 then
- if nTurtleDigOption > 1 then
- nTurtleDigOption = nTurtleDigOption - 1
- end
- elseif p1 == keys.down or p1 == keys.numPad2 then
- if nTurtleDigOption < MaxTurtleDigOptions then
- nTurtleDigOption = nTurtleDigOption + 1
- end
- elseif p1 == keys.enter or p1 == keys.numPadEnter then
- if nTurtleDigOption == 1 then
- local Data = {What = "Command", Command = "/DiG/", Data = "forward"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif nTurtleDigOption == 2 then
- local Data = {What = "Command", Command = "/DiG/", Data = "up"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif nTurtleDigOption == 3 then
- local Data = {What = "Command", Command = "/DiG/", Data = "down"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- DigBack = true
- elseif p1 == keys.b then
- DigBack = true
- end
- end
- end
- sleep(1)
- checkForTurtles()
- for i = 1, #Turtles do
- if Turtles[i].Id == Computer.Connection.ConnectedTurtle.Id then
- Computer.Connection.ConnectedTurtle = Turtles[i]
- end
- end
- elseif nTurtleMovementsOption == 3 then
- nTurtleSuckOption = 1
- local SuckBack = false
- while not(SuckBack) do
- drawTurtleSuckFrontend()
- local Event, p1, p2, p3, p4, p5 = System.pullEvent()
- if Event == "key" then
- if p1 == keys.up or p1 == keys.numPad8 then
- if nTurtleSuckOption > 1 then
- nTurtleSuckOption = nTurtleSuckOption - 1
- end
- elseif p1 == keys.down or p1 == keys.numPad2 then
- if nTurtleSuckOption < MaxTurtleSuckOptions then
- nTurtleSuckOption = nTurtleSuckOption + 1
- end
- elseif p1 == keys.enter or p1 == keys.numPadEnter then
- if nTurtleSuckOption == 1 then
- local Data = {What = "Command", Command = "/SuCk/", Data = "forward"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif nTurtleSuckOption == 2 then
- local Data = {What = "Command", Command = "/SuCk/", Data = "up"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif nTurtleSuckOption == 3 then
- local Data = {What = "Command", Command = "/SuCk/", Data = "down"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- SuckBack = true
- elseif p1 == keys.b then
- SuckBack = true
- end
- end
- end
- elseif nTurtleMovementsOption == 4 then
- nTurtleDropOption = 1
- local DropBack = false
- while not(DropBack) do
- drawTurtleDropFrontend()
- local Event, p1, p2, p3, p4, p5 = System.pullEvent()
- if Event == "key" then
- if p1 == keys.up or p1 == keys.numPad8 then
- if nTurtleDropOption > 1 then
- nTurtleDropOption = nTurtleDropOption - 1
- end
- elseif p1 == keys.down or p1 == keys.numPad2 then
- if nTurtleDropOption < MaxTurtleDropOptions then
- nTurtleDropOption = nTurtleDropOption + 1
- end
- elseif p1 == keys.enter or p1 == keys.numPadEnter then
- if nTurtleDropOption == 1 then
- local Data = {What = "Command", Command = "/DrOp/", Data = "forward"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif nTurtleDropOption == 2 then
- local Data = {What = "Command", Command = "/DrOp/", Data = "up"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif nTurtleDropOption == 3 then
- local Data = {What = "Command", Command = "/DrOp/", Data = "down"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- DropBack = true
- elseif p1 == keys.b then
- DropBack = true
- end
- end
- end
- elseif nTurtleMovementsOption == 5 then
- nTurtlePlaceOption = 1
- local PlaceBack = false
- while not(PlaceBack) do
- drawTurtlePlaceFrontend()
- local Event, p1, p2, p3, p4, p5 = System.pullEvent()
- if Event == "key" then
- if p1 == keys.up or p1 == keys.numPad8 then
- if nTurtlePlaceOption > 1 then
- nTurtlePlaceOption = nTurtlePlaceOption - 1
- end
- elseif p1 == keys.down or p1 == keys.numPad2 then
- if nTurtlePlaceOption < MaxTurtlePlaceOptions then
- nTurtlePlaceOption = nTurtlePlaceOption + 1
- end
- elseif p1 == keys.enter or p1 == keys.numPadEnter then
- if nTurtlePlaceOption == 1 then
- local Data = {What = "Command", Command = "/PlAce/", Data = "forward"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif nTurtlePlaceOption == 2 then
- local Data = {What = "Command", Command = "/PlAce/", Data = "up"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif nTurtlePlaceOption == 3 then
- local Data = {What = "Command", Command = "/PlAce/", Data = "down"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- PlaceBack = true
- elseif p1 == keys.b then
- PlaceBack = true
- end
- end
- end
- sleep(1)
- checkForTurtles()
- for i = 1, #Turtles do
- if Turtles[i].Id == Computer.Connection.ConnectedTurtle.Id then
- Computer.Connection.ConnectedTurtle = Turtles[i]
- end
- end
- elseif nTurtleMovementsOption == 6 then
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "X Cor: ")
- local X = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "Y Cor: ")
- local Y = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "Z Cor: ")
- local Z = tonumber(read())
- local Cor = {X = X, Y = Y, Z = Z}
- local Data = {What = "Command", Command = "/GoTo/", Data = Cor}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- elseif nTurtleMovementsOption == 7 then
- local Data = {What = "Command", Command = "/GoHome/"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- sleep(1)
- checkForTurtles()
- for i = 1, #Turtles do
- if Turtles[i].Id == Computer.Connection.ConnectedTurtle.Id then
- Computer.Connection.ConnectedTurtle = Turtles[i]
- end
- end
- elseif nTurtleMovementsOption == 8 then
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "1 = North, 2 = East, 3 = South, 4 = West: ")
- local R = tonumber(read())
- local Data = {What = "Command", Command = "/TurnDirection/", Data = R}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- sleep(1)
- checkForTurtles()
- for i = 1, #Turtles do
- if Turtles[i].Id == Computer.Connection.ConnectedTurtle.Id then
- Computer.Connection.ConnectedTurtle = Turtles[i]
- end
- end
- elseif nTurtleMovementsOption == 9 then
- local Data = {What = "Command", Command = "/EmptyInventory/"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- elseif p1 == keys.w and p2 then
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "How manny blocks: ")
- local Number = tonumber(read())
- for i = 1, Number - 1 do
- Move("forward")
- sleep(3)
- end
- elseif p1 == keys.w then
- Move("forward")
- elseif p1 == keys.s and p2 then
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "How manny blocks: ")
- local Number = tonumber(read())
- for i = 1, Number - 1 do
- Move("back")
- sleep(3)
- end
- elseif p1 == keys.s then
- Move("back")
- elseif p1 == keys.a then
- Move("left")
- elseif p1 == keys.d then
- Move("right")
- elseif p1 == keys.r and p2 then
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "How manny blocks: ")
- local Number = tonumber(read())
- for i = 1, Number - 1 do
- Move("up")
- sleep(3)
- end
- elseif p1 == keys.r then
- Move("up")
- elseif p1 == keys.f and p2 then
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "How manny blocks: ")
- local Number = tonumber(read())
- for i = 1, Number - 1 do
- Move("down")
- sleep(3)
- end
- elseif p1 == keys.f then
- Move("down")
- elseif p1 == keys.b then
- Back = true
- end
- elseif Event == "mouse_click" then
- local Butt, MX, MY = p1, p2, p3
- Button.buttonPressed(MX,MY)
- end
- end
- end
- elseif nOption == 5 then
- -- Turtle Program's
- if Computer.Connection.ConnectedTurtle.Status then
- nTurtleProgramsOption = 1
- local Back = false
- Monitor[0].clear()
- Monitor[0].setCursorPos(1, 1)
- while not(Back) do
- drawTurtleProgramsMenu()
- drawTurtleProgramsFrontend()
- local Event, p1, p2, p3, p4, p5 = System.pullEvent()
- if Event == "key" then
- if p1 == keys.up or p1 == keys.numPad8 then
- if nTurtleProgramsOption > 1 then
- nTurtleProgramsOption = nTurtleProgramsOption - 1
- end
- elseif p1 == keys.down or p1 == keys.numPad2 then
- if nTurtleProgramsOption < MaxTurtleProgramsOptions then
- nTurtleProgramsOption = nTurtleProgramsOption + 1
- end
- elseif p1 == keys.enter or p1 == keys.numPadEnter then
- if not(Computer.System.Nether) then
- if nTurtleProgramsOption == 1 then
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "Quarry X: ")
- local X = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "Quarry Y: ")
- local Y = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "Quarry Z: ")
- local Z = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "Blocks (front): ")
- local Blocks = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "Lines (side): ")
- local Lines = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "Layers (down): ")
- local Layers = tonumber(read())
- if Computer.Connection.ConnectedTurtle.Id == Computer.System.Modem.SharedID then
- Functions.printCentered(Monitor[0], math.floor(h/2), "On x (E/W) or on z (N/S) ax: ")
- local Ax = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "plus (S/E) or min (N/W): ")
- local Way = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "How many between: ")
- local Between = tonumber(read())
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "One Moment Please...")
- if Ax == string.lower("x") and Way == string.lower("plus") then
- for i = 1, #Turtles do
- if Turtles[i].GroupState == true then
- sleep(5)
- local Data = {What = "Command", Command = "QuArry", Data = {X = TargetX, Y = TargetY, Z = TargetZ, Blocks = Blocks, Lines = Lines, Layers = Layers}}
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- if Between ~= 0 and Between ~= nil then
- X = X + Lines + Between
- else
- X = X + Lines
- end
- end
- end
- elseif Ax == string.lower("x") and Way == string.lower("min") then
- for i = 1, #Turtles do
- if Turtles[i].GroupState == true then
- sleep(5)
- local Data = {What = "Command", Command = "QuArry", Data = {X = TargetX, Y = TargetY, Z = TargetZ, Blocks = Blocks, Lines = Lines, Layers = Layers}}
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- if Between ~= 0 and Between ~= nil then
- X = X - Lines - Between
- else
- X = X - Lines
- end
- end
- end
- elseif Ax == string.lower("z") and Way == string.lower("plus") then
- for i = 1, #Turtles do
- if Turtles[i].GroupState == true then
- sleep(5)
- local Data = {What = "Command", Command = "QuArry", Data = {X = TargetX, Y = TargetY, Z = TargetZ, Blocks = Blocks, Lines = Lines, Layers = Layers}}
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- if Between ~= 0 and Between ~= nil then
- Z = Z + (Blocks + 1) + Between
- else
- Z = Z + (Blocks + 1)
- end
- end
- end
- elseif Ax == string.lower("z") and Way == string.lower("min") then
- for i = 1, #Turtles do
- if Turtles[i].GroupState == true then
- sleep(5)
- local Data = {What = "Command", Command = "QuArry", Data = {X = TargetX, Y = TargetY, Z = TargetZ, Blocks = Blocks, Lines = Lines, Layers = Layers}}
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- if Between ~= 0 and Between ~= nil then
- Z = Z - (Blocks + 1) - Between
- else
- Z = Z - (Blocks + 1)
- end
- end
- end
- end
- else
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "One Moment Please...")
- local Data = {What = "Command", Command = "/QuArry/", Data = {X = X, Y = Y, Z = Z, Blocks = Blocks, Lines = Lines, Layers = Layers}}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- elseif nTurtleProgramsOption == 2 then
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "Quarry X: ")
- local X = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "Quarry Y: ")
- local Y = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "Quarry Z: ")
- local Z = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "1 = North, 2 = East, 3 = South, 4 = West: ")
- local R = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "Blocks (front): ")
- local Blocks = tonumber(read())
- if Computer.Connection.ConnectedTurtle.Id == Computer.System.Modem.SharedID then
- Functions.printCentered(Monitor[0], math.floor(h/2), "On x (E/W) or on Y (Up/Down) or on z (N/S) ax: ")
- local Ax = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "plus (S/E) or min (N/W): ")
- local Way = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "How many between: ")
- local Between = tonumber(read())
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "One Moment Please...")
- if Ax == string.lower("x") and Way == string.lower("plus") then
- for i = 1, #Turtles do
- if Turtles[i].GroupState == true then
- sleep(5)
- local Data = {What = "Command", Command = "TuNnel", Data = {X = TargetX, Y = TargetY, Z = TargetZ, R = R, Blocks = Blocks}}
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- if Between ~= 0 and Between ~= nil then
- X = X + 3 + Between
- else
- X = X + 3
- end
- end
- end
- elseif Ax == string.lower("x") and Way == string.lower("min") then
- for i = 1, #Turtles do
- if Turtles[i].GroupState == true then
- sleep(5)
- local Data = {What = "Command", Command = "TuNnel", Data = {X = TargetX, Y = TargetY, Z = TargetZ, R = R, Blocks = Blocks}}
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- if Between ~= 0 and Between ~= nil then
- X = X - 3 - Between
- else
- X = X - 3
- end
- end
- end
- elseif Ax == string.lower("z") and Way == string.lower("plus") then
- for i = 1, #Turtles do
- if Turtles[i].GroupState == true then
- sleep(5)
- local Data = {What = "Command", Command = "TuNnel", Data = {X = TargetX, Y = TargetY, Z = TargetZ, R = R, Blocks = Blocks}}
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- if Between ~= 0 and Between ~= nil then
- Z = Z + 3 + Between
- else
- Z = Z + 3
- end
- end
- end
- elseif Ax == string.lower("z") and Way == string.lower("min") then
- for i = 1, #Turtles do
- if Turtles[i].GroupState == true then
- sleep(5)
- local Data = {What = "Command", Command = "TuNnel", Data = {X = TargetX, Y = TargetY, Z = TargetZ, R = R, Blocks = Blocks}}
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- if Between ~= 0 and Between ~= nil then
- Z = Z - 3 - Between
- else
- Z = Z - 3
- end
- end
- end
- elseif Ax == string.lower("y") and Way == string.lower("plus") then
- for i = 1, #Turtles do
- if Turtles[i].GroupState == true then
- sleep(5)
- local Data = {What = "Command", Command = "TuNnel", Data = {X = TargetX, Y = TargetY, Z = TargetZ, R = R, Blocks = Blocks}}
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- if Between ~= 0 and Between ~= nil then
- Y = Y + 3 + Between
- else
- Y = Y + 3
- end
- end
- end
- elseif Ax == string.lower("y") and Way == string.lower("min") then
- for i = 1, #Turtles do
- if Turtles[i].GroupState == true then
- sleep(5)
- local Data = {What = "Command", Command = "TuNnel", Data = {X = TargetX, Y = TargetY, Z = TargetZ, R = R, Blocks = Blocks}}
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- if Between ~= 0 and Between ~= nil then
- Y = Y - 3 - Between
- else
- Y = Y - 3
- end
- end
- end
- end
- else
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "One Moment Please...")
- local Data = {What = "Command", Command = "/TuNnel/", Data = {X = X, Y = Y, Z = Z, R = R, Blocks = Blocks}}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- elseif nTurtleProgramsOption == 3 then
- if Computer.Connection.ConnectedTurtle.Id ~= Computer.System.Modem.SharedID then
- local Data = {What = "Command", Command = "/3DPrint/"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- shell.run("/Progs/3DPaintPro.lua")
- end
- elseif nTurtleProgramsOption == 4 then
- local Data = {What = "Command", Command = "/FaRm/"}
- local timerUpdate = System.startTimer(Temp.FarmTimer)
- local AState = true
- local i = 1
- while Turtles[i].GroupState == false or Turtles[i].Status == false do
- i = i + 1
- if i > #Turtles then
- i = 1
- end
- end
- while AState do
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "Press any key to end.")
- local event, param1, param2, param3, param4, param5 = System.pullEvent()
- if (event == "timer") then
- if (param1 == timerUpdate) then
- checkForTurtles()
- i = i + 1
- if i > #Turtles then
- i = 1
- end
- while Turtles[i].GroupState == false or Turtles[i].Status == false do
- i = i + 1
- if i > #Turtles then
- i = 1
- end
- end
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- timerUpdate = System.startTimer(Temp.FarmTimer)
- end
- end
- if (event == "key") then
- System.cancelTimer(timerUpdate)
- AState = false
- end
- end
- elseif nTurtleProgramsOption == 5 then
- local Data = {What = "Command", Command = "/L04DTR33F4RM/"}
- WModem.Send(Computer.System.Modem.ServerID, Computer.System.Modem.OwnID, Pack(Data))
- local Event, p1, p2, p3, p4, p5 = System.pullEvent("modem_message")
- TreeFarms = UnPack(p4)
- Monitor[0].clear()
- local n
- for i = 1, #TreeFarms do
- Functions.printCentered(Monitor[0], i, i.." = Farm"..i.." X: "..TreeFarms[i].X.." Y: "..TreeFarms[i].Y.." Z: "..TreeFarms[i].Z)
- n = i
- end
- Functions.printCentered(Monitor[0], n + 1, "Number: ")
- local Number = tonumber(read())
- Data = {What = "Command", Command = "/TreeFarm/", Data = TreeFarms[Number]}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- else
- if nTurtleProgramsOption == 1 then
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "Quarry X: ")
- local X = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "Quarry Y: ")
- local Y = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "Quarry Z: ")
- local Z = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "Blocks (front): ")
- local Blocks = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "Lines (side): ")
- local Lines = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "Layers (down): ")
- local Layers = tonumber(read())
- if Computer.Connection.ConnectedTurtle.Id == Computer.System.Modem.SharedID then
- Functions.printCentered(Monitor[0], math.floor(h/2), "On x (E/W) or on z (N/S) ax: ")
- local Ax = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "plus (S/E) or min (N/W): ")
- local Way = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "How many between: ")
- local Between = tonumber(read())
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "One Moment Please...")
- if Ax == string.lower("x") and Way == string.lower("plus") then
- for i = 1, #Turtles do
- if Turtles[i].GroupState == true then
- sleep(5)
- local Data = {What = "Command", Command = "QuArry", Data = {X = TargetX, Y = TargetY, Z = TargetZ, Blocks = Blocks, Lines = Lines, Layers = Layers}}
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- if Between ~= 0 and Between ~= nil then
- X = X + Lines + Between
- else
- X = X + Lines
- end
- end
- end
- elseif Ax == string.lower("x") and Way == string.lower("min") then
- for i = 1, #Turtles do
- if Turtles[i].GroupState == true then
- sleep(5)
- local Data = {What = "Command", Command = "QuArry", Data = {X = TargetX, Y = TargetY, Z = TargetZ, Blocks = Blocks, Lines = Lines, Layers = Layers}}
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- if Between ~= 0 and Between ~= nil then
- X = X - Lines - Between
- else
- X = X - Lines
- end
- end
- end
- elseif Ax == string.lower("z") and Way == string.lower("plus") then
- for i = 1, #Turtles do
- if Turtles[i].GroupState == true then
- sleep(5)
- local Data = {What = "Command", Command = "QuArry", Data = {X = TargetX, Y = TargetY, Z = TargetZ, Blocks = Blocks, Lines = Lines, Layers = Layers}}
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- if Between ~= 0 and Between ~= nil then
- Z = Z + (Blocks + 1) + Between
- else
- Z = Z + (Blocks + 1)
- end
- end
- end
- elseif Ax == string.lower("z") and Way == string.lower("min") then
- for i = 1, #Turtles do
- if Turtles[i].GroupState == true then
- sleep(5)
- local Data = {What = "Command", Command = "QuArry", Data = {X = TargetX, Y = TargetY, Z = TargetZ, Blocks = Blocks, Lines = Lines, Layers = Layers}}
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- if Between ~= 0 and Between ~= nil then
- Z = Z - (Blocks + 1) - Between
- else
- Z = Z - (Blocks + 1)
- end
- end
- end
- end
- else
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "One Moment Please...")
- local Data = {What = "Command", Command = "/QuArry/", Data = {X = X, Y = Y, Z = Z, Blocks = Blocks, Lines = Lines, Layers = Layers}}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- elseif nTurtleProgramsOption == 2 then
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "Quarry X: ")
- local X = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "Quarry Y: ")
- local Y = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "Quarry Z: ")
- local Z = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "1 = North, 2 = East, 3 = South, 4 = West: ")
- local R = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "Blocks (front): ")
- local Blocks = tonumber(read())
- if Computer.Connection.ConnectedTurtle.Id == Computer.System.Modem.SharedID then
- Functions.printCentered(Monitor[0], math.floor(h/2), "On x (E/W) or on Y (Up/Down) or on z (N/S) ax: ")
- local Ax = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "plus (S/E) or min (N/W): ")
- local Way = tonumber(read())
- Functions.printCentered(Monitor[0], math.floor(h/2), "How many between: ")
- local Between = tonumber(read())
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "One Moment Please...")
- if Ax == string.lower("x") and Way == string.lower("plus") then
- for i = 1, #Turtles do
- if Turtles[i].GroupState == true then
- sleep(5)
- local Data = {What = "Command", Command = "TuNnel", Data = {X = TargetX, Y = TargetY, Z = TargetZ, R = R, Blocks = Blocks}}
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- if Between ~= 0 and Between ~= nil then
- X = X + 3 + Between
- else
- X = X + 3
- end
- end
- end
- elseif Ax == string.lower("x") and Way == string.lower("min") then
- for i = 1, #Turtles do
- if Turtles[i].GroupState == true then
- sleep(5)
- local Data = {What = "Command", Command = "TuNnel", Data = {X = TargetX, Y = TargetY, Z = TargetZ, R = R, Blocks = Blocks}}
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- if Between ~= 0 and Between ~= nil then
- X = X - 3 - Between
- else
- X = X - 3
- end
- end
- end
- elseif Ax == string.lower("z") and Way == string.lower("plus") then
- for i = 1, #Turtles do
- if Turtles[i].GroupState == true then
- sleep(5)
- local Data = {What = "Command", Command = "TuNnel", Data = {X = TargetX, Y = TargetY, Z = TargetZ, R = R, Blocks = Blocks}}
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- if Between ~= 0 and Between ~= nil then
- Z = Z + 3 + Between
- else
- Z = Z + 3
- end
- end
- end
- elseif Ax == string.lower("z") and Way == string.lower("min") then
- for i = 1, #Turtles do
- if Turtles[i].GroupState == true then
- sleep(5)
- local Data = {What = "Command", Command = "TuNnel", Data = {X = TargetX, Y = TargetY, Z = TargetZ, R = R, Blocks = Blocks}}
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- if Between ~= 0 and Between ~= nil then
- Z = Z - 3 - Between
- else
- Z = Z - 3
- end
- end
- end
- elseif Ax == string.lower("y") and Way == string.lower("plus") then
- for i = 1, #Turtles do
- if Turtles[i].GroupState == true then
- sleep(5)
- local Data = {What = "Command", Command = "TuNnel", Data = {X = TargetX, Y = TargetY, Z = TargetZ, R = R, Blocks = Blocks}}
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- if Between ~= 0 and Between ~= nil then
- Y = Y + 3 + Between
- else
- Y = Y + 3
- end
- end
- end
- elseif Ax == string.lower("y") and Way == string.lower("min") then
- for i = 1, #Turtles do
- if Turtles[i].GroupState == true then
- sleep(5)
- local Data = {What = "Command", Command = "TuNnel", Data = {X = TargetX, Y = TargetY, Z = TargetZ, R = R, Blocks = Blocks}}
- WModem.Send(Turtles[i].Id, Computer.System.Modem.OwnID, Pack(Data))
- if Between ~= 0 and Between ~= nil then
- Y = Y - 3 - Between
- else
- Y = Y - 3
- end
- end
- end
- end
- else
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "One Moment Please...")
- local Data = {What = "Command", Command = "/TuNnel/", Data = {X = X, Y = Y, Z = Z, R = R, Blocks = Blocks}}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- end
- elseif nTurtleProgramsOption == 3 then
- local Data = {What = "Command", Command = "/3DPrint/"}
- WModem.Send(Computer.Connection.ConnectedTurtle.Id, Computer.System.Modem.OwnID, Pack(Data))
- shell.run("/Progs/3DPaintPro.lua")
- end
- end
- elseif p1 == keys.b then
- Back = true
- end
- end
- end
- end
- end
- else
- if nOption == 1 then
- -- System
- nSystemOption = 1
- local Back = false
- Monitor[0].clear()
- Monitor[0].setCursorPos(1, 1)
- while not(Back) do
- drawSystemMenu()
- drawSystemFrontend()
- local Event, p1, p2, p3, p4, p5 = System.pullEvent()
- if Event == "key" then
- if p1 == keys.up or p1 == keys.numPad8 then
- if nSystemOption > 1 then
- nSystemOption = nSystemOption - 1
- end
- elseif p1 == keys.down or p1 == keys.numPad2 then
- if nSystemOption < MaxSystemOptions then
- nSystemOption = nSystemOption + 1
- end
- elseif p1 == keys.enter or p1 == keys.numPadEnter then
- if nSystemOption == 1 then
- -- Connection turtle
- MaxTurtlesOptions = #Turtles
- nTurtlesOption = 1
- local TurtlesBack = false
- Monitor[0].clear()
- Monitor[0].setCursorPos(1, 1)
- while not(TurtlesBack) do
- drawTurtlesFrontend()
- local Event, p1, p2, p3 = System.pullEvent()
- if Event == "key" then
- if p1 == keys.up or p1 == keys.numPad8 then
- if nTurtlesOption > 1 then
- nTurtlesOption = nTurtlesOption - 1
- end
- elseif p1 == keys.down or p1 == keys.numPad2 then
- if nTurtlesOption < MaxTurtlesOptions then
- nTurtlesOption = nTurtlesOption + 1
- end
- elseif p1 == keys.enter or p1 == keys.numPadEnter then
- -- Turtles
- for i = 1, #Turtles do
- SendInfo(Turtles[i].Id, "Function", "StripMineDone")
- sleep(1)
- SendInfo(Turtles[i].Id, "Function", "NR")
- end
- Computer.Connection.ConnectedID = Turtles[nTurtlesOption].Id
- Computer.Connection.ConnectedTurtle = Turtles[nTurtlesOption]
- if Monitor then
- ConfigInventoryBottons()
- ConfigMonitor()
- end
- if pocket then
- ButtonForward = Button.setButton("W", Move, 4, 6, 7, 9, true, "forward")
- ButtonBack = Button.setButton("S", Move, 4, 6, 10, 12, true, "back")
- ButtonLeft = Button.setButton("A", Move, 1, 3, 10, 12, true, "left")
- ButtonRight = Button.setButton("D", Move, 7, 9, 10, 12, true, "right")
- ButtonUp = Button.setButton("R", Move, 2, 4, 14, 16, true, "up")
- ButtonDown = Button.setButton("F", Move, 6, 8, 14, 16, true, "down")
- else
- ButtonForward = Button.setButton("W", Move, 11, 13, 11, 13, true, "forward")
- ButtonBack = Button.setButton("S", Move, 11, 13, 14, 16, true, "back")
- ButtonLeft = Button.setButton("A", Move, 8, 10, 14, 16, true, "left")
- ButtonRight = Button.setButton("D", Move, 14, 16, 14, 16, true, "right")
- ButtonUp = Button.setButton("R", Move, 18, 20, 11, 13, true, "up")
- ButtonDown = Button.setButton("F", Move, 18, 20, 14, 16, true, "down")
- end
- Computer.Connection.Connected = true
- TurtlesBack = true
- Back = true
- elseif p1 == keys.b then
- TurtlesBack = true
- end
- end
- end
- elseif nSystemOption == 2 then
- -- Reboot
- SaveSettings()
- System.reboot()
- elseif nSystemOption == 3 then
- -- Reset
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "Rest Computer? ... Y/N")
- local Event, p1, p2, p3 = System.pullEvent("key")
- if p1 == keys.y then
- local File = fs.exists("/Progs/.Data/.Settings.set", "r")
- if File then
- Functions.DelFile("/Progs/.Data/.Settings.set")
- end
- System.reboot()
- end
- elseif nSystemOption == 4 then
- Monitor[0].clear()
- Functions.printCentered(Monitor[0], math.floor(h/2), "Run Uninstaller? ... Y/N")
- local Event, p1, p2, p3 = System.pullEvent("key")
- if p1 == keys.y then
- shell.run("/OS/Unintall.lua")
- end
- end
- elseif p1 == keys.b then
- Back = true
- end
- end
- end
- end
- end
- end
- function MonitorTouched(MX, MY)
- checkForTurtles()
- for i = 1, #Turtles do
- if Turtles[i].Id == Computer.Connection.ConnectedTurtle.Id then
- Computer.Connection.ConnectedTurtle = Turtles[i]
- end
- end
- if nMonitorOption == 3 and Computer.Connection.ConnectedTurtle.Status then
- MStripMineButton.buttonPressed(MX, MY)
- end
- if nMonitorOption == 2 and Computer.Connection.ConnectedTurtle.Status then
- MINVButton.buttonPressed(MX, MY)
- end
- MMenuButton.buttonPressed(MX, MY)
- if MButtonn and Computer.Connection.ConnectedTurtle.Status then
- MMoveButton.buttonPressed(MX, MY)
- end
- sleep(1)
- checkForTurtles()
- for i = 1, #Turtles do
- if Turtles[i].Id == Computer.Connection.ConnectedTurtle.Id then
- Computer.Connection.ConnectedTurtle = Turtles[i]
- end
- end
- end
- Monitor[0].clear()
- Monitor[0].setCursorPos(1, 1)
- Startup()
- while Computer.System.Status do
- Timer[1] = System.startTimer(5)
- checkForTurtles()
- if Monitor then
- drawMonitor()
- end
- drawMenu()
- drawFrontend()
- local Event, p1, p2, p3, p4, p5 = System.pullEvent()
- if Event == "key" then
- System.cancelTimer(Timer[1])
- if p1 == keys.up or p1 == keys.numPad8 then
- if Computer.Connection.Connected then
- if nOption > 1 then
- nOption = nOption - 1
- end
- end
- elseif p1 == keys.down or p1 == keys.numPad2 then
- if Computer.Connection.Connected then
- if nOption < MaxOptions then
- nOption = nOption + 1
- end
- end
- elseif p1 == keys.enter or p1 == keys.numPadEnter then
- if Monitor then
- Monitor[1].clear()
- Monitor[1].setCursorPos(1, 1)
- end
- onEnter()
- elseif p1 == keys.slash then
- if Monitor then
- Monitor[1].clear()
- Monitor[1].setCursorPos(1, 1)
- end
- Computer.System.Status = false
- elseif p1 == keys.q then
- if Monitor[1] then
- Monitor[1].clear()
- Monitor[1].setCursorPos(1, 1)
- end
- SaveSettings()
- Computer.System.Status = false
- end
- elseif Event == "monitor_touch"then
- System.cancelTimer(Timer[1])
- if Computer.Connection.Connected then
- local Button, MX, MY = p1, p2, p3
- MonitorTouched(MX, MY)
- end
- elseif Event == "monitor_resize"then
- System.cancelTimer(Timer[1])
- TestMonitor()
- if Computer.Connection.Connected then
- ConfigInventoryBottons()
- ConfigMonitor()
- nMonitorOption = 0
- MButtonn = false
- ButtonInfo = false
- ButtonInventory = false
- ButtonQuarry2 = false
- end
- elseif Event == "timer" then
- System.cancelTimer(Timer[1])
- checkForTurtles()
- for i = 1, #Turtles do
- if Turtles[i].Id == Computer.Connection.ConnectedTurtle.Id then
- Computer.Connection.ConnectedTurtle = Turtles[i]
- end
- end
- else
- System.cancelTimer(Timer[1])
- end
- end
- Functions.SetColors(Monitor[0], Color.Black, Color.White)
- Monitor[0].clear()
- Monitor[0].setCursorPos(1, 1)
Add Comment
Please, Sign In to add comment