Difference between revisions of "Beginner's Guide to AlcScript"
m |
|||
Line 35: | Line 35: | ||
Now you may notice a couple of things from this example: | Now you may notice a couple of things from this example: | ||
* There is a structure of keys and values much like this: <key>: <value> | * 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 | + | * A value can also be a group of other keys and values - we call this a "'''dictionary'''" |
− | * You indicate a | + | * You indicate a nested dictionary level by indenting it - tis can be don with tab-key in your blender file. |
− | * There can be | + | * There can be nested dictionaries in dictionaries |
* The first key is '''always''' the name of the object, and object-specific settings are located below that. | * 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". | 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 | + | Now "type" is a simple setting - it corresponds to the "type" logic property (which was the "alctype" property) and just has a simple string as input. (You can either use the logic property "type", or the AlcScript property "type" at your leisure). |
The key "region" however, contains another set of keys and values inside of it. | The key "region" however, contains another set of keys and values inside of it. | ||
− | Those are at another | + | Those are at another indentation level to indicate that those values belong to the dictionary under the "region" key |
− | That is why in the | + | 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. | 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 | + | 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 dictionaries within dictionaries, to make location of settings very specific. |
− | |||
− | |||
− | + | === Lists === | |
− | == Lists == | + | |
In alcscript you can also have lists of objects. | In alcscript you can also have lists of objects. |
Revision as of 06:35, 14 January 2008
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 - we call this a "dictionary"
- You indicate a nested dictionary level by indenting it - tis can be don with tab-key in your blender file.
- There can be nested dictionaries in dictionaries
- 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 simple string as input. (You can either use the logic property "type", or the AlcScript property "type" at your leisure). The key "region" however, contains another set of keys and values inside of it. Those are at another indentation level to indicate that those values belong to the dictionary 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 dictionaries within dictionaries, to make location of settings very specific.
Lists
In alcscript you can also have lists of objects.