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.

Re: A Noob's Guide to Animations

Postby di gama » Sun Jul 27, 2008 5:29 pm

Yep, that was it. I can't believe I didn't notice that! *bangs head on desk* I'll be okay once I recover. :P

@Zirrus: Here is a list of the names used in the sample AlcScript and what they are for (in order of appearance):

SWDoorButton - The name of the button object. This you should change to your button's name.
SWdoorbuttonclick - The name of the button's animation. This name is only used within the AlcScript (local), so you can change it to anything as long as you change every occurence in the file.
AutoClick - The name of the click condition for the button. Like SWdoorbuttonclick, you can change this to anything as long as you change every occurence.
Doorswing - The name of the region surrounding the button in which the avatar should be standing. Change this to your object.
BoolToggle - The local name of the Toggle python. You can change this.
xAgeSDLBoolToggle - Cyan's function to handle Boolean toggles. Do not change this.
<SDL Name> - The name of your SDL variable. It must be the same as the one you put in the SDL.
BoolRespond - The local name of the responder python. You can change this.
xAgeSDLBoolRespond - This is Cyan's - do not change.
DoorOpen - The logic script to open the door. The name is local.
DoorClose - The logic script to close the door. The name is local.
DoorButtonOneshot - The name of the empty where the avvie will stand for the anim. Note that it is used here both as the object's name (used in Blender) and the name of the object's only animation (which is a local name). Do not confuse them.
DoorButtonTouch - Cyan's "button pressing" avatar animation. Do not change.
Door1 - The door object. Change this to your door's name.
DoorOpen1 - The door's only animation (opening). This name is local. Note that the closing animation is the same, but played backwards.
marker: "DoorButtonTouch" - A marker embedded in Cyan's DoorButtonTouch animation which signals the end of the action (I think).
emit_swingdoorOpen - The emitter for the door opening sound. This is your Blender object.
emit_swdoorbutton - The emitter for the button pressing sound. This is your Blender object.
emit_swingdoor - The emitter for the door closing sound (don't let the name fool you). This is your Blender object.
<name of closing door sound file> - Your .ogg file in the sfx folder.
<name of opening door sound file> - Your .ogg file in the sfx folder.
<name of button sound file> - Your .ogg file in the sfx folder.

Hopefully this should help.
di gama
 
Posts: 41
Joined: Fri Feb 29, 2008 5:11 pm

Re: A Noob's Guide to Animations

Postby Zirrus » Mon Jul 28, 2008 12:22 am

Thank you very much. I will try it right now. :)

I am replacing the special names with <general> ones. Maybe i will mark every line that has a name in it with a # that you have to delete afterwards.

Do not confuse them.


Lol, i guess i did. :?
I changed it like this:

Code: Select all
<avi-anim start-empty>:
   logic:
       actions:
          - type: oneshot
            name: <local name of avi-anim>
            oneshot:
                animation: DoorButtonTouch

...
                         - oneshotmod:<local name of avi-anim>

...

                         - oneshotmod:<local name of avi-anim>


Right or wrong?


I have replaced all the names. I used a search-and-replace-function so i could be that something has been replaced because the searched words were in it. But i double-checked it every time...i hope it's fine.

Code: Select all
<name of button>:
    animations:
        - name: <name of button-animation>
          autostart: 0
          loop: 0
    logic:
        modifiers:
          - tag: <click-condition-name for button>
            cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: <click region of button>
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: pythonfile
                ref: $<name of toggle-python>
        actions:
          - type: pythonfile
            tag: <name of toggle-python>
            pythonfile:
                file: xAgeSDLBoolToggle
                parameters:
                  - type: activator
                    ref: logicmod:$<click-condition-name for button>
                  - type: string
                    value: <SDL variable>
                  - type: skip
                  - type: skip
                  - type: string
                    value: <SDL variable>
          - type: pythonfile
            tag: <name of responder-python>
            pythonfile:
                file: xAgeSDLBoolRespond
                parameters:
                  - type: string
                    value: <SDL variable>
                  - type: responder
                    ref: :<name of opening-script>
                  - type: responder
                    ref: :<name of closing-script>
                  - type: bool
                    value: false
                  - type: bool
                    value: true


<avi-anim start-empty>:
   logic:
       actions:
          - type: oneshot
            name: <local name of avi-anim>
            oneshot:
                animation: <avatar animation name>

   
<name of door>:
    animations:
        - name: <name of door-animation>
          autostart: 0
          loop: 0
    logic:
        actions:
          - type: responder
            name: <name of opening-script>
            responder:
               states:
                - cmds:
                   - type: oneshotmsg
                     params:
                        receivers:
                         - oneshotmod:<local name of avi-anim>
                        callbacks:
                         - marker: "DoorButtonTouch"
                           receiver: respondermod:<name of opening-script>
                           user: 0
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:<name of door>
                        animname: <name of door-animation>
                        cmds:
                         - setforewards
                         - continue
                     waiton: 0
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:<name of button>
                        animname: <name of button-animation>
                        cmds:
                         - setforewards
                         - continue
                     waiton: 0
                   - type: soundmsg
                     params:
                        receivers:
                         - 0011:<emitter for door-opening sound>
                         - 0011:<emitter for button pressing sound>
                        cmds:
                          - play
                          - setvolume
                        volume: 1
                     waiton: -1
                  nextstate: 1
                  waittocmd: 0
               curstate: 0
               flags:
                 - detecttrigger
          - type: responder
            name: <name of closing-script>
            responder:
               states:
                - cmds:
                   - type: oneshotmsg
                     params:
                        receivers:
                         - oneshotmod:<local name of avi-anim>
                        callbacks:
                         - marker: "DoorButtonTouch"
                           receiver: respondermod:<name of closing-script>
                           user: 0
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:<name of door>
                        animname: <name of door-animation>
                        cmds:
                         - setbackwards
                         - continue
                     waiton: 0
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:<name of button>
                        animname: <name of button-animation>
                        cmds:
                         - setforewards
                         - continue
                     waiton: 0
                   - type: soundmsg
                     params:
                        receivers:
                         - 0011:<emitter for door-closing sound>
                         - 0011:<emitter for button pressing sound>
                        cmds:
                          - play
                          - setvolume
                        volume: 1
                     waiton: -1
                  nextstate: 0
                  waittocmd: 0
               curstate: 0
               flags:
                 - detecttrigger

<emitter for door-closing sound>:
    type: soundemit
    sound:
        flags:
          - is3dsound
        file: <name of closing door sound file>
        volume: 1
        type: soundfx
        maxfdist: 50
        minfdist: 50

<emitter for door-opening sound>:
    type: soundemit
    sound:
        flags:
          - is3dsound
        file: <name of opening door sound file>
        volume: 1
        type: soundfx
        maxfdist: 50
        minfdist: 50

<emitter for button pressing sound>:
    type: soundemit
    sound:
        flags:
          - is3dsound
        file: <name of button sound file>
        volume: 1
        type: soundfx
        maxfdist: 50
        minfdist: 50


When everythings ok we could put that in the wiki...

A few more N00bish questions: I don't have a special python-bool-thingie...it's for disabling the button, right?
Is AlcScript doing everything or do i have to create a .py-file or something?
If, is it difficult to set something like that up? Or can i just change the code so its ignored?

I used the code, put my names in there and exported. when i pressed the button, nothing happened. Nothing at all...
Last edited by Zirrus on Mon Jul 28, 2008 9:56 am, edited 1 time in total.
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 diafero » Mon Jul 28, 2008 8:53 am

There are at least two mistakes in there (I don't know much about alcscript, but these are coverning the way python is included:
The two names of the python files must not be changed! It's not xAgeSDL<name of toggle-python> but xAgeSDLBoolToggle. And it's not xAgeSDL<name of responder-python> but xAgeSDLBoolRespond. These are global Python files Cyan provides, and you need both of them.
xAgeSDLBoolToggle toggles the SDL state each time the button is clicked
xAgeSDLBoolRespond animates the door each time the SDL var is changed (and it makes sure it has the right position when linking in)
Both of them together of course make things animate :)
In addition, there's still a "DoorButtonTouch" in there, I doubt this is general.

You need one Python file which has the same name as your age to make SDL working at all. I don't know if it has to actually contain anything.
I prefer e-mails to "diafero arcor de" (after adding the at and the dot) over PMs.

"Many people's horizon is a circle with a radius of zero. They call it their point of view."

Deep Island Shard | Offline KI
diafero
Deep Island Admin
 
Posts: 2966
Joined: Mon May 05, 2008 5:50 am
Location: Germany

Re: A Noob's Guide to Animations

Postby Zirrus » Mon Jul 28, 2008 9:58 am

Look, there's what i feared.
Corrected it, made a default python file for my age...and will try it now.

Nope. Won't work.

"AlcScript sappin' mah patience!"


Could someone please baby-step me through this whole thing? I lack any understanding of this. :cry:
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

Previous

Return to Scripting

Who is online

Users browsing this forum: No registered users and 4 guests