• Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
Welcome to OpenComputers

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more!

This message will be removed once you have signed in.

  • Announcements

    • Lizzy Trickster

      Latest Stable OpenComputers Version   11/26/16

      The latest released version of OpenComputers is version 1.6.1 for MC 1.7.10, 1.8.9, 1.9.4 & 1.10.2. See more information here! Beta/Dev builds can be found at the Jenkins Build Server (ci.cil.li)

Forums

  1. OpenComputers

    1. Announcements

      OpenComputers official announcements.

      115
      posts
    2. Feedback

      Tell us what you think.

      306
      posts
    3. IRC

      #OC channel discussion
      irc.esper.net #oc

      26
      posts
  2. Code Central

    1. Support

      Ask for support from the OpenComputers community

      2327
      posts
    2. Showcase

      Showcase what you have created for OC. No 'malware' or other junk!

      1271
      posts
    3. Tutorials

      Help other users out. Please no 'false tutorials'

      95
      posts
  3. Addons & More

    1. Addons Mods

      Show off your OC addons mods

      173
      posts
    2. Architectures

      Discussions for Architectures

      162
      posts
    3. OpenEngineering Task Force

      Discussion board for the OETF documents

      49
      posts
  4. General

    1. Lounge

      Just lounge around or have an open discussion.

      286
      posts
    2. Forum Games

      Fight boredom!

      60
      posts
    3. Showcase

      Show off your creations! (not for your programs)

      115
      posts
    4. Servers

      A place to advertise your servers

      128
      posts
  • Topics

  • Posts

    • ^this guy. He dunnit...
    • 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. 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
    • do i install open os on it via a seperate computer?  
    • Here is a Lua script for a basic 6x6 tree farm. Try inspecting the script to figure out how it works and modifying the script to your liking. 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
    • Make sure you installed OpenOS via the floppy disk.
  • Popular Contributors