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

MaximilianVINCENT

Members
  • Content Count

    35
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by MaximilianVINCENT

  1. OpenComputers 1.51 for Minecraft 1.7.10

    Black Hole Tutorial 04- So You Want to Write a Program

    So you have an understanding of Computers, Robots and OpenOS and how everything fits together. Time to get them finally doing something. This tutorial is here to help you learn to design and write a simple program for a robot.

    The Language of Lua
    If you know little to nothing about Lua, start here: Lua 5.2 Reference Manual. Read what Lua is capable of. Have lua running on a computer and try out some of the example code provided.

    OpenComputers mostly follows along with the above, read the wiki to see the differences.

    There are many tutorials on Lua available, these are some I have used: TutorialsPoint, Lua- Really for Beginners, Lua-Users Wiki.

    I am going to assume at this point that you have at least a basic knowledge of Lua. This should include:

    • Comments
    • Variables
    • Conditional Stuctures - if, then, else, ...
    • Loops - for, while, repeat, ...
    • Functions
    • Tables

    Can you name at least six commands you can give a robot? If not, you need to learn more about how to control it.

    1. Look at the APIs available on the wiki, especially the Robot API.
    2. In the Lua interpreter l="" for k,v in pairs(robot) do l=l..k.." " end print(l) l=nil, will print a list of commands available for the Robot API. change 'robot' to other api's names to see what they have.
    3. I remember a command that gives us a string of documentation, but can't find it now. This is why you take lots of notes.

     

    I thought for our first program, we should start by doing what everybody does when starting Minecraft: punch some wood.

    -Plan Our Work-

    The more specific you can be in your desired outcome, the easier it will be to translate that into software. These questions are not really necessary for such a simple program, but it is better to start thinking this way now.

    Q: What do we want done?
    Chop down a tree.

    Q: What do we have to work with?
    Lots of 1x1 trees.

    Q: What else do we need for this to work?
    A way to recharge the robot, eventually.

    Q: What machine will best/can we afford to do this job?
    We want it to move, so a Robot or Drone. We want it to grab a a treeful of wood, so a Drone could work if I knew how to program an EEPROM. I don't yet, so we will use a Robot. We will need at least one Inventory Upgrade to hold the wood we are chopping.
    We aren't asking for much, so a minimal Tier 1 Robot should be able to do this.

     

    • Tier 1 Case
    • Tier 1 CPU
    • Tier 1.5 Memory
    • Tier 1 GPU
    • Tier 1 Hard Drive with OpenOS already installed on it
    • Tier 1 Screen
    • Keyboard
    • Inventory Upgrade

    You could install a Tier 2 Upgrade Card as well. That would let you use a Generator or Solar Panel to help with our power requirements.


    -Work Our Plan-

    start a new file where you want, I suggest /usr/bin:
    mkdir /usr/bin
    edit /usr/bin/treeMuncher.lua


    Some notes on what it was intended for, who wrote it and when are nice to have. Especially six months down the road when you won't even remember writing this program and have no idea what it does.

    --[[
    Tree Muncher v0.1
    for OpenComputers v1.51
    Written by Me
    on 2015Mar03

     

    Purpose:

    To collect the trunk of a 1x1 tree and return to starting location.

    How to use:
    Put robot at the base of a 1x1 tree, facing the tree before starting program.

     

    Needed:

    minimum Tier 1 Robot
    --]]


    Save and Quit for now, we'll come back. We need to think of and test our program.

    - Break it Down -

     

    "This is the Unix philosophy: Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface."  - Doug McIlroy

    Make it run, then make it right, then make it fast”  - Kent Beck

     

    Just like ye programmers of olde, you are working with machines of limited capablility. The above ideals are what was learned from that time and are just as valuable today. The Wikipedia page on UNIX Philosophy is a quick read and a great way to think about your programs. For a much longer read, The Art of Unix Programming is available.


    Let us break down our program into 'dig into the tree, chop up tree, come back down'

    1) Dig into the Tree

    Cool thing: just like you, a robot does not need an axe to chop a tree down.
    Put your robot down facing a tree and turn it on. Enter the lua interpreter with lua and try robot.swing()
    Cool, we got a block. You may have noticed a delay after getting the block. That is there to simulate the time it normally would have taken to chop down that block. Put that log back in the tree and put an axe into the tool slot (Bottom-left corner of Robot's inventory with a wrench icon). Press the up arrow to show the last command you entered and enter to do it again.

    Was the delay less using the axe? Look at the axe, you are indeed using it. Durability of your tools is something you have to take into account in future programs. To make it worse, the only way to change tools is with the Tier 2 Inventory Controller Upgrade. And if we wanted the Robot to craft it's own axes, that requires a Crafting Upgrade. At this point, we need a Tier 2 Robot.

    2) Chop Up Tree
    We got a block, now we want a tree. Let 's use Beck's above quote and show how that idea can translate into reality.

    "Make it run"
    We can move and swing, that should be enough to make it work. Trees are usually less then 10 blocks tall, so
    robot.swing()

    robot.forward()
    robot.swingUp()

    robot.up()
    robot.swingUp()

    robot.up()
    robot.swingUp()

    robot.up()
    robot.swingUp()

    robot.up()
    robot.swingUp()

    robot.up()
    robot.swingUp()

    robot.up()
    robot.swingUp()

    robot.up()
    robot.swingUp()

    robot.up()
    robot.swingUp()

    robot.up()
    robot.swingUp()

    robot.up()
    will work. It is also very wasteful of space and hard to read. Also I noticed during testing the trees I chop are never more then 8 blocks tall.

    "then make it right"
    robot.swing()
    robot.forward()
    for i=1,7 -- seven because we already took the bottom block
    do
      robot.swingUp()
      robot.up()
    end

    is much easier to understand. I can think of one more change, though.

     

    robot.swing()
    robot.forward()
    while robot.swingUp() do robot.up() end

    Small, simple and easy to read. Good code can be a thing of beauty.
    This has the added benefit of stopping when there is nothing more to chop.

    "then make it fast"
    This program is so simple, we can't really do much to make it faster. Maybe a diamond axe?

    3) Come Back Down

    If you have been testing these programs as we go along (good for you!), you noticed the robot has done the job we want: the tree is chopped. Of course, it is now more than a few blocks up in the air.

    One last step before we are done: have our robot come back to where it started. This is not just for an easily retrieval. By returning to its original coordinates and facing, this makes it easier for us to keep track of where the robot is in your program and in the world. Once your robot is working on several projects, having a home base (usually next to a Charger) makes things simpler. Simple is good.

    Let's finish this:
    robot.swing() -- make a hole in the base of the tree
    robot.forward() -- move into the tree
    while robot.swingUp() do robot.up() end -- while we get a block swinging up, keep moving up
    while not robot.detectDown() do robot.down() end -- until we see a block belows us, keep moving down
    robot.back() -- back to start location


    Try these commands in lua and make sure they work, Testing is good. Then exit the interpreter and get back to your tree muncher program.
    edit /usr/bin/treeMuncher.lua

    after the comment header, add

    local r = require("robot")

    to have access to the Robot API. (I use a single letter for the variable name because I will have to type it a lot and is easy to remember. Saves a little space on your file system as well. Changing 'r' to 'robot' or 'rbt' or even 'GrrlPower' works as well, if a bit silly.)

    and then our program above:
    r.swing()
    r.forward()
    while r.swingUp() do r.up() end
    while not r.detectDown() do r.down() end
    r.back()


    and that's that, your first simple program. Check for mistakes in typing, Save and Quit. We'll be back later to make this program more useful.

     

    Actually, almost done. Do you have a way to recharge your robot? If your robot sits for long periods of time waiting, a Solar Panel Upgrade would make sense. Since we are collecting lots of wood, we could burn some small portion in a Generator Upgrade.

     

    Bonus: Auto-Chop

    At the shell, type cp /usr/bin/treeMuncher.lua /autorun.lua

    Now take your robot to the base of another tree and turn it on. Robot Chop!

    After booting the robot, OpenOS will automatically run autorun or autorun.lua in the root directory if available.

     

    Least Signfigant Bits

    • Your turn: Can you add to this program to plant a seedling and wait until a new tree is grown before cutting down again?
    • If you are having problems, post it on the Support Sub-Forum. Additional information, constructive critism or praise of this tutorial should be posted below

    End of Line.

  2. OpenComputers 1.51 for Minecraft 1.70

    Black Hole Tutorial 03- Roots and Shells and File Systems v1.1

    I was going to write a basic programming tutorial when I realized there is one more maze we really should go through: OpenOS itself.
     

    Make a superflat map in creative mode or use the one from last time. Turn on a computer you have installed OpenOS onto. After the booting process is done, what you are looking at is an input prompt for a program called the shell. It is the main interface to your files. (At the prompt, type in man sh for more information.) Type in ls and see what we start with.

     

    bin boot etc lib mnt tmp usr init.lua

     

    Unless you changed something, you are looking at a list of directory and file names. Do you know why all these directories are here, what they store and how they are meant to be used?

     

     

    It All Starts at /

    What you are seeing is based on the Filesystem Hierarchy Standard. It hasn't changed much since the early days of UNIX, over 40 years ago. Basically it is a definition of what kinds of files belong where.

    / - Root

    Every file and directory starts from the root directory, sometimes called the trunk (like a tree).
    When you turn on the computer, this is where you start at. This is similar to C:\ under Windows.

    Notice that the rest of these start with '/', meaning they are branching off from root. This is different to what Windows uses ('\').

    /bin - System programs that come with OpenOS.

    /boot - contains files required to boot OpenOS. Look but do not touch.

    /etc - used to store config files. Like the Registry in Windows.

    /etc/rc.d - run control directory.

    It controls what programs you want to start after booting (I think).

    /lib - Libraries

    contains the shared libraries used by OpenOS.

    /mnt - Mount

    where external file systems (floppies, Hard Drives, RAIDs, etc.) are attached (mounted) to root

    /tmp - Temporary

    Used to store files until the computer is shut down or rebooted. At that time everything in this directory is erased.

    /usr - User

    Programs, libraries, documentation, etc. for all user-related programs.

    /usr/man
    This is where the text files used by the man command are stored. Have you tried the 'man' program? Type in man cat.
    Now type cat /usr/man/cat to see the same text.
       Side Note: You can and should write a man page for your programs, if not for others than yourself.

    /usr/misc - For miscellaneous files, I suppose.

       While not necessary, but I would suggest adding these to help keep things organized:
     

    /usr/bin - non-system programs.

    (think stuff like Firefox, VLC, XTree, etc. Programs used by everyone on a computer beyond the system basics.) Windows equivalent is C:\Program Files.

    /usr/lib - non-system libraries/APIs

    /var - stands for variable files.

    All files that change frequently are traditionally kept in a subdirectory of /var.

    /var/log - log files (written records of what your programs have been doing, useful for debugging)
    /var/lib - packages and database files

    /home - user personal files (Optional, but traditional)

    /home/bin - personal programs (you are probably seeing a pattern by now)

    If you have multiple people using the same computer, give each person their own directory under /home (i.e. /home/max, /home/vincent). This way everyone has a place put their ocNotes.txt or TreeMuncher.lua. Windows equivalent is C:\users\max\.

    Please remember, what I am saying above are just suggestions. Try different things and find out what works best for you. You could dump everything in root and probably be okay.

    All these directories do not have to be on your boot drive. You can mount other filesystems and connect them to your root file structure where you please. More on that later in this tutorial.

    All these directories may not make much sense for OpenComputers since it has no permission system. Under Linux/UNIX, everyone has an account to log into. Each account is set up to allow access to only the parts of the system that user needs, hopefully keeping any damage they can do to a minimum. The 'root' account has access to everything, just like you do now. Tread lightly, my friends. If you are working on some large projects, DO make backups onto alternative media and/or other computers, just like you would in the real world.

     

    How to Get Around

    File and directory names are case-sensitive. That means you can have 4 files named AB.txt, Ab.txt, aB.txt and ab.txt (unless you are running Windows, since OpenComputers saves files onto your PC's Hard Drive and Windows is case-insensitive).

    try LS or Ls or lS and see what happens

     

    These are the commands you be be using the most often. There are lots more, but this tutorial is long enough already.

     

    ls
    man ls
    ls -M shows there should be 2 files in our root directory, but we see only one. where is the other file?
    ls -a shows all files in the specified directory.

     

    ah, a .osprop was hiding!
    Starting a file with a . tells the OS it is meant to be a hidden file. Under Linux a lot of programs use this to hide their config files in the each user's /home directory.
     

    ls /bin

    If you do not recognize any of these, it is a good time to start learning. We go over the most basic commands below. Use man (try man man to start) on the ones you don't recognize. Not all will work, but most will.

    cd
    man cd if you haven't already.
    current working directory means whatever directory you are currently in. pwd will show you where you are at. The far left of the command line shows the same.

    mkdir
    creates a directory
    mkdir /usr/bin
    ls /usr

    rm
    this will delete files, directories, and unmount filesystems.
    rm /usr/bin
    ls /usr

    Warning: Use with caution, there is no undelete!

    cat and more
    Both are used to display files onto your screen. Cat all at once, more is controlled by your input.
    cat /bin/shutdown.lua
    more /bin/redstone.lua

    try arrow down, enter and space bar

    edit
    This is how you create, edit and view your files.
    cd /usr/misc
    edit happy.txt

    if /usr/misc/happy.txt does not yet exist, it will be created for you.
    edit -r /boot/02_os.lua
    that extra -r tells edit to not let you change anything in the file you loaded (i.e. Read Only).

     

    Self Test: After running edit the first time, a config file is written. Can you guess where? (answers at bottom)

    alias
    Since most people still use Windows for some reason, you might be more used to dir than ls.
    alias dir ls
    now try dir -a
    alias by itself shows the current list of aliases

     

    Command History

    At the prompt, use the up and down arrow keys. The shell keeps a list of the last ten commands you have entered.

    Side Note: Shell Variables

    type in echo $PATH, you will see a list of directories the shell looks in for programs you ask it to run.
    When you type in ls it looks in the current directory and if not found there, it looks in the first directory in that list. If not there, then the next one and so on.

    These are the shell variables I could find. Colons are used to separate entries and ends with a period by itself.
    $PATH = /bin:/usr/bin:/home/bin:. (where to look for programs)
    $HOME = /home (more useful with multiple users on same machine)
    $MANPATH = /usr/man:.
    $PWD = your current working directory
    $PS1 = $PWD# (what is displayed at the prompt)

    The reason I bring this up is that it can be useful to change these (adding /home/max/bin to the $PATH, for instance).
    Thanks to dgelessus, I found out about the 'set' command. (No man page and it was not mentioned in the Linux Shell tutorials I looked at, that's why I missed it. Sorry folks.)

     

    Type in set to see a list of the current shell variables, looks like I missed quite a few. SHELL, EDITOR and PAGER point to the programs you want to use for that purpose. HISTSIZE is for the size of the command history. The rest I am not sure about yet.

    Example: set HISTSIZE='20' to double your Command History.

     

     

    File Systems and your Media

    Have you tried putting more than one hard drive in a computer? It is a good way to initially expand your long-term storage. Plus if you somehow destroy the OS on your boot hard drive, the data on your second drive is safe. I would suggest to put /home on different media than your boot drive. This makes it easy to upgrade your computer and keep all your important stuff in one place. /var is also recommended if you plan on lots of data collection (think of log files out of control, filling your boot drive to capacity and possible crash).

    Unlike Windows, there is no D:\, E:\, etc for each new drive added to a computer. Everything is connected to root somewhere, primarily in /mnt, secondarily where you want it.

    ls /mnt shows the first three characters of the address of file systems mounted and ready for use on this computer. Not that handy.
    components shows all items connected to this computer and their full addresses, look inside computer to compare.
    df (Disk Free) to see mounted filesystems, how much room is available and where they are connected to root. So much better.

    tmpfs (Temporary FileSystem) is a small amount of memory setup as a RAM Drive that will be erased when the computer is turned off. Even if you are running OpenOS off the floppy, it is available. You might not even need a Hard Drive if your programs are small enough and you do not let the power run out.

     

    OpenOS is the default label on the hard drive you booted from, openos is the floppy disk. Small difference but important.

     

    Time for an upgrade!
    Type shutdown at the prompt to turn off computer.
    add another hard drive, look at its address (mine starts with a7f, replace with the first three characters of your hard drive), turn computer on
    component and df again to see what has changed
    cd /mnt/a7f and ls to see it is a blank drive.
    Let's give it a label in addition to an address. label -a a7f data
    Type df again and find "data" in the list. Go look at new label on the Hard Drive in the Computer.

    With all this potential,  we have to put something on this new drive.
    make sure you are still in /mnt/a7f and create a directory mkdir doc
    cd doc
    start a new file edit ocNotes.txt
    take a few notes on what you have learned so far, save and exit.

    Self Test: Mount a floppy, Copy all of /usr onto it. Label it 'UsrBackup'. Look in /bin and figure out how to unmount the floppy. Use man pages for help.

    Now constantly going to /mnt/??? is not the best way to access other filesystems. We are going to attach this Hard Drive to root at /home.
    mount a7f /home or mount data /home

    ls /home to see if it worked
     
    This is cool, but we have a problem. If we reboot the computer, it will not remember that we mounted 'data' at /home.

    Note: Next part paraphrased from http://ocdoc.cil.li/tutorial:oc3_hard_drives

    We need to add a program that mounts the disk at /home for us when it is inserted. Every hard drive can have such an autorun script. It has to be named autorun or autorun.lua and must be in the root directory of the hard drive we want mounted, in this case 'data'. This script is automatically executed when the computer mounts our hard drive.
    So before we reboot:

    cd /home or cd /mnt/a7f
    edit autorun.lua

    Paste or type the next four lines:

    -- Mount this Hard Drive to /home
    local fs = require("filesystem")
    local proxy = ...
    fs.mount(proxy, "/home")


    Save and Quit
    Lastly, reboot

    ls should show us /home is available.


    Bonus: Not Enough Room!

     

    You want a geological database, projected to be just over 10MB in size. You could try to portion it out to 24 floppy disks, swap out hard drives, or set up a RAID (Redundant Array of Independant Drives) of Tier 3 Hard Drives wired up or next to your computer. It turns three Hard Drives into a single drive, but at a cost. Any Hard Drives added to a RAID will be wiped. If you take out any of the Hard Drives in a RAID all data on all drives are lost.  Works like a Disk Drive with a LOT more room. (If you want to learn more, look up 'RAID Level 0'.)

     

     

    Least Signifigant Bits

    • Ctrl-Alt-C to exit a running program
    • Ctrl-C to restart computer while at the command line (think warm boot)
    • One more directory: /net - where entire remote file systems are mounted. WIll be very useful later on.
    • Look in minecraft/save/(world name)/opencomputers. You will find all the file systems in there sorted by component address.
    • The edit.cfg is in /etc
    • If you are having problems, post it on the Support Sub-Forum. Additional information, constructive critism or praise of this tutorial should be posted below.

    End of Line.

     

    Edit v1.1: Added dgelessus's comments into the tutorial, Command History. Spelling Errors.

  3. This is very generic, not knowing how much you know and want to learn on your own. If not enough, ask more specific questions and I'll answer as best I can. I tried to write this to translate well into functions and basic commands.

     

    start a file: gatherBerries.oc.lua make sure it starts with

    local computer = require("computer")
    local robot = require("robot")

    to have access to needed commands.

     

    Some notes on what it was intended for, who wrote it and when, are nice to have.

    --[[

    Tinker's Construct OreBerry Gatherer v0.3

    for OpenComputers v1.47

    Written by Me on 2015Feb14

    Requires: Square room with barrels and (blah blah blah)

    Robot/Drone Requires: (more blah blah)

    so on and so forth

    ]]--

     

    Since you didn't say how you have your berries set up, I'll generalize some more and guess a little. You have a square room filled with a layer of bushes, sorted or not, with enough head room for you to walk around. Some of it is probably empty or walkways. Little or no torchlight, so mobs might be an issue. Your doorway is in a corner with a Charger, five barrels, and a water block to the left of the door, same height as the bushes. Place the robot on top of the Charger and turn it towards the door.

     

    +  --------------------

    |   CBBBBBWbb    (Crude ascii mockup of corner)

    |   bbbbbbbbbb

     

    Break down to smaller steps: Pause and Recharge - Collection - Dropping Off - Repeat

     

       Pause and Recharge

     

    while (computer.energy() < (computer.maxEnergy() *0.95))
    do
      os.sleep(1)  -- do nothing for one second
    end

     

    or just wait however many minutes while over the Charger (Make sure it is on and glowing, give it a redstone signal and some power). Got to give the bushes time to grow.

     

       Collection

     

    Move forward and turn left. This will put you at the door facing into the room. Move to the back wall and turn left.

     

    Check what's below you.

    If the block below you is liquid (our water next to the barrels), stop what you are doing here and move on to Dropping Off.

    Otherwise try a grab a berry.

    Move forward.

    When you can't move forward and the block in front of you is solid (the wall), turn left or right as needed. Move forward, turn again and start over. If an entity, wait a few seconds and try again.

     

       Dropping Off

     

    For each slot, keep trying to dropDown a nugget into successive barrels until one returns true, then dump the rest of that stack. Start over with the next stack and first barrel until empty.

     

       Repeat

     

    Do it all over again.

     

     

    Notes:

    • Using half-slabs as walkways will help with mob spawning.
    • There are mod items that help with stopping mob spawning as well.
    • For the robot to end up over the water, the walls should be an even (16x16), not odd number. Do some testing to find out why.

     

    Good luck! Be sure to put your finished code up on pastebin and give us a post about your experience.

     

  4. OpenComputers v 1.46 for Minecraft 1.7.10

    Black Hole Tutorial 02- Robot Overview v1.1

     

    Today is a look at everything inside our octohedronal pal, the Robot.

     

    Make a superflat map in creative mode or use the one from last time. Power is needed, I recommend any creative power block. Search for openc in NEI to just work with OpenComputers items.

     

    Spawn in an Assembler, Disassembler and a Charger. Put them next to your power source to give them power. You can see if it is powered if you look at each with WAILA installed or Shift-Right-Click with the Analyser (OK, not quite. Using the Analyzer on the Charger just gives me a 'Charge Speed: 0%'. Not as useful.)

    Spawn these into your inventory:

    • Tier 2 Case
    • Tier 2 CPU
    • Tier 2 Memory
    • Tier 2 Graphics Card
    • Tier 2 Screen
    • Tier 2 Drive
    • Keyboard
    • Lua BIOS EEPROM

     

    Look inside the Assembler. Only one slot open in the top-left and a line of text in the middle. 'Insert a base part'

    Hover over that slot and see what gets highlighted in NEI on the right:

    • Computer Case - These are used to build moving computers, i.e. robots
    • Microcontroller Case - Small non-moving computer with limited functionality (think arduino or rasberry pi)
    • Drone - Moving Microcontroller, limited inventory
    • Tablet Case - Portable computer with limited upgrades and world interaction.

    We will get to all of these later. For now put your Tier 2 Case into the slot as your base part.

     

    So Much Space

     

    Slow down, it is not quite as great as you might think. Let's get the basics done first. As the line says, 'Insert a CPU' and 'Insert some RAM'. Shift-Click the Lua BIOS in. OK, that's the absolute basics. You could build that and have a fully functional computer that you can't type anything directly into (no Keyboard), see any output (no Graphics Card or Screen), or change the program it is running (no Drive). If you had a custom EEPROM, it would run whatever program is stored there. But this would make for a terrible tutorial robot.

     

    Notice the line says 'Complexity: 2/24'. Now put in your Graphics Card and Drive. This completes the computer portion of your robot.

    'Complexity: 6/24'. For everything you add to the robot after your CPU and first stick of Memory, it will keep increasing in complexity. Higher Tier items are more complex.

     

    Let's move on to the left side. Hover over any of the slots and see what is highlighted in NEI. The slots on top are for Upgrade Cards. These give the robot some intrinsic abilities that cannot be changed once built. For our Tier 2 Case, we are limited to three Tier 2 Upgrades and three Tier 1 Upgrades.

     

    Shift-click the keyboard and screen into your robot. Do you see any problems? We now have a Tier 1 item using a Tier 2 slot. Move the Keyboard down to make room for other Tier 2 upgrades. Also, the Tier 2 Screen cannot go into a Tier 2 robot (same with the Tier 3 Screen). I have no idea about the reasoning behind this. Get a Tier 1 screen and put it into a Tier 1 Upgrade slot.

     

    Here is a good starter robot. But will it do what I want it to? For the job I have in mind it needs to be able to craft items internally, run a long time without recharging from a Charger, and carry stuff. That would make it a big nope.

     

    We need some Upgrades. Give yourself these items:

    and install them into your robot. Darn it, not enough room for them all. Leave out one of the Inventory Upgrades for now.

     

    Awesome Upgrade Containers

     

    Those last three slots just above the line are awesome. These are for Containers, allowing Upgrades and Cards to be swapped in and out as needed (yeah for modularity!) I really want that extra Inventory Upgrade plus some just-in-case room. The problem: Containers are twice as complex as everything else (Tier 3 Upgrade Container is 6 complexity, ouch.) Give yourself three more items:

    and put all three into our robot. (Take note: this is the only way to get a Tier 3 item/card into our Tier 2 Robot.) Awesome robot!

     

    Maybe not: 'Complexity: 27/24' Notice the arrow to the left of the line is no longer green. This robot is too complex and cannot be built. Hard choices, what to take out. The Tier 1 Upgrade Container isn't enough but the Tier 2 is, so it goes away. This gives us room for our extra Inventory Upgrade and any one Upgrade item of any Tier. There is just enough complexity for one Tier 1 Memory or Card.

     

    'Complexity: 23/24' Let's build this baby! Press the Green arrow to start the assembly of our new minion robot buddy. Since we are in creative, it is done in an instant. In a survival game, the duration of creation depends on how complex the robot is. For this one, expect four and a half minutes (as shown when hovering our mouse pointer over the progress bar in the line) and a good deal of power.

     

    'Collect output' is equal to Done! Grab our new toy and put it into your hot bar, then place it into the world.

     

    Probably the first thing you will notice is the name tag above your robot (mine is named 'Atlas'). Don't like that name? Rename it using an anvil.

    The next thing you should see is the wee little crafting table and chest on its back. Did I mention OpenComputer robots are adorable, unlike some of their blockier cousins?

     

    Right-Click on the robot and see what's inside. Ah, a familiar power button on the left side. Click on it and turn this baby on.

     

    'Unrecoverable Error'

    'no bootable medium found: file not found'

     

    (Side Note: It took me way too long to figure out this one, much hair was pulled)

     

    So what's the problem?

    Just like your new computer needed to boot from the openos floppy disk, so does your robot. I have found two ways around this:

    • Install openos onto a Drive in a computer. Hover your mouse over that drive. See an added 'openos' to the description? Transfer that drive to your robot and assemble. Turn the robot on.
    • Install a Floppy Drive into any of the Upgrade Container slots and assemble. Before you turn it on, put the openos floppy into the lowest right-hand slot (has a shadow of a floppy). Turn the robot on. Install open os from the floppy onto the Drive and reboot. The floppy is no longer needed. At the cost of 1 complexity and some materials, you also have an easy way to transfer data/programs on and off your robot.

    But the Robot is Already Built

     

    I hear you say. Next up is the Disassembler.

    Put your broken robot into the only slot available in the Disassembler. In survival mode, expect it to take a while. I would suggest putting a chest of some sort next to it, otherwise bits of robot will be tossed into the world. (There is a default 5% chance of not getting an item back. This can be adjusted in /config/opencomputers.cfg)

    If any item did not come back, grab another one and build your robot again. Only this time use the preformatted Drive or Floppy Drive.

     

    If everything worked right, you now have a working robot, just waiting for your command. Remember that extra Inventory Upgrade? Time to install it. At the right side is everything inside the computer immediately available to you. The 4x4 of slots from that first Inventory Upgrade. Below that is another row of slots. The first one is the Tool slot, what the robot uses when interacting with the world (pick, bow, bucket, etc). The next three are what you put in your Container Slots (For yours, a Tier 3 and Tier 1 Upgrade Container and maybe a Floppy Drive). Put the Inventory Upgrade into the Tier 1 Slot. Put anything in the bottom row of inventory slots. Next move the slide bar on the far right up and down. You will see there an additional 16 slots available (Maximum is 64 slots). We got plenty of room now.

     

    Bonus: Put a Graphics Card into the Disassembler. Watch the component parts end up in the adjacent chest. Same happens for any OpenComputers related item. Tear down that now useless Tier 1 Computer and put the parts into something else (It is possble, though amazingly overpowered, to have the Disassembler do this for lots of other items. Look in /config/opencomputers.cfg for disassembleAllTheThings=false. Think powered Twilight Forest Deconstruction Table.)

     

    It is Time to Take Over the World!

     

    Not quite. While amazing, robots are not invulnerable. Grab a pick axe and hit it a few times. Not only did it break, everything it held fell out (including our Inventory Upgrade).

     

    Put the robot back into the world and put a wooden sword into the Tool slot. Turn the robot on. Next type in lua and press Enter. Lua is an interactive program. You tell the robot what to do and it does so immediately. Enter while true do robot.swing() end This will make the robot forever swing his sword at anything in front of it, including you. Go to survival mode and test it out on yourself. As you can see, absolutely no damage. Quit Minecraft and look in /config/opencomputers.cfg for canAttackPlayers=false. Change that to true if you want a robot army (that can be taken out by a few hits of a pick). Of course having robot archers and bombers might work just fine.

     

    Givin' It All We Got

     

    Take a look inside the robot again. Hover the mouse over the green bar to the right of the Power button. Everything you do with a robot takes power. After some testing, the Solar Panel Upgrade isn't working well for my needs. What can we do?

    • Just let the robot do nothing for long periods while charging. I don't think so.
    • Disassemble the robot, hope nothing breaks and replace the Solar Panel Upgrade with the Generator Upgrade.
    • Leave the Solar Panel Upgrade in and put the Generator Upgrade into the Tier 3 Container, next to the Tool slot.
    • Set up a charging station for the robot to visit frequently.

    Break your robot and place it adjacent to the Charger. Nothing happens because the Charger requires a redstone signal to activate. The rate of charge is relative to the level of the signal (level 1 redstone = trickle charge, 15 = fire hose).  Put a lever on top of the charger and turn it on. Green sparkles around the robot indicates power is available. A robot may not charge fully (only up to 98-99%), no big deal.

     

    If you have a good feel for how to build a robot, my job is done! If not, try using the Tier 1 and Tier 3 Cases, and put whatever you want in them. Play around, have fun and write down what you have learned!

     

    Creatix, the Creative Robot

     

    Type creatix into NEI search bar. Just like the Creative computer, there is a creative robot available. Maxed out and self-powered, I use it for early testing to see if my idea for a program is feasable.

     

    QUESTIONS:

    Q: I have a robot running, now what do I do with it?

    A:  This is where programs come into play. If you just want to play around, run lua and try the commands available in the robot API.

     

    Q: What about the rest of these upgrade items/cards?

    A: This tutorial was just to get you a robot that runs. Usage of other cards will be in future tutorials.

    Q: Where can I get programs to run on my robot?.

    A: From easy to hard:

    • Look in these forums under Code Central- Showcase.
    • Open Programs - Collection of Github Repositorys
    • ComputerCraft Forums
      • There are a lot of lua programs available at varying quality, but they will not run on OpenComputer robots without changes.
      • I personally learned most of what I know about lua from reading other people's programs (and writing down the good ideas and methods).
    • Learn Lua and write them yourself. This is also the most rewarding version.

     

    Least Signifigant Bits

    • We did not need to use a Tier 2 Graphics Card. We can save material and complexity using a Tier 1 instead.
    • Since anything OpenComputers can be disassembled, it seems to work better to make computers/robots/etc simpler and expand/remake as needed. If a Drone can do the same job as a Tier 3 Robot, give it to the Drone.
    • If using a lava bucket in the Generator, remember to pull out the empty bucket.

    • If you are having problems, post it on the Support Sub-Forum. Constructive critism or praise of this tutorial should be posted below.

     

    End of Line.

     

    Edit: Dissasembler does not actually disassemble everything.

  5. Getting late here, I'll keep this short. Is it possible to use the OpenPrinter mod printer as a screen output, what used to be called a printer terminal? Is just a matter of redirecting the output?

     

    Edit: Okay, as of OpenPrinter-MC1.7.10-OC1.4-0.1.0.102 you can only print an entire page at a time. That makes it a no.

  6. Playing for the past week and have really been enjoying myself. Example: I got a robot to automate the making of stacks of Botania flowers. Just that has saved me hour or two of manually throwing in petals and seeds, then refilling the apothecary (I like lots of DayBlooms and Hydrogangeas).

     

    • Shift-Click items into the lowest-tier slot available, not just the first. Example: Keyboard Shift-Clicks into Tier 3 slot in Tier 3 Case when all slots are available.
    • Have a capacitor that is connected to a case send an event when power starts/stops incoming (i.e. UPS)?
    • Get rid of the roman numerals in the case. That is the only place they are used. Use regular numbers (that are easier to read) and/or a thin border around each slot of the appropiate color.
    • OK, very minor: change robot.turnAround() to robot.turnBack().
    • For the Generator Upgrade, let me use liquid fuels in my tanks (lava, oil, liquefacted coal, firewater, etc).
      • generator.insertFromTank(#, amount in buckets), 16 buckets (1 tank) maximum.
      • To remove liquid, generator.dumpToTank(#) (move if room and lose the rest) or just generator.dumpLiquid() (lose all liquid).
      • Would this be a Tier 3 Generator Upgrade built with a Tank Upgrade?

     

    Thanks for looking, hope you had a good laugh.

      

  7. OpenComputers v 1.45 for Minecraft 1.7.10

    Black Hole Tutorial 01-  Learning the Chips v1.2

     

     

    You can skip this:

    I promised if I got help getting this mod to work I would write a tutorial. The best way to learn something is to do it yourself, so consider it more of a walkthrough.

     

    Mods

    • I consider NEI (Not Enough Items) essential, both for playing modded Minecraft and learning OpenComputers.
    • Tinker's Contruct is nice for the Gold and Iron Oreberry Bushes. The Oreberries are equivalent to nuggets for crafting and they make a lot of berries.
    • I use EnderIO for conduits (pipes) to transfer power to the computers. MAYBE IC2 wire, Buildcraft pipes work as well?
    • Buildcraft, Electriacal Age, IndustrialCraft 2 Exp, Mekanism, Thermal Expansion are compatible for power needs. Since Extra Utilities outputs RF, it should work as well.

     

    STARTUP

    Make a superflat map in creative mode. We are going to look at and hopefully understand the basic components of the computers. Spawn in one of each of the Computer Cases (Tier 1-3 plus Creative) with at least 2 spaces between them all. Also a copy of the OpenComputers Manual, which is fantastic and makes this tutorial mostly redundant.

     

    Really, read the book and come back. I'll wait.

    Before we go any further, we need power of some form (unless you have no powergen mods, then you get a warning and computers with no need for power). I am using a Creative Energy Cell from Thermal Expansion behind each case, except for the Creative Case,which powers itself. If you have WAILA installed, it will show you the power held in each case when you look at it. (Power requirements can be adjusted or turned off in /config/opencomputers.cfg in your minecraft directory. If you screw up the file, delete it and a new one will be made.)

    Look inside the Tier 3 Case. Nice! Lots of room for the best stuff, but oh so expensive. In each slot in the Case you will see a Roman I,II or III (Equivalent to 1, 2 and 3) in the lower right corner. This indicates the maximum Tier Item that will fit into that slot.

    • Example: Tier 1 Hard Drive will go in any Hard Drive slot, being the lowest Tier. Tier 2 Hard Drive will not go into Tier 1 slot, but will go into a Tier 3.

    Look inside the other three cases now. I bet Tier 1 feels less then adequate. That Creative Case is a thing of fantasy, but yours to play with if you want. All have different abilities in increasing amounts (Tier 3 and Creative Cases have an internal Disk Drive in the lower right corner, more on that later.)

    Filling the slots

    Spawn these items into your inventory:

    Right-Click on the Tier 1 Case. In the NEI search bar at the bottom of the screen type in openc to show just the items and blocks from this mod.

    Hover over the top left slot in the Tier 1 Case. Leave your mouse there and look over at NEI. You should see some items highlighted, scroll down in NEI for more. These are cards that will fit into that slot. Hover over some of the other slots and look at NEI and your inventory, same thing. (Hover over the top center slot to see what CPUs can fit in there.) This subtle highlighting is a bright idea and will be useful to you learning what goes where.

    Mouse over the Tier 1 Graphics Card in your inventory. Now Shift-Click it into the Tier 1 Case. Bam, right were it belongs. Try the same with a Tier 2 CPU and nothing. Just a kindly developer trying to help you out. While we are at it, take a look at the label on the Tier 2 CPU. Notice the letters are Gold(Yellow) in color. Look at the Tier 1 CPU and see an Iron(White) Color. Can you guess what color Tier 3 labels are? (Hint: diamond)

    Put into each Case the same Tier CPU, Graphics Card, Hard Drive, and Memory. We are using the bare essentials, no other items are needed. You do not have to fill all the slots for any particular item (i.e. memory). The case is okay partially empty as well. You can always put in more memory, larger hard drive or an additional card later. Modularity is a good thing. You can delete the Creative Case now or fill it, your choice.

    (Graphics Cards are actually optional, as long as you do not mind not being able to see anything. Usually called a headless computer. Yes, there are uses for this to be talked about elsewhere.)

    Put on top of each Case a Screen (using Shift-Right-Click) of the same Tier, and put a Keyboard on the back of each Screen. (The Keyboard is what lets you type when looking at the screen. It can be on any side of the monitor. It also works if you put the keyboard in the space next to the Screen pointing at the Screen.)

    Put a Disk Drive next to each Case. (Yes, the Tier 3 doesn't need one, but bear with me.) The computer will want to find an OS which it currently does not have. Put one OpenOS Floppy Disk into each Disk Drive (Shift-Right-Click on the drive with the floppy to insert, Shift-Right-Click with an empty hand to pull it out.)

     

    Zhu Li, Do the Thing!

    Once each Case has a Graphics Card, CPU, Memory ,and Hard Drive it is time to turn a computer on (Press the green and gray power button to the left of the slots or Shift-Right-Click the Case).

       BEEP-BEEP
    

    What? Try again.

       BEEP-BEEP

    Ah, crud what went wrong? Time to spawn in the Analyser.
    This handy tool will give you a lot of information, but what we want is the last error from that case. Shift-Right-Click the Case with the Analyzer and look at the top of the list.

    no bios found; install a configured EEPROM
    

    Looks like we need a Lua BIOS. Great, now where do we get that. In Survivial, you have make an EEPROM then put that with a book in a crafting table to get your Lua BIOS EEPROM.

    Spawn or craft one and shift-click it into the Case. It should have gone into the slot left of the power button. This contains the program that gets the computer started and looking for something to run. Do the same for the other cases.

     

    (Small note: you can write your own. Why you would want to do this is a topic for later.)

    Not that Thing, the other Thing!

    Now try that power button one more time. If no beeps are heard, click on the screen. Welcome to your first computer! Now do the same to the other Cases. If there is a problem, try using the Analyzer on it.

    Look at each screen (right-click to pull up a window). You might notice a few differences between them. Each Graphics Card supports a better resolution and more colors (if the Screen can handle them). The Tier 2 and 3 monitors support a touch interface (clicking on the screen) if no keyboard is attached.

     

    Also of import is the amount of memory remaining for your programs to use, displayed at the top of the boot screen.

     

    Type install and Enter, then 1 and Enter to copy the OS onto the only Hard Drive available. Kind of like installing Linux or Windows from a DVD. (Your Tier 1 computer will run out of memory, that is intentional. Ask why somewhere else. Add another Tier 1 Memory to the Case, reboot and it will work.) After it is done rebooting, you can take out the OpenOS Floppy Disk and put it somewhere safe. You might make a mess and have to reinstall.

     

    This is a small but very functional Virtual Machine running in Minecraft. Most things you can do with your really old PC at home, you can do here (Networks, File Servers, Games, Security, Automate all the things, etc). All it takes is a lot of study, experimentation and writing down what you have learned. Also more than a little iron, gold, emerald, diamond, redstone, coal, paper, time and swearing.
     

     

    Time now for you to do the same thing in your survival world. If you find the recipes too simple they can be changed to Hard Mode in /config/opencomputers.cfg, along with a lot of other details about this mod. It is worth your time to take a quick scan of the possibilities.
     

     

    QUESTIONS:

    Q: I have a computer running, now what do I do with it?
    A:  This is where your programs come into play. Computers excel at collecting, sorting and displaying data. They are a good place to write software for your robots and drones. With additional components, a lot more is possible. They are best at doing exactly what you tell them to (especially if you didn't mean for them to do it that way).

     

    Q: What about the rest of these cards?
    A: This tutorial was just to get you a computer that runs. Usage of other cards would be in future tutorials.

    Q: This is great and all, but I just wanted a robot.
    A: Robots use the same base parts and OS as a computer, plus upgrades to enhance their natural player-like abilities. Here's a link to the Robot Overview Tutorial.
     

     

    Least Signifigant Bits, I Promise

    • Almost forgot, right-click on any Case in NEI. You should find an in-game manual. Nice! API commands, if used, can be found by clicking on the top right arrow. Try this with other items.
    • When building these, anything to help you with auto-crafting is a godsend (Super Crafting Frame, Applied Energisitics 2, Assembly Halo from Botania, etc)
    • When I learn more, I will be writing it down in these forums as a tutorial. (What have you taken note of?)
    • If you are having problems, post it on the Support Sub-Forum. Constructive critism or praise of this tutorial should be posted below.

     

    End of Line.
     

    Edit v1.1: Added proper list of powergen mods. Link to 2nd Tutorial. Minor formatting.

    Edit v1.2: Added OpenComputers Manual.

×
×
  • Create New...

Important Information

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