Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal

Search the Community

Showing results for tags 'robot'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • OpenComputers
    • Announcements
    • Feedback
    • IRC
  • Code Central
    • Support
    • Showcase
    • Tutorials
  • Addons & More
    • Addons Mods
    • Architectures
    • OpenEngineering Task Force
  • General
    • Lounge
    • Forum Games
    • Showcase
    • Servers
  • Archives
    • Public Archives

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Fediverse ID



Found 50 results

  1. I present you a program for a robot that allows you to mine ore without going down into the caves. Robot, using a geolyzer, can find and mine ore. All features are not yet implemented, so I ask you to test and inform me about a bugs. Requirements: Computer case (tier II or III) Inventory Upgrade (more the better) Inventory Controller Upgrade Hard Disk Drive EEPROM with Lua BIOS Geolyzer RAM (tier I or higher) CPU (any) Hover Upgrade (tier I) Diamond pickaxe or equivalent tool Optional: Crafting Upgrade Wireless Network Card or Linked Card Solar Generator Upgrade Battery Upgrade Experience Upgrade Chunkloader Upgrade Generator Upgrade Enderchest from EnderStorage mod Installing: Download and save the file as init.lua wget https://raw.githubusercontent.com/DOOBW/geominer/master/miner.lua init.lua Put this file in to root directory of the hard disc. Add the disk when crafting a robot. Place the robot on a solid blocks platform. Give the robot a pickaxe Place a container and the charger near the robot. Press the power button and enjoy a process.
  2. Yeah other tree farm robot for farming wood. The idea is that the robot plant saplings and cut down the trees in an area, it works with solar energy and mine the leaves for avoid run out of saplings. Be free of give your opinions or tell the bugs in the topic. I create good looking GitHub readme, so you can see behind this text or in the GitHub repository . Tree farm Program for create an autonomous robot that plant and cut down trees in area, powered by solar energy. This is a OpenComputers program, so you need the mod in your Minecraft game. Downloading First of all you need a computer setup, in case you are a new player in this mod you can follow the official documentation or use this video. We need a computer with the OS intalled. Then you can download and install the program in the Hard Disk Drive of that computer, for do that you need to use. We can use two ways: Using a Internet Card: You need a Internet Card in your created computer, for that reason the Computer case must be at least Tier 2. When you init the computer just paste this instruction (Insert key): wget https://raw.githubusercontent.com/Javier-Garzo/OpenComputers-TreeFarm/master/treeFarm.lua /autorun.lua Copy paste (No Internet Card): En case you don't have computer with a internet card you can use this command: edit /autorun.lua And just paste (insert key) the code that you have inside this repository file treeFarm.lua. Configuration When you have the code in the autorun.lua you can edit the tree variables of the top: sizeX (Default = 7): The size of tree farm in the direction that face the robot. The value must be x*3 +1 (4,7,10,13...). sizeZ (Default = 7): The size of tree farm in the direction right hand of the robot.The value must be z*3 +1 (4,7,10,13...). minimumEnergyToWork (Default = 3000): The minimum energy that the robot need for start working, just used for avoid that the robot lose all the energy and shut down. timerMultiplier (Default = 5): The robot wait some time when finish a iteration in the area to wait that the trees grow. Some multiplier if you want that the robot spend more time or less waiting. Here some images that show how the size affect to the farm (7x7, 4x7, 13x4): IMPORTANT: X is the face direction of the robot. Robot fabrication The minimum required elements are: Computer Case (Tier 2). Central Processing Unit (CPU) (Tier 1). 2x Memory (Tier 1). EEPROM (LUA BIOS). Hard Disk Drive (Tier 1) (1MB). Important: This disk drive must be the one with the installed program (the autorun.lua file), done in the Downloading section. Graphics Card (Tier 1). Screen (Tier 1). Solar Generator Upgrade. Inventory Upgrade. Also you can add more element to use the full capacity of the computer case(tier 2). Other possible extras: More Solar Generator Upgrades: If we add extra solar generators the robots don't need sleep for recharge the energy when It is low. More Solar Generators Upgrade = full time working robot. More Inventory Upgrade: More place where put the extra wood, so you need to empty the robot less often. Final Put the robot in a plain area, with no walls or similar, and add some saplings in the first section of his inventory(must be spruce or birch). If you want you can add him a axe but is not necessary. And now you only need enjoy the robot.
  3. I am working on a script to control robots using the internet card, and as part of this I need to be able to know where a waypoint is. I am using navigation.findWaypoints(), but the tabe that it returns behaves differently depending on weather or not I use the LuaOS interpreter, or just run the same function over the network. I have already tried two ways of serialization, and both work as expected in the lua interpreter. They also function as expected when call them directly with hand-typed tables over the network. The problem comes when they are passed the result of pcall(component.invoke("ADDRESS_GOES_HERE", "findWaypoints", 16)). In that case, I get only the first layer of tables as follows: R2-D2 recived command 'component.invoke("c4272274-e2ab-472b-b450-153710c88709", "findWaypoints", 16)'. 1: table: 0x7fbce02af5f0 n: 1 What is changed such that the functions no longer have the same behavior? version 1 (self-made): function ptable(tbl, recursed) if not recursed then for k, v in pairs(tbl) do if type(v)~='table' then link.write(string.format("%s:%s, ", k, v)) else link.write(string.format("%s:{", k)) ptable(v, true) link.write("}, ") end end else for k, v in pairs(tbl) do if type(v)~='table' then link.write(string.format("%s:%s, ", k, v)) else link.write(string.format("%s:{", k)) ptable(v, true) link.write("}, ") end end end end versions 2&3 (found on the lua wiki): function table_print (tt, indent, done) done = done or {} indent = indent or 0 if type(tt) == "table" then for key, value in pairs (tt) do io.write(string.rep (" ", indent)) -- indent it if type (value) == "table" and not done [value] then done [value] = true io.write(string.format("[%s] => table\n", tostring (key))); io.write(string.rep (" ", indent+4)) -- indent it io.write("(\n"); table_print (value, indent + 7, done) io.write(string.rep (" ", indent+4)) -- indent it io.write(")\n"); else io.write(string.format("[%s] => %s\n", tostring (key), tostring(value))) end end else io.write(tt .. "\n") end end function vardump(value, depth, key) local linePrefix = "" local spaces = "" if key ~= nil then linePrefix = "["..key.."] = " end if depth == nil then depth = 0 else depth = depth + 1 for i=1, depth do spaces = spaces .. " " end end if type(value) == 'table' then mTable = getmetatable(value) if mTable == nil then print(spaces ..linePrefix.."(table) ") else print(spaces .."(metatable) ") value = mTable end for tableKey, tableValue in pairs(value) do vardump(tableValue, depth, tableKey) end elseif type(value) == 'function' or type(value) == 'thread' or type(value) == 'userdata' or value == nil then print(spaces..tostring(value)) else print(spaces..linePrefix.."("..type(value)..") "..tostring(value)) end end Thank you all in advance for helping me learn what I should fix.
  4. i have no idea how to program but i think this is a easy (not for me) thing to do and its a robot that mines 2 block high and checks for diamonds and stops if it finds any and goes back to its charger
  5. Demo in video: https://youtu.be/p_ytIJhMRqc Minimum robot specs: Computer Case (Tier 2) CPU (Tier 1) Memory (Tier 1.5) EEPROM (LUA embedded) Graphics Card (Tier 1) Hard Disk Drive (Tier 1) or Disk Drive and (after assembly) Floppy Disk which the HDD or FD has LUA and mine.lua program in it Keyboard Screen (Tier 1) Inventory Upgrade Geolyzer Mining tool: Iron pickaxe Program usage: mine <facing> <depth> When the robot can't dig down anymore, the robot will ignore the depth and go up. Tips: When the robot is running, don't peek down. When the robot go up, you will block it. And charge it full before usage. Download: wget https://raw.githubusercontent.com/ayangd/oc-automate_everything/master/subprojects/mine.lua mine.lua
  6. Easily move your robot using very short commands! rim('10(5flfl)') The code above demonstrates how your robot will do: By only one line of command! Easily import the source code: local rim = require('<this file>').interpret rim('ud') -- Go up and down E.g robot excavation: rim('32(15(16(xf)lfl)15(xf)xd2l)', robot.swingDown) Documentation is inside the source code (head). https://pastebin.com/L2JtJA61 Changelogs: - Added local scope to everything.
  7. I have a robot with a water bucket in the tool slot and I want to place water under thr robot. Under the robot there is space to place water. I tryed robot.use(sides.down) robot.useDown() robot.swing(sides.down) robot.swingDwon() robot.place() ... but nothing happends, the function returns false every time and I don't know why. What am I doing wrong? Thanks
  8. Spoon

    Auto farm crops

    Description: I would like an auto potato farm, or an auto farm for most crops. Function: I would like the robot that I have built, to farm a 5x25 rectangle area, it hovers above the crops and mines it, then places the crops again in the soil and keeps the rest in its inventory until its full, or the crops need to grow back, then it sleeps to re-charge or wait for the crops to grow. Deadline: Not too worried about the deadline, im still trying to learn OpenComputers. Additional Information: Like stated above, im very new to this mod and would love to learn more about it, such as writing a program and designing my own, I've read the tutorials but im still a little stumped, some tips would be very appreciated thank you!
  9. Hey guys! New here! I am on minecraft 1.10.2 and I made a robot that can harvest Agricraft crops for me. All is working well. I go above the crops and call useDown() function. Now I am trying to harvest cinnamon from cinnamon logs and pepper from pepper tree fruits from Pam's Harvestcraft and the useDown/useUp functions do nothing. Any ideas as to how I can make the robot do those for me? Cheers!
  10. Heavy Cat

    Remote Robot

    Can someone make a remote robot system? Here is how i want it to work: you need: a tablet. a robot. and you simply run the lua commands (robot.up, robot.down, etc) from the tablet. Can someone make this for me?
  11. sgtforge2000

    Attack Robot

    Hello, I have such little skill programming it is embarrassing. Anyways, I am looking for a hunting robot... one that can seek players and kill them with sword or flans weaponry, if that is even compatible. If you don't mind helping me could you please make a program. I would like if you could add inputs as to what to target.
  12. Hi, want to show of my current project. the mod allows to attach Capabilities to almost any Entity (Mob/Minecart) and manipulation through a OpenComputers components Wiki: https://github.com/ben-mkiv/OpenEntity/wiki Curse Project Site: https://minecraft.curseforge.com/projects/openentity Latest Downloads: https://minecraft.curseforge.com/projects/openentity/files make world backups if you use alpha/beta builds of my mod! xD OpenComputer 1.7+ for Minecraft 1.12 is required to enable the OpenComputers features feel free to contribute any feedback, specially how to balance costs of features out
  13. I'm trying to get access to a chest below the robot. Here is the test code. local component = require("component") local sides = require("sides") print(component.inventory_controller.getInventorySize(sides.bottom)) Here are the components I have eeprom robot gpu filesystem geolyzer inventory_controller computer filesystem chunkloader filesystem internet screen keyboard Every time I run the program with a chest below the robot I get "nil no inventory" I have a plain oak chest under the robot. Any help? Am I missing something? I'm on the version for 1.12.2, possible bug? I suspect I am just missing something.
  14. I have been playing with the robots and have really been enjoying it. I wrote a little program make a robot follow a wall around and around until it detects an entity then it takes a swing at the detected entity. It is pretty amusing to watch the little guy swing it's sword at a group of creepers and zombies. lol Anyway, the program is far from complete. However, before I continue down this path I would be interested in any ideas for a different approach. Right now the robot has to do a detect in every direction. Since it can only detect in front, above and below I am having it check every direction before it moves forward. This involves turning 4 times and detecting with each turn until it is back to the way it was facing. It works but it is slow. Is there any other way the robot can detect an entity around it without having to turn a full circle? As amusing as it is, it is pretty slow having to spin a circle with every step.
  15. A basic tree farm for a robot. By default it will start a 6x6 tree farm but you can configure the amount of trees in the grid as well as how far each tree will be from each other. Firstly, the robot must have an inventory upgrade so it can have an inventory so it can place and obtain blocks. The script makes the robot go up to eight blocks above the ground to take down the tree, so you may also need a hover upgrade which increases the amount of blocks the robot can go above from the ground. To get the script to plant the trees properly you must have put saplings in the first inventory slot of the robot. You should also have an axe as the tool to claim the wood faster obviously, make sure you put the axe where the wrench icon is in the inventory. Also, make sure you have a flat surface of dirt so the robot can move properly without being blocked and actually place the saplings. To get the script on your computer, if you have an internet component installed execute "pastebin get cg1ieKUi autorun.lua" and the required autorun script will be downloaded, or if you are the server host get the script at http://www.pastebin.com/raw/cg1ieKUi and add the script to the root of the filesystem that hosts the operating system. local robot = require("robot") print("Robot tree farm started") -- Select the first slot, which is supposed to have a sapling. robot.select(1) -- Change these to change the tree farm grid size or the distance between each tree in the grid. local treesX = 6 local treesZ = 6 local distanceBetweenTrees = 5 -- Goes forward eventually, no matter if something is blocking the path at the moment. local function GoForward() while true do local movedSuccessfuly = robot.forward() if movedSuccessfuly then break end end end -- Goes down eventually, no matter if something is blocking the path at the moment. local function GoDown() while true do local movedSuccessfuly = robot.down() if movedSuccessfuly then break end end end -- Checks for a tree local function CheckForTree() -- Check for a block if robot.detect() then robot.up() -- Attempt to detect a block above which will determine if the tree has grown. local blockFound = robot.detect() robot.down() -- Check tree has grown and if so then go up. if blockFound then for blocksToMoveUp = 1, 8 do -- Destroy the wood in front of the robot robot.swing() -- Check if there is a block above and if so then destroy the block. if robot.detectUp() then robot.swingUp() end -- Go up robot.up() end -- Move back down again for blocksToMoveDown = 1, 8 do GoDown() end -- Suck up stuff and go forward robot.suck() robot.suckUp() robot.suckDown() GoForward() -- Suck up stuff for rotation = 1, 4 do robot.turnLeft() robot.suck() end -- Go back robot.turnAround() GoForward() robot.turnAround() -- Place the new sapling here robot.place() end else -- There is no block here, place the sapling robot.place() end end -- Scans a row of trees. local function CheckRowOfTrees() -- Check for trees in the X row. for treeX = 1, treesX do CheckForTree() -- If this isn't the last tree in the row then move to the next tree in the row. if treeX < treesX then robot.turnRight() for blocksToMove = 1, distanceBetweenTrees do GoForward() robot.suck() end robot.turnLeft() end end -- Go back to the first tree in the row. robot.turnLeft() for blocksToMove = 1, distanceBetweenTrees*(treesX - 1) do GoForward() end robot.turnRight() end -- Do the complete cycle. while true do -- Go to each X row in the grid. for treeZ = 1, treesZ do CheckRowOfTrees() -- If this isn't the last X row in the grid then go to the next X row in the grid. if treeZ < treesZ then robot.turnRight() GoForward() robot.turnLeft() for blocksToMove = 1, distanceBetweenTrees do GoForward() robot.suck() end robot.turnLeft() GoForward() robot.turnRight() end end -- Go back to the starting position. robot.turnRight() GoForward() robot.turnRight() for blocksToMove = 1, distanceBetweenTrees*(treesZ - 1) do GoForward() robot.suck() end robot.turnRight() GoForward() robot.turnRight() -- Sleep for five seconds. os.sleep(5) end
  16. Hello everyone. I'm new to OC and am playing Sky Factory 3 which incorporates many mods into minecraft, including OC. I'm having trouble with robot.use() method. I'd like to make a Robot use a Sieve like I would. A Sieve is a block from another mod, Ex Nihilo Adscensi, that allows you to sieve blocks like Sand and Gravel and get other material from it. By placing a block of Sand in the robot's tool slot and calling robot.use(), with the Sieve in front of it, the robot successfully places the Sand in the Sieve. Then, it needs to make several uses of the Sieve for the Sand block to return it's products. A player would click or hold right mouse button on the Sieve, so you'd think robot.use() would work, but I find it doesn't. The function robot.use() retutrns true "block_activated" but no progress is made in sieving process. I've tried robot.swing(), which just brakes the sieve, and robot.place(), which returns false, because it can't place in front of it. Any ideas on how to make a robot use a Sieve?
  17. So yall are some crazy people... making APIs, full OSes and compilers, etc. I'm just a ComputerCraft noob who likes controlling turtles and robots to do my dirty work. When I came over from ComputerCraft I was a bit surprised at the lack of excavation programs for robots. So, starting with the default OC dig.lua program, I overhauled it to be more robust, reliable, and flexible, and to mimic what I used to use for my Turtles. There's still a lot of cool features I'd like to add but in my experience it is infinitely more reliable now. The major changes and plans are below. Because I'm devoid of imagination I named it dig2.lua. It can be found on GitHub here. Usage and a diagram of how it functions can be found in the file. Changes from original dig.lua - Now accepts 3 arguments by default for <depth (forward/back)>, <width (left to right)>, and <height (y axis)> Previously it accepted one argument for depth/width and dug as far down as it could -S option for original "Square" behavior, with one dimension given -C option for perfect cube, with one dimension given - New -j option allows you to skip down to any layer in the intended excavation Useful for when the excavation fails for whatever reason So you can reposition the robot at the start and have it skip all the layers already excavated - Added energy monitoring Robot will calculate a reasonable energy reserve based on the size of the excavation and return to origin point when approaching that reserve - Overhauled logic, functionized and optimized code reuse and readability, and added reasonable commenting debug console output - Overhauled failure logic flow Robot will return to origin point after fully failing out of the logic layers With the debug output this allows for much easier identifications of what's going wrong with your dig Plans for the future if I get around to them - Add option to discard cobble/stone - Add failure recovery techniques (e.g. can't hover high enough so move to wall) - Add ability to specify where on the outskirts of the dig the chest and/or charger station are located - Re-implement logic to continue next layer without returning to origin corner (temporarily removed for simplicity) - Add/overhaul argument parsing logic - Add ability to refuel via generator upgrade if present - Add more compatibility checks for various components and upgrades - Improve usage message formatting or font size to better fit screen Known isssues - On deep digs robot gets stuck climbing up to return home without the tier2 hover upgrade Could easily be resolved for most cases by making him return to a wall/corner BEFORE moving up The "up-first then side" behavior also causes annoying swiss cheese effect in digs where you skip a bunch of unexcavated layers - Script was designed for using Tinker's Construct tools with nearly infinite-durability/mending There's no real logic to deal with loss of tools, but the failure code should cause robot to return home once it can no longer dig Cheers, == Roachy
  18. Robotic Actually Additions Canola Oil Improver - RAACOI This is a semi-automatic script for robots that takes oil from Actually Additions and crafts it into the next tier. Canola Oil --> Crystallized Oil or Crystallized Oil ---> Empowered Oil. In short, the robot will: Take Canola Oil, drop it down, drop a seed and put the new oil into a container. So you will still need to deal with the seeds in atomic reconstruction and empowerer. That's not that bad to manually do though since you can do them stack by stack. The robot will simply pause and try later if something goes wrong (for example out of seeds or oil). So you don't have to restart it or anything. Code: https://pastebin.com/m8gAz7my -- Robot oil improver for Canola oil (Actually Additions) -- Version 0.00000000000000000003a local robot = require("robot") local function sleep(x) os.sleep(x) end local function s() sleep(0.2) end local function drain() local r = robot.drain(1000) return r end local function fillDown() local r = robot.fillDown(1000) return r end local function dropDown() local r = robot.dropDown(1) return r end local function drainDown() local r = robot.drainDown(1000) return r end local function fill() local r = robot.fill(1000) return r end local function rearm() print("Trying to fill up with some seeds.") robot.turnRight() s() robot.suck() robot.turnLeft() s() end local function verifier(func, msg, ident) while true do local r = func() if r == true then --pass s() break else print("Unable to:", msg, "Taking a nap") if ident == 3 then rearm() end sleep(5) end end end print("Greetings!") sleep(0.3) while true do verifier(drain, "drain the raw oil", 1) verifier(fillDown, "fill the space down below... Something is probably very wrong.", 2) verifier(dropDown, "drop a seed", 3) robot.turnLeft() verifier(drainDown, "drain from below. Something is janky.", 4) verifier(fill, "dump the new oil.", 5) robot.turnRight() s() end Setup - Robot This is a recommended robot build: You can get away with cheaper, the solar is optional if you prefer using chargers, and/or you want the robot to work inside a building. Just don't forget the tank and inventory upgrade as seen above. To get the program into the computer you can either use a floppy, internet card or paste it in directly with a middle mouse click. For example: Start up the robot. Type: edit oil.lua. Copy the code, paste with middle mouse. Press CTRL-S to save and CTRL-W to exit. Start with: oil.lua or simply oil. Setup - Placement I strongly recommend fluid containers like Iron/Stone drums from Extra Utils 2 or tanks from EnderIO. And piping it. You could fill an oil generator directly too if you want. In front of the robot - A tank or similar with the input oil. For example Canola Oil. To the left of the robot - An output tank or similar for the improved oil. To the right of the robot - A chest with the seeds. Below the robot - 1x1x1 hole. The robot will drop the seed here. Behind the robot - Optional charger. Usage Start up the program and the robot will get to work. I strongly recommend that you don't move these tanks, instead use pipes to transport the oil. You can pipe into the input tank directly from the fermenters for example. You can also pipe seeds into the seed chest to make it close to fully automatic. Example of Canola Oil --> Empowered Oil (dual robots) Quite handy, with two robots you can enhance the oil the whole way up to Empowered Oil. Known Issues Other notes Thanks to irc chat for getting my grips together after messing up simple code.
  19. So I tried to make my robot place upside-down stairs and I noticed it would only do it when I used robot.placeUp() or robot.placeDown() but in those cases the only way the stairs would face is south (the tall part of the stairs were facing south) Is there any way I can make a robot place stairs in a different orientation? I did try to specify a side but then it would work like the robot was placing the block on the side, it wouldn't place the stairs upside-down.
  20. this youtube, Robot on top of the shoulder.How do you do it?
  21. Hi All, I'm working on improving the default dig program and am trying to figure out how to calculate energy usage to handle returning the robot to a power station. This was easy with ComputerCraft because turtles effectively use exactly 1 "energy" for every move, and don't consume power otherwise. But OC robots seem to consume a variable (or at least arbitrary) amount of power per different actions, and of course use power even when idle. I haven't exactly been able to put my finger on a pattern. Can anyone tell me how I might estimate the amount of energy a robot uses over time, depending on what it's doing? I'm hoping there's a simpler solution than tracking energy usage and developing a heuristic to guess. Thanks! == Roachy
  22. This is a better excavation program , you can adjust its parameters to excavate any cube. Syntax: bdig [-luk] <up/down> <fwd> <side> -l: makes the robot go left instead of right -u: makes the robot go up instead of down -k: not implemented yet http://pastebin.com/KTS6CCk0 Get by typing `pastebin get KTS6CCk0 bdig.lua` in a robot (you need an Internet Card attached) Examples: bdig -u 10 10 10 Excavates a 10x10x10 cube (the robot is in the lower left corner) Enjoy!
  23. The Roboserver is a program which lets you control OpenComputers robots remotely, without writing any Lua code, either from your web browser or from a desktop application. You can have your robots dig tunnels, build houses, craft items, and just about anything else a player can do, from any distance! I've got many interesting ideas for how to improve it still, such as adding support for ComputerCraft turtles, allowing robots to save and place structure blueprints, and controlling them from AR glasses added by other mods. If you're as excited about this as I am, help me get there by becoming a patron here! The code for this project will always be open source, and can be found here.
  24. Hello, I am using a script that is not mine, as I have no idea how to write one yet, and it does everything that it is suppose to do except for cutting the full grown trees down. I am trying to figure out why but am very unsuccessfully doing so. here is the code i am using, any help would be appreciated. local W, H = 7, 11 local INTERVAL = 30 local DROPTOOL = false local com = require("component") local robot = require("robot") local term = require("term") local comp = require("computer") local magnet = com.tractor_beam local inv = com.inventory_controller local robocom = com.robot local INV = robot.inventorySize() local wrappers = { rpt = function(f, to) to = to or .25 return function(...) while not f(...) == true do os.sleep(to) end os.sleep(0) end end, detect = function(f, to) to = to or .25 return function(...) while true do local s, rsn = f(...) if s then return true end if rsn == "entity" then robot.swing() elseif rsn == "air" then return true elseif rsn == "nothing selected" then return false else os.sleep(to) end end end end } local r = { fwd = wrappers.detect(robot.forward), back = wrappers.rpt(robot.back), left = wrappers.rpt(robot.turnLeft), right = wrappers.rpt(robot.turnRight), around = wrappers.rpt(robot.turnAround), up = wrappers.rpt(robot.up), down = wrappers.rpt(robot.down), suck = function() robot.select(INV) while magnet.suck() do os.sleep(0.05) end if robot.count() ~= 64 then for i = 1, INV, 1 do if robot.count(i) > 0 then if robocom.compareTo(i) then robot.select(i) robocom.transferTo(INV) robot.select(INV) end end end end end, swing = wrappers.detect(function() if robot.durability() > .1 then return robot.swing() end return true end), place = wrappers.detect(robot.place) } local function row() r.right() for i = 1, H, 1 do r.fwd() r.left() robot.select(INV - 1) if robocom.compare(3) and robot.durability() and robot.durability() > .1 then robot.select(INV) r.swing() end if not robot.detect() and robot.count(INV) > 1 then robot.select(INV) r.place() end robot.select(INV - 1) r.around() if robocom.compare(3) and robot.durability() and robot.durability() > .1 then robot.select(INV) r.swing() end r.suck() if not robot.detect() and robot.count(INV) > 1 then robot.select(INV) r.place() end robot.select(INV - 1) r.left() if i ~= H then r.fwd() end end for i = 1, H, 1 do r.back() if i % 2 == 0 then -- collect the saplings when going back -- useful when fastleafdecay is installed r.suck() end if i ~= H then r.back() end end end local function dropAll() for i = 1, INV - 2, 1 do if robot.count(i) > 0 then robot.select(i) robot.drop() end end end local function field() if DROPTOOL then robot.select(1) robot.suckDown() inv.equip() end robot.select(INV - 1) for i = 1, W, 1 do r.fwd() row() if i ~= W then r.left() for fw = 1, 3, 1 do r.fwd() end end end r.right() for i = 1, W - 1, 1 do for fw = 1, 4 do r.fwd() end end r.fwd() dropAll() r.around() if DROPTOOL then robot.select(1) inv.equip() robot.dropDown() end end while true do local x, y = term.getCursor() term.clearLine() term.setCursor(x, y) io.write("Running") field() if type(INTERVAL) == "number" then for i = 0, INTERVAL, 1 do term.setCursor(x, y) term.clearLine() io.write("Sleep: " .. i .. " out of " .. INTERVAL) os.sleep(1) end else local time = 0 repeat term.setCursor(x, y) term.clearLine() io.write("Sleep: " .. time .. " (" .. comp.energy() .. "/" .. comp.maxEnergy() .. ")") os.sleep(1) time = time + 1 until comp.energy() / comp.maxEnergy() > .98 end os.sleep(0) term.setCursor(x, y) end
  25. Today i was writing a program for my Mystical Agriculture Farm. The program is supposed to steer the Robot in random directions and check the Robot's energy after each cycle. After a certain threshold (now 10%) is reached, it sends the robot to a charger. The energy check and recharging works like a charm, but as soon as i add the while-loop and the random movements, i get a "too long without yielding" error (the full error is pasted at the end of the github file). github: The Code
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.