Difference between revisions of "Beginner's Guide to AlcScript"

(Lists)
Line 1: Line 1:
 
== Alcscript? ==
 
== Alcscript? ==
AlcScript is a way to set more complex properties on objects, than you can with simple blender logic proprties.
+
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.
+
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.
+
It is located inside blender - blender has its built-in text editor.
  
== Adding your first alcscript file ==
+
== 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.
 
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".
+
Make one window into a text window. Now on the text-windows-menu bar click the leftmost button with the double arrows on it, and select the file named "AlcScript".
  
 
Now you can start adding code to it.
 
Now you can start adding code to it.

Revision as of 07:44, 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 located 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 with 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 parameters - ans lists of dictionaries

Below is an example of AlcScript using lists:

LadderCamera:
    camera:
        brain:
            type: simple
            poa: 0,0,6
            flags:
              - followlocalavatar
            circleflags:
              - farthest
              - circlelocalavatar                

In this case, you can see that under camera.brain.circleflags there is a list of flag names. Here, there are two flags specified, "farthest" and "circlelocalavatar" Under camera.brain.flags you see a list of one flag ("followlocalavatar") that is also perfectly legal - it is just a list with one entry.

These lists are lists of values (strings in this case), because you have not specified a key.

When you start to enter key: value pairs

RgnFootstepSfxMetal:
    logic:
        modifiers:
          - tag: Enter
            flags:
              - multitrigger
            activators:
              - type: objectinvolume
                triggers:
            conditions:
              - type: volumesensor
                direction: enter
            actions:
             - type: responder
               ref: /
       
          - tag: Exit
            flags:
              - multitrigger
            activators:
              - type: objectinvolume
                triggers:
            conditions:
              - type: volumesensor
                direction: exit
            actions:
              - type: responder
                ref: /