Page 1 of 1

SDL and Python files

PostPosted: Thu Jun 09, 2011 8:16 am
by Finn
Exactly what would I put in the SDL and Python files necessary for the "stateanimation" Quickscript, and where would I put said files? The target is URU CC.

Re: SDL and Python files

PostPosted: Thu Jun 09, 2011 9:43 am
by Finn
I've also tried writing the Alcscript myself, using the AnimatedDoor Age as a reference, but I don't think I quite understand it yet. Cany anyone spot what's wrong with this Alcscript? I get the cursor when I hover the button, but nothing happens when I click it.

Code: Select all
OpeningWindow:
   animations:
     - name: WinOpenAnim
      autostart: 0
      loop: 0
   logic:
      actions:
        - type: responder
         name: DoorOpen
            responder:
            states:
                  - cmds:
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D: OpeningWindow
                        animname: WinOpenAnim
                        cmds:
                    - setforewards
                          - continue
                       waiton: -1
               nextstate: 1
               waittocmd:
                  - key: 0
              - cmds:
                 - type: animcmdmsg
                  params:
                     recievers:
                       - 006D: OpeningWindow
                  animname: WinOpenAnim
                  cmds:
                    - setbackwards
                    - continue
                  waiton: -1
               nextstate: 0
               waittocmd:
                 - key: 0

OpenButton:
   logic:
        modifiers:
          - cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: WinClickRegion
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: responder
                ref: :OpenWindow

Re: SDL and Python files

PostPosted: Fri Jun 10, 2011 3:17 am
by tachzusamm
I did not look into your AlcScript closer, but first, you should get the indentation fixed.
Correct indentation is VERY IMPORTANT in AlcScript, as it is in Python.

AlcScript assumes indentation of 4 spaces per level; using tabs is okay, because a tab is converted to 4 spaces on parsing, but make sure you've set TAB size in Blender to 4 as well. Never use 2, 3, 6, or anything else. Always four.

So, please rework your indentation on the script first.
Should look like this:
Code: Select all
OpeningWindow:         # Indent-Level 0: 0 space
    animations:             # Level 1: 4 spaces
      - name: WinOpenAnim   # Level 2: 4+2 = 6 spaces (this is an exception to normally 4+4 spaces, because list entries starting with "- " can have 2 spaces less indentation)
        autostart: 0         # Level 2: 4+4 = 8 spaces
        loop: 0                # Level 2: 4+4 spaces
    logic:                  # Level 1: 4 spaces
        actions:              # Level 2: 8 spaces
          - type: responder      # Level 3: 4+4+2 spaces ("- " exception here)
            name: DoorOpen    # Level 3: 4+4+4 spaces
            responder:
            states:
              - cmds:            # Level 4
                  - type: animcmdmsg        # Level 5
... (omitted the rest) ...


The AnimatedDoor script is mostly good in indentation as a reference, althought sometimes bends the rules a bit.

Re: SDL and Python files

PostPosted: Fri Jun 10, 2011 5:30 am
by Finn
Thanks. I'll probably use an external editor and/or make a reindentation regex.
Are there any warnings given on malfored Alcscript? Since I've got quite a few objects in my age, the Python console is truncated after export. Perhaps there's a way to pipe it to file?

Re: SDL and Python files

PostPosted: Fri Jun 10, 2011 6:11 am
by tachzusamm
As far as I know, there's no warnings given; or at least they are not given back to the PyPRP part. (not really sure)
Actually, AlcScript is not a programming language. So, parsing the AlcScript just creates data structures, filled with values, depending on the indentation.
Now if you shuffle the indentation, the result may be still a valid data structure, but not what you intended.

Example:
Code: Select all
house:
    table:
        box:
          - cup: red
            state: full
          - cup: blue
            state: empty
    chair:
      - person: me

will create a data structure with contents like this:
"In the house there's a table with a box, containing a full red cup, plus an empty blue cup"  (and me sitting on a chair in the house)

but this:
house:
    table:
        box:
          - cup: red
            state: full
      - cup: blue
        state: empty
    chair:
      - person: me

would create:
"In the house there's a table with a box, containing ONLY a full red cup,
plus an empty blue cup DIRECTLY on the table, not in the box"  (and me sitting on a chair)

(I hope you get the idea, and the parser can't really guess what you meant if the indentation is bad)


Editing note: I forgot key names must all be lowercase. Corrected in the example.
http://www.guildofwriters.com/wiki/AlcS ... nformation
(The name of your object "OpeningWindow" ist still okay though; object names can be written with capitals)

Re: SDL and Python files

PostPosted: Fri Jun 10, 2011 10:41 am
by Chacal
XML FTW

Re: SDL and Python files

PostPosted: Sat Jun 11, 2011 1:48 am
by Finn
Turns out it was indented correctly in Blender, but it was a mix of tabs and spaces when I copied it, so this forum mangled it.
As for the log, it is ofcourse found among the exported files, e.g. as "myage.age.log". Not sure how I managed to miss it.