animation quickscript test

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

animation quickscript test

Postby D'Lanor » Sat Aug 02, 2008 9:51 am

Since the poll here is heading in favor of quickscripts I went ahead and made a quickscript for the long state animation Alcscript at the wiki.

Some stats: It required 268 lines of Python code to reduce the logic Alcscript of 149 lines to 19 lines of quickscript. Needless to say, there could be a bug hiding somewhere in those 268 lines so I would like to have this tested before I submit it.

Code: Select all
<clickable object>:
    quickscript:
        stateanimation:
            objectname: <animated object>
            region: <clickable region>
            sdlname: <sdl variable>
            avatar:
                animation: <avatar animation> #optional
                animtarget: <avatar animation target> #optional
            forewards:
                animation: <opening animation>
                animsound: <opening sound emitter> #optional
                clickanim:  <clickable opening animation> #optional
                clicksound: <clickable opening sound emitter> #optional
            backwards:
                animation: <closing animation> #will be reversed if same as forewards
                animsound: <closing sound emitter> #optional, can be same as forewards
                clickanim:  <clickable closing animation> #optional, can be same as forewards
                clickreverse: <true | false> #optional, reverses clickanim if same as forewards, default=false
                clicksound: <clickable closing sound emitter> #optional, can be same as forewards


In order for the above script to work you must install prp_QuickScripts.py from the SVN trunk: http://svn.guildofwriters.com/pyprp/tru ... Scripts.py

Edit: Yep, there was a bug. I have replaced the attached file. I have also implemented di gama's suggestion.

And you no longer have to write the logic script for the avatar animation target. The quickscript will handle that now. It will create the script below if a oneshotmod with this name does not exist yet.

Code: Select all
<avatar animation target>:
    logic:
        actions:
          - type: oneshot
            name: <avatar animation target>
            oneshot:
                animation: <avatar animation>



As a note of interest, contrary to the wiki example the scripting is placed under the clickable object. So the animated object only needs the animation scripting.

Edit: pointed the download to the SVN trunk.
Last edited by D'Lanor on Tue Sep 02, 2008 12:09 am, edited 2 times in total.
"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: animation quickscript test

Postby Trylon » Sat Aug 02, 2008 1:32 pm

Sounds very nice!

Thanks, D'Lanor
One day I ran through the cleft for the fiftieth time, and found that uru held no peace for me anymore.
User avatar
Trylon
 
Posts: 1446
Joined: Fri Sep 28, 2007 11:08 pm
Location: Gone from Uru

Re: animation quickscript test

Postby andylegate » Sat Aug 02, 2008 3:22 pm

I'll definately give this a try considering how long the ALCscript needs to be to simply make a door open and close with both clickable sounds and door sounds, this would be a god send. Thanks!
"I'm still trying to find the plKey for Crud!"
Image
Blender Age Creation Tutorials
3DS Max Age Creation Tutorials
User avatar
andylegate
 
Posts: 2348
Joined: Mon Oct 01, 2007 7:47 am

Re: animation quickscript test

Postby di gama » Sun Aug 03, 2008 2:01 am

I would recommend one small change: the animation for the clickable object should always play forward, even if it is the backward case. This wouldn't be a problem for buttons and things with symmetric animation, but for, say, a lever which you pull down quickly but takes a little while to return to the original position (like the Ahnonay maintenance switches), the forward (door open) and backward (door close) animations both have the same forward animation for the switch itself. If you like, you could make this an additional optional argument, but I think that that makes more sense as a default.
di gama
 
Posts: 41
Joined: Fri Feb 29, 2008 5:11 pm

Re: animation quickscript test

Postby D'Lanor » Sun Aug 03, 2008 4:01 am

I see what you mean. I can make the default for the clickable animation non-reversible.
"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: animation quickscript test

Postby D'Lanor » Sun Aug 03, 2008 5:55 pm

There is a new version of the quickscript available for testing in the first post (see edit).
"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: animation quickscript test

Postby andylegate » Mon Aug 04, 2008 2:49 pm

Okay, just tried this out.

First, if we can solve my bug, OUTSTANDING!! This cuts amount of time it takes me to get something done in a BIG way! I'm all for it.

However, and I'm sure it's because I did something wrong. My Age exported okay..........but all the animations are looping......hehehe........What would cause this?
"I'm still trying to find the plKey for Crud!"
Image
Blender Age Creation Tutorials
3DS Max Age Creation Tutorials
User avatar
andylegate
 
Posts: 2348
Joined: Mon Oct 01, 2007 7:47 am

Re: animation quickscript test

Postby D'Lanor » Mon Aug 04, 2008 3:14 pm

Did you set them to not looping?

Code: Select all
<object>:
    animations:
        - name: <animation name>
          autostart: 0
          loop: 0
"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: animation quickscript test

Postby andylegate » Mon Aug 04, 2008 3:32 pm

Er......no......


Psssssst!.......you might want to mention that in the first post, that you still have to set the animation for the object..........hehehehe....
"I'm still trying to find the plKey for Crud!"
Image
Blender Age Creation Tutorials
3DS Max Age Creation Tutorials
User avatar
andylegate
 
Posts: 2348
Joined: Mon Oct 01, 2007 7:47 am

Re: animation quickscript test

Postby andylegate » Mon Aug 04, 2008 3:43 pm

S W E E E E E E E E E T T T T!!!!!!

Thanks D'L!!!! This just saved me a TON of time! And the SDL states worked just fine too!!!!! :D

Now...if I could just get kickable sounds to work.......
"I'm still trying to find the plKey for Crud!"
Image
Blender Age Creation Tutorials
3DS Max Age Creation Tutorials
User avatar
andylegate
 
Posts: 2348
Joined: Mon Oct 01, 2007 7:47 am

Next

Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest