Beginner's Guide to AlcScript

Revision as of 06:26, 14 January 2008 by Trylon (Talk | contribs)

Alcscript?

AlcScript is a way to set more complex properties on objects, than you can with simple blender logic proprties.

In the basics, alcscript is just a text file that is read and parsed by the plugin. It is locates inside blender - blender has its built-in text editor.

Adding your first alcscript file

To add a default AlcScript file to your blender file, use "Scripts->Add->PyPRP->Add Default AlcScript" in a script window.

Make one window into a text window. Now on the text-windows-menu bar click the leftmost button wiht the double arrows on it, and select the file named "AlcScript".

Now you can start adding code to it.

AlcScript structure

Alcscript has a hierarchical formatting structure that allows us to group settings together, and nest group of settings in other groups of settings. Check the example below:

Ladder1_Top:
    type: region
    region:
        type: ladder
        ladder:
            direction: down
            style: twofeet
            loops: 7

Ladder1_Bot:
    type: region
    region:
        type: ladder
        ladder:
            direction: up
            style: twofeet
            loops: 7

Now you may notice a couple of things from this example:

  • There is a structure of keys and values much like this: <key>: <value>
  • A value can also be a group of other keys and values
  • You indicate a group of keys and values by indenting it - tis can be don with tab-key in your blender file.
  • There can be groups in groups in groups
  • The first key is always the name of the object, and object-specific settings are located below that.

In the example above, the two objects (ladder regions) - have two keys, "type" and "region". Now "type" is a simple setting - it corresponds to the "type" logic property (which was the "alctype" property) and just has a simpel string as input. (You can either use the logic property "type", or the alcscript property "type" at your leasure). The key "region" however, contains another set of keys and values inside of it. Those are at another intentation level to indicate that those values belong under the "region" key

That is why in the alcscript reference, we refer to these settings as "region.type" or "region.ladder.style". the dot in the middle indicates a level of nesting.

You can see that there is a key "ladder" under the "region" key that also has another set of values. This can go on indefinitely, and is used to specify groups within groups, to make location of settings very specific.

Note to advanced users: The AlcScript is converted to nested python "dict"'s and "list"'s internally.


Lists

In alcscript you can also have lists of objects.