A Noob's Guide to Animations

Help bring our custom Ages to life! Share tips and tricks, as well as code samples with other developers.

A Noob's Guide to Animations

Postby di gama » Mon Jul 21, 2008 9:52 pm

Unfortunately, I'm a noob when it comes to animations, and I could use a simple example of an AlcScript-only method (I'm told this is possible) to animate an object based on a clickable trigger. Here's the scenario: I want object Button to be clickable within ClickRegion, causing objects Door1 and Door2 to move along their respective animations (IPO curves), Door1Anim and Door2Anim. What AlcScript would work with this? This is my current script, which does not work:

Code: Select all
Button:
    logic:
        modifiers:
          - cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: ClickRegion
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: responder
                ref: :DoorOpen
        actions:
          - type: responder
            name: DoorOpen
            responder:
               states:
                - cmds:
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:Door1
                        animname: Door1
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:Door2
                        animname: Door2
                        cmds:
                         - continue
                     waiton: -1
                  nextstate: 1
                  waittocmd: 0
               curstate: 0
               flags:
                  - detecttrigger
Door1:
    animations:
        - name: Door1
          autostart: 0
          loop: 0
Door2:
    animations:
        - name: Door2
          autostart: 0
          loop: 0


Is this correct? What should it look like?
di gama
 
Posts: 41
Joined: Fri Feb 29, 2008 5:11 pm

Re: A Noob's Guide to Animations

Postby Nadnerb » Wed Jul 23, 2008 7:51 pm

I don't see a problem with your script... do you have objects for all of the pieces? is the region in the right place? No scale or rotation on it?
Image
Live KI: 34914 MOULa KI: 23247 Gehn KI: 11588 Available Ages: TunnelDemo3, BoxAge, Odema
Nadnerb
 
Posts: 1057
Joined: Fri Sep 28, 2007 8:01 pm
Location: US (Eastern Time)

Re: A Noob's Guide to Animations

Postby di gama » Wed Jul 23, 2008 9:05 pm

Here is a simple blender file with the AlcScript above. As you can see, the button (the cube at the end of the strip) appears to be clickable, but nothing happens. The two cubes to the side are Door1 and Door2, and are supposed to move apart when the button is clicked.
Test.blend
(155.32 KiB) Downloaded 238 times
di gama
 
Posts: 41
Joined: Fri Feb 29, 2008 5:11 pm

Re: A Noob's Guide to Animations

Postby di gama » Fri Jul 25, 2008 3:23 am

Apparently, you need PyPRP v1.5.0 to do animations. As a side note, though, all the exports I do with the new version stack-dump if there are any animations. Does anyone know why, or a simple tutorial otherwise? (Again, the wiki's tutorial is, by its own admission not really a tutorial at all, but more a reference with those used to 1.4.0 AlcScript.) A general AlcScript tutorial would be helpful as well.
di gama
 
Posts: 41
Joined: Fri Feb 29, 2008 5:11 pm

Re: A Noob's Guide to Animations

Postby Lontahv » Fri Jul 25, 2008 3:38 am

The stack dumping is most likely the cause of not paying proper attention to this ;) :

"In order for an object to have it's location or rotation animated, it MUST be an Actor. (ie, it must have a CoordinateInterface) Be sure to press the Actor button in the object's logic panel. If an animation tries to run on a non-actor, it will crash the game. "

...in the anim tutorial.

I hope it works now. :)
Currently getting some ink on my hands over at the Guild Of Ink-Makers (PyPRP2).
User avatar
Lontahv
Councilor of Artistic Direction
 
Posts: 1331
Joined: Wed Oct 03, 2007 2:09 pm

Re: A Noob's Guide to Animations

Postby Zirrus » Sun Jul 27, 2008 3:50 am

I just took your AlcScript and made an animated door myself.
One thing i noticed: You told that the Animation name is "Door1Anim" but it is just called "Door1" in the Script.

Now a question: I wanted to add an avatar animation and a sound-emitter to that button...where does the code for that go?
I didn't find a part in that script that is similar to the one of my button...

Code: Select all
Button:
    physical:
        pinned: true
    quickscript:
        simpleclick:
            region: ClickRegion
            soundemitter: Button_Sound
            animation: ButtonTouch
            animtarget: ButtonAnimStart
            autorun: true


An one more question: The door opens now very nicely. But when i press the button once again, it just jumps to the beginning of the animation and plays it once again. How can i make that the door closes on a second press(and then opens again and so on...)

Would i have to control that via playing parts of the animation and then stop it and let it continue, when it closes or can i make several(two) animations that are played alternately?

I just don't get AlcScript.
Never argue with an idiot. He will pull you down to his level and beat you with experience.

The German Age Builder Forum: http://www.huru.info/Forum/portal.php
User avatar
Zirrus
 
Posts: 26
Joined: Sun Dec 09, 2007 12:41 pm

Re: A Noob's Guide to Animations

Postby boblishman » Sun Jul 27, 2008 3:59 am

when it comes to Age creation ... "DOH" seems to be my middle name...
User avatar
boblishman
 
Posts: 882
Joined: Fri Oct 05, 2007 4:47 pm
Location: Spain

Re: A Noob's Guide to Animations

Postby Zirrus » Sun Jul 27, 2008 4:27 am

That's SOME AlcScript. :shock: Thanks!

And it solves all other Problems too! Yay!

Now i gotta learn how to use SDL-States...
Never argue with an idiot. He will pull you down to his level and beat you with experience.

The German Age Builder Forum: http://www.huru.info/Forum/portal.php
User avatar
Zirrus
 
Posts: 26
Joined: Sun Dec 09, 2007 12:41 pm

Re: A Noob's Guide to Animations

Postby D'Lanor » Sun Jul 27, 2008 5:01 am

Object animation has not been added to the simpleclick quickscript yet. If it does make it there it will most likely be "simple" and do only a single animation. That means it will not work for opening and closing doors.
The alcscript possibilities are growing day by day. Anything that ends up in a quickscipt can only be a simplified and stripped down version. In the end anybody who wants to use alcscript to its full potential must learn it the slow way.

That being said, a separate simpledoor quickscript based on this wiki example would be useful.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: A Noob's Guide to Animations

Postby Zirrus » Sun Jul 27, 2008 5:39 am

Okay, I have a SDL-File that has the name of my age. It looks like this:

Code: Select all
STATEDESC mySDL
{
    VERSION 1
#Saving the state of Door1
    VAR BOOL    DoorSDL[1]      DEFAULT=0
}


Is that ok like this?

And then I copied the AlcScript from the Tut into Blender and tried to replace the names of the Objects and so on. And got confused. I don't know if really every "DoorButtonOneshot" has to be replaced, where the animation is specified that should be played and so on. Could someone modify the code to be more general? With <Name of Button> insted of "SWDoorButton" and so on? Those names really confuse me...I would do it immediately if I'd understand where what has to be changed.

I just noticed that some names which are listed above the code are just wrong...i'll try to find out which.
Never argue with an idiot. He will pull you down to his level and beat you with experience.

The German Age Builder Forum: http://www.huru.info/Forum/portal.php
User avatar
Zirrus
 
Posts: 26
Joined: Sun Dec 09, 2007 12:41 pm

Next

Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests