Page 1 of 4

animation quickscript test

PostPosted: Sat Aug 02, 2008 9:51 am
by D'Lanor
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.

Re: animation quickscript test

PostPosted: Sat Aug 02, 2008 1:32 pm
by Trylon
Sounds very nice!

Thanks, D'Lanor

Re: animation quickscript test

PostPosted: Sat Aug 02, 2008 3:22 pm
by andylegate
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!

Re: animation quickscript test

PostPosted: Sun Aug 03, 2008 2:01 am
by di gama
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.

Re: animation quickscript test

PostPosted: Sun Aug 03, 2008 4:01 am
by D'Lanor
I see what you mean. I can make the default for the clickable animation non-reversible.

Re: animation quickscript test

PostPosted: Sun Aug 03, 2008 5:55 pm
by D'Lanor
There is a new version of the quickscript available for testing in the first post (see edit).

Re: animation quickscript test

PostPosted: Mon Aug 04, 2008 2:49 pm
by andylegate
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?

Re: animation quickscript test

PostPosted: Mon Aug 04, 2008 3:14 pm
by D'Lanor
Did you set them to not looping?

Code: Select all
<object>:
    animations:
        - name: <animation name>
          autostart: 0
          loop: 0

Re: animation quickscript test

PostPosted: Mon Aug 04, 2008 3:32 pm
by andylegate
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....

Re: animation quickscript test

PostPosted: Mon Aug 04, 2008 3:43 pm
by andylegate
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.......