This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
AmandaC's profile picture

[ac-get repo] Amanda's Code and stuff

Started by AmandaC, 31 December 2013 - 08:02 PM
AmandaC #1
Posted 31 December 2013 - 09:02 PM
Hey, I've been fairly quiet on what I've been working on lately, so I thought I'd share what I've got, other than ac-get.

To start off with all my code is kept under my personal ac-get repository. You can add it to your ac-get install with this command:

ac-get run-manifest http://amanda.darkdna.net/mc/cc/ac-get/install.manifest
This is what all it contains:

NOTE lib-agui and it's dependencies have been moved to Project Veek and will be maintained seperately of this repo from now on.



Programs

  • agvam – Commandline shell replacement.
  • agui-shell – A graphical, windowed shell.
Turtle Programs

  • turtle-roomer – Digs out a room.
  • turtle-plaster – Places walls in a spiral pattern
Libraries

  • lib-butter – Utility functions for turtles.
Misc Other

  • ibhui – http.get/post enhansement allowing for custom protocols.
  • lib-acutils – Misc. Utility functions.


Individual Docs

agui-shellagui-shell is a graphical shell replacement for ComputerCraft. It is written ontop of the lib-agui toolkit, and supports the term.newWindow protocol I have previously defined. It's pretty beta right now, so use at your own risk. It's only been tested on advanced computers, but in thory it should run on normal computers as well.

agvamagvam is a (commandline) shell replacement. It provides tab-completion, as well as a rich API to implement additional completions. By default you get completion for

  • ac-get
  • built-in monitor command
  • cp/ls/cd/mv/etc
It's API is fairly simple to understand, for examples just look under __LIB__/agvam/

lib-acutilslib-acutils is a collection of useful functions I have made / hacked together from stock scripts.

Functions

There are two functions in the library, listed below.
* strtabulate – Tabulates a table into a string, instead of printing it right out.
* paged
print – Prints out a string incrementally, allowing you to scroll down multiple lines, or quit the printing altogether.

lib-butterlib-butter is a set of utility functions for turtles. It contains a few helpful things such as fuel-assertion, and item assertion.
It also allows you to define and act on slots as objects. The functions themselves are listed below:

  • butter.up / down / forward / back() – Checks that you have fuel, then moves in the given direction.
  • butter.ensure_fuel(func) – Calls func only if you have fuel, if you don't it prompts the user to insert more, and then calls your func again.
  • butter.ensure_stock(func, item) – Checks that you have items in the the turtle ( or the specific item stack if item is passed) then calls func() if you do. If you don't, it will halt the program and wait for user interaction to continue.
  • butter.move(str) – Takes a string containing commands and executes. commands are detailed below, and may be followed by a number to indicate how many times to repeat it.
  • butter.newitem(name, slotstart, slot_end) – Returns a new item object for making code a bit prettier.
Move Function

The move function takes one of the following commands:

  • l – Turn Left
  • r – Turn Right
  • u – Go Up
  • d – Go Down
  • f – Go Forward
  • b – Go Backward
As mentioned above, you can append a number to repeat it the given number of times. If no number is provided, it will execute it once.

Item Objects

Item objects are what's returned by
butter.new_item
– They implement the following functions:

  • item:place / place_up / place_down() – Selects the slot with the item in it and places it in the specified direction.
  • item:drop / drop_up / drop_down() – Selects a slot with the item in it and drops it.
  • item:select() – Selects a slot with a non-zero number of this item in it.
  • item:slots() – Iterates through the slots for this item, for custom item slot logic.

lib-kvutilslib-kvutils is a utility class library for kidven-based programs. lib-kvutils currently contains:

  • kvu-set – Handles an array-alike with a single object type per-instance.
Documentationkvu-cyclic-list

kvu-cyclic-list is a list that can only contain up to X items, where X is passed to the constructor.

  • Methods
    • :clear() – Clears the list.
    • :add(item) – Adds item to the list.
    • :iter() – Iterates the items.


kvu-set

kvu-set is a set data structure.

  • Methods
    • :add(elem) – Adds elem to the set, if it's not already there.
    • :remove(elem) – Removes an element from the set.
    • :iter() – Returns an iterator for the elements in this set.
    • :contains(elem) – Returns true if elem is in the set

Edited on 23 March 2014 - 07:59 PM
lieudusty #2
Posted 31 December 2013 - 10:05 PM
Is there a way to create your own repo?

EDIT: Whoops wrong place. Should of posted on the thread about the actual ac-get.
Edited on 31 December 2013 - 09:51 PM
AmandaC #3
Posted 10 January 2014 - 02:08 PM
I've updated the primary post with the following changes:

  • Added docs for a lot of the packages
  • Added lib-butter
  • Re-worded the preface.

And to answer a question I've been asked:

No, I don't intend to open source this repository, not as I've done with ac-get at least. There is one package I might do that for (lib-agui) but over-all this is meant to be mostly for my own tinkering and toying with code. That said, I don't mind if you tweak the code yourself for your own uses, I just ask that you give credit where credit's due. :)/>
AmandaC #4
Posted 31 January 2014 - 01:17 PM
New Updates!

I've pushed an update with the following changes:

  • added agui-shell.
  • Lots of lib-agui fixing and other stuff.
  • Bumped versions for a lot of things, with lots of new features. (The features should be all documented both in-game and in the first post.)
I'm also working on making agui-shell and lib-agui work better with ComputerCraft 1.6 – however I plan to sit on those changes until CC 1.6 exits it's beta period.

Please report any bugs you find, and have fun!

Quick Question, as well:

I am considering pulling lib-agui and lib-kidven and such all out of this repo, and making them separate and open-source – is there much interest in using this, other than by me? Please leave your comments in this thread if you have interest in using lib-agui and contributing to it's development.
robhol #5
Posted 08 February 2014 - 09:50 AM
Example repo link on your ac-get website's dead.
Edited on 08 February 2014 - 08:51 AM
AmandaC #6
Posted 23 March 2014 - 08:51 PM
Good news everyone!

I've decided to split out the lib-agui stuff into a seperate, github-hosted repo, to make it easier for others to contribute to this and for others to have a say in it's workings. This has been done already and is named Project Veek. As a result, the install method for this repo might be changing shortly, I'll update the original post with the changes after I settle down some more.

EDIT: The post has been updated.

Have fun!
Edited on 23 March 2014 - 07:59 PM