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

Act

Started by McLeopold, 19 April 2013 - 10:42 AM
McLeopold #1
Posted 19 April 2013 - 12:42 PM
Write scripts in seconds, instead of minutes! Turtle mini-language for making scripts smaller and doing quick ad-hoc movements and builds.

The act mini-language is easy and mnemonic. An act string is a sequence of commands all smashed to together, similar to a regular expression. For example, to move the turtle forward 2, turn right and go forward 3 you would use this string: "f2rf3".

Features Include:

* easy to memorize language
* history and saving of useful commands
* anti-gravel/sand/mob movement (totally swiped from the excavation script)
* auto-resupply function for building without doing slot management
* loops and simple logic
* nested parenthesis
* join commands

Coming soon:

* control multiple turtles from a single script (WHAT!)
* all from the command line (WHAT!)
(it's mostly done, just got to get the serial/parallel issue worked out)

http://cc-get.djrang...cripts/view/433

Note: I did post this to turtlescripts.com, but I'm going to go with the cc-get website instead.

http://turtlescripts...ject/gjdh20-Act
Spongy141 #2
Posted 19 April 2013 - 04:33 PM
Shouldn't this be in APIs and Utility's not programs?
Also 300th POST!
Bubba #3
Posted 19 April 2013 - 04:59 PM
Nice job! I always extend the built-in go command myself, but this looks much more versatile.
McLeopold #4
Posted 19 April 2013 - 05:45 PM
Shouldn't this be in APIs and Utility's not programs?
Also 300th POST!

It is a program that you run directly on a turtle and the turtle does stuff, no programming needed. It's just a bonus that you can include act scripts inside of other scripts as well.
Spongy141 #5
Posted 19 April 2013 - 06:12 PM
Ah, I thought (from briefly reading) that it was a easier API for turtles, but that's nice still.
amtra5 #6
Posted 21 April 2013 - 11:12 PM
I see a something that will be a pain to debug…
McLeopold #7
Posted 23 April 2013 - 04:07 AM
I see a something that will be a pain to debug…

It's quite the opposite, in fact. You'll understand after using it. The act script can be run directly on the turtle using the "do" command (as a replacement to the built-in "go"). This means you can easily try out simple or complex movements to ensure they will be correct. These short snippets of movement can then be put into a larger lua script for more complex programs.

This maintains a nice separation between program logic and turtle commands. A lua script does not get bogged down with a plethora of "turtle.doThis()" lines and is therefore easy easier to read, parse and understand. The language is not turning complete, (thus called a "mini-language") and I don't intend for it to be either. Complex logic and decision making belong in a lua script, a series of turtle movements and actions belong in an act script.

More complex act scripts can be put into lua bracket strings "[[ ]]" separated by white space for readability. I'll be adding inline comments soon.
Fenthis #8
Posted 06 June 2013 - 07:24 PM
I wrote a pre-processor for this a while ago that allows for comments, white space, arguments and macros. Put it up on cc-get as dofile: http://cc-get.djrang...cripts/view/437 Directions are there.

Also on pastebin: JX4aq92Q

Last I checked the cc-get version of act was broken BTW. The functions build(), buildUp(), etc. call placeDir(), but placeDir had been renamed buildDir(). I had to revert to a previous version.