Triggered Looping Animations

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

Re: Triggered Looping Animations

Postby Justintime9 » Sat Aug 28, 2010 5:24 am

Ok, here's the export log:

http://pastebin.ca/1927573

and here's the python.0.elf file (just the end though, the rest is just about relto, the books on my shelf):

Code: Select all
(08/28 08:04:10) psnlBookshelf.IUpdateLocksAndTrays():   no matching book for KI's link to: Prad ...skipping to next
(08/28 08:04:10) psnlBookshelf.IUpdateLocksAndTrays():   no matching book for KI's link to: Ulteemah ...skipping to next
(08/28 08:04:10) DEBUG: psnlVaultSDLBoolShowHide.EnableObject:  Attempting to enable drawing and collision on WedgeAhnonay...
(08/28 08:04:10) DEBUG: psnlVaultSDLBoolShowHide.EnableObject:  Attempting to enable drawing and collision on WedgeErcana...
(08/28 08:04:10) DEBUG: psnlVaultSDLBoolShowHide.DisableObject:  Attempting to disable drawing and collision on WedgeMinkata...
(08/28 08:04:10) DEBUG: psnlVaultSDLBoolShowHide.EnableObject:  Attempting to enable drawing and collision on WedgeRing1Garrison...
(08/28 08:04:10) DEBUG: psnlVaultSDLBoolShowHide.EnableObject:  Attempting to enable drawing and collision on WedgeRing1Kadish...
(08/28 08:04:10) DEBUG: psnlVaultSDLBoolShowHide.EnableObject:  Attempting to enable drawing and collision on WedgeRing1Kemo...
(08/28 08:04:10) DEBUG: psnlVaultSDLBoolShowHide.EnableObject:  Attempting to enable drawing and collision on WedgeRing1Teledahn...
(08/28 08:04:10) DEBUG: psnlVaultSDLBoolShowHide.DisableObject:  Attempting to disable drawing and collision on WedgeRing3Pod1...
(08/28 08:04:10) DEBUG: psnlVaultSDLBoolShowHide.DisableObject:  Attempting to disable drawing and collision on WedgeRing3Pod2...
(08/28 08:04:10) DEBUG: psnlVaultSDLBoolShowHide.DisableObject:  Attempting to disable drawing and collision on WedgeRing3Pod3...
(08/28 08:04:10) DEBUG: psnlVaultSDLBoolShowHide.DisableObject:  Attempting to disable drawing and collision on WedgeRing3Pod4...
(08/28 08:04:15) DEBUG: xTakableJournal.IDisableJournal():  Disabling clickable on EditPersonalJournal...
(08/28 08:04:15) xKI:GZ: Refreshing MarkerDisplay  0:0
(08/28 08:04:28) __init__xAgeSDLIntStartStopResp v. 1
(08/28 08:04:28) __init__xAgeSDLIntStartStopResp v. 1
(08/28 08:04:28) __init__TsoidahlPradBookGUI v.3.0
(08/28 08:04:28) __init__TsoidahlPradBookGUI v.3.0
(08/28 08:04:28) __init__TsoidahlPradBookGUI v.3.0
(08/28 08:04:32) xKI.OnServerInitComplete(): age =  TsoidahlPrad
(08/28 08:04:32) DEBUG: xAgeSDLIntStartStopResp.OnServerInitComplete:   Processing
(08/28 08:04:32) DEBUG: xAgeSDLIntStartStopResp.OnServerInitComplete:   Running stop responder
(08/28 08:04:32) DEBUG: xAgeSDLBoolToggle.OnServerInitComplete():   FMFall = 0
(08/28 08:04:32) DEBUG: xAgeSDLBoolToggle.OnServerInitComplete():   SirrusTurn = 0
(08/28 08:04:32) DEBUG: xAgeSDLIntStartStopResp.OnServerInitComplete:   Processing
(08/28 08:04:32) DEBUG: xAgeSDLIntStartStopResp.OnServerInitComplete:   Running stop responder
(08/28 08:05:13) DEBUG: xAgeSDLBoolToggle.OnNotify():    local player requesting SirrusTurn change via SirrusButtonClick
(08/28 08:05:13) DEBUG: xAgeSDLBoolToggle.OnNotify():   set age SDL var SirrusTurn to 1
(08/28 08:05:13) DEBUG: xAgeSDLBoolToggle.OnSDLNotify():    VARname:SirrusTurn, SDLname:TsoidahlPrad, tag:SirrusTurn, value:1
(08/28 08:05:13) DEBUG: xAgeSDLIntStartStopResp.OnSDLNotify received: SirrusTurn = 1
(08/28 08:05:13) DEBUG: xAgeSDLIntStartStopResp.OnSDLNotify: running start responder


I just pressed the SirrusButton for simplicity's sake (and I'm assuming both animations are having the same problem)
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

Re: Triggered Looping Animations

Postby D'Lanor » Sat Aug 28, 2010 6:24 am

It looks like everything exported fine and according to the Python log file it works beautifully. But since we are talking about animations... are you deleting your sav file between changes?
"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: Triggered Looping Animations

Postby Justintime9 » Sat Aug 28, 2010 6:39 am

Yup, every single time. If you can't figure it out I can always send you the blendfile, in case I overlooked something.
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

Re: Triggered Looping Animations

Postby D'Lanor » Sat Aug 28, 2010 7:50 am

Oh I see. xAgeSDLIntStartStopResp does not support avatar oneshots. And if the oneshot doesn't run there is no callback to trigger the animation. So you need to replace it with boring old xAgeSDLBoolRespond instead.

Code: Select all
          - type: pythonfile
            tag: BoolRespond
            pythonfile:
                file: xAgeSDLBoolRespond
                parameters:
                  - type: string
                    value: SirrusTurn
                  - type: responder
                    ref: $StartTurn
                  - type: responder
                    ref: $StopTurn
                  - type: bool
                    value: false
                  - type: bool
                    value: true
"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: Triggered Looping Animations

Postby Justintime9 » Sat Aug 28, 2010 9:04 am

Ok, I put that in for both the scripts, and exported. I checked "FMSphere" and "SirrusToy", and the FMSphere animation works PERFECTLY. Strangely though, SirrusToy does not. When I linked in and clicked it's button, the avatar animation worked, but the object did not start moving. When I re-linked the object was moving.

When I pushed the button then, it did the avatar animation again but did not stop the animation. Plus, after pressing the button two times it ceases to do the avatar animation. I once again re-linked and saw that it was not moving again. Here's both the scripts in case I put it in wrong for SirrusToy:

Code: Select all
SirrusButton:
    logic:
        modifiers:
          - name: SirrusButtonClick
            cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: SirrusReg
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: pythonfile
                ref: $BoolToggle
        actions:
          - type: pythonfile
            tag: BoolToggle
            pythonfile:
                file: xAgeSDLBoolToggle
                parameters:
                  - type: activator
                    ref: logicmod:SirrusButtonClick
                  - type: string
                    value: SirrusTurn
                  - type: skip
                  - type: skip
                  - type: string
                    value: SirrusTurn

SirrusButton:
    logic:
        modifiers:
          - name: SirrusButtonClick
            cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: SirrusReg
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: pythonfile
                ref: $BoolToggle
        actions:
          - type: pythonfile
            tag: BoolToggle
            pythonfile:
                file: xAgeSDLBoolToggle
                parameters:
                  - type: activator
                    ref: logicmod:SirrusButtonClick
                  - type: string
                    value: SirrusTurn
                  - type: skip
                  - type: skip
                  - type: string
                    value: SirrusTurn


SirrusToy:
    animations:
        - name: SirrusRotate
          autostart: 0
          loop: 1
    logic:
        actions:
          - type: pythonfile
            tag: BoolRespond
            pythonfile:
                file: xAgeSDLBoolRespond
                parameters:
                  - type: string
                    value: SirrusTurn
                  - type: responder
                    ref: $StartTurn
                  - type: responder
                    ref: $StopTurn
                  - type: bool
                    value: false
                  - type: bool
                    value: true
          - type: responder
            tag: StartTurn
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:SirrusTarget
                            callbacks:
                              - marker: ButtonTouch
                                receiver: respondermod:$StartTurn
                                user: 0
                        waiton: -1
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:SirrusToy
                            animname: SirrusRotate
                            cmds:
                              - continue
                        waiton: 0
                    nextstate: 0
                    ncallbacks: 1
                    waittocmd:
                      - key: 0
                        msg: 0
                curstate: 0
                flags:
                  - detecttrigger
          - type: responder
            tag: StopTurn
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:SirrusTarget
                            callbacks:
                              - marker: ButtonTouch
                                receiver: respondermod:$StopTurn
                                user: 0
                        waiton: -1
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:SirrusToy
                            animname: SirrusRotate
                            cmds:
                              - stop
                        waiton: 0
                    nextstate: 0
                    ncallbacks: 1
                    waittocmd:
                      - key: 0
                        msg: 0
                curstate: 0
                flags:
                  - detecttrigger


SirrusTarget:
    logic:
        actions:
          - type: oneshot
            name: SirrusTarget
            oneshot:
                animation: ButtonTouch
   
FMMButton:
    logic:
        modifiers:
          - name: FMMButtonClick
            cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: FMMReg
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: pythonfile
                ref: $BoolToggle
        actions:
          - type: pythonfile
            tag: BoolToggle
            pythonfile:
                file: xAgeSDLBoolToggle
                parameters:
                  - type: activator
                    ref: logicmod:FMMButtonClick
                  - type: string
                    value: FMFall
                  - type: skip
                  - type: skip
                  - type: string
                    value: FMFall


FMMSphere:
    animations:
        - name: FMMFall
          autostart: 0
          loop: 1
    logic:
        actions:
          - type: pythonfile
            tag: BoolRespond
            pythonfile:
                file: xAgeSDLBoolRespond
                parameters:
                  - type: string
                    value: FMFall
                  - type: responder
                    ref: $StartTurn
                  - type: responder
                    ref: $StopTurn
                  - type: bool
                    value: false
                  - type: bool
                    value: true
          - type: responder
            tag: StartTurn
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:FMMTarget
                            callbacks:
                              - marker: DoorButtonTouch
                                receiver: respondermod:$StartTurn
                                user: 0
                        waiton: -1
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:FMMSphere
                            animname: FMMFall
                            cmds:
                              - continue
                        waiton: 0
                    nextstate: 0
                    ncallbacks: 1
                    waittocmd:
                      - key: 0
                        msg: 0
                curstate: 0
                flags:
                  - detecttrigger
          - type: responder
            tag: StopTurn
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:FMMTarget
                            callbacks:
                              - marker: DoorButtonTouch
                                receiver: respondermod:$StopTurn
                                user: 0
                        waiton: -1
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:FMMSphere
                            animname: FMMFall
                            cmds:
                              - stop
                        waiton: 0
                    nextstate: 0
                    ncallbacks: 1
                    waittocmd:
                      - key: 0
                        msg: 0
                curstate: 0
                flags:
                  - detecttrigger


FMMTarget:
    logic:
        actions:
          - type: oneshot
            name: FMMTarget
            oneshot:
                animation: DoorButtonTouch
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

Re: Triggered Looping Animations

Postby D'Lanor » Sat Aug 28, 2010 12:30 pm

Sorry, the callback marker for ButtonTouch should be TouchButton according to the wiki.

Code: Select all
SirrusToy:
    animations:
      - name: SirrusRotate
        autostart: 0
        loop: 1
    logic:
        actions:
          - type: pythonfile
            tag: BoolRespond
            pythonfile:
                file: xAgeSDLBoolRespond
                parameters:
                  - type: string
                    value: SirrusTurn
                  - type: responder
                    ref: $StartTurn
                  - type: responder
                    ref: $StopTurn
                  - type: bool
                    value: false
                  - type: bool
                    value: true
          - type: responder
            tag: StartTurn
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:SirrusTarget
                            callbacks:
                              - marker: TouchButton
                                receiver: respondermod:$StartTurn
                                user: 0
                        waiton: -1
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:SirrusToy
                            animname: SirrusRotate
                            cmds:
                              - continue
                        waiton: 0
                    nextstate: 0
                    ncallbacks: 1
                    waittocmd:
                      - key: 0
                        msg: 0
                curstate: 0
                flags:
                  - detecttrigger
          - type: responder
            tag: StopTurn
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:SirrusTarget
                            callbacks:
                              - marker: TouchButton
                                receiver: respondermod:$StopTurn
                                user: 0
                        waiton: -1
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:SirrusToy
                            animname: SirrusRotate
                            cmds:
                              - stop
                        waiton: 0
                    nextstate: 0
                    ncallbacks: 1
                    waittocmd:
                      - key: 0
                        msg: 0
                curstate: 0
                flags:
                  - detecttrigger


There is also a duplicate SirrusButton script and the indentation error which Paradox has already pointed out, but these should be no show stoppers.
"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: Triggered Looping Animations

Postby Justintime9 » Sun Aug 29, 2010 4:56 am

Awesome, that works fine now :D. Just one last thing though: I've noticed that it seems a bit flat without any sound, so what would I add to the script to give the animation sound when it's playing?
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

Re: Triggered Looping Animations

Postby D'Lanor » Sun Aug 29, 2010 6:10 am

Here is the script from my previous post with sound added:

Code: Select all
SirrusToy:
    animations:
      - name: SirrusRotate
        autostart: 0
        loop: 1
    logic:
        actions:
          - type: pythonfile
            tag: BoolRespond
            pythonfile:
                file: xAgeSDLBoolRespond
                parameters:
                  - type: string
                    value: SirrusTurn
                  - type: responder
                    ref: $StartTurn
                  - type: responder
                    ref: $StopTurn
                  - type: bool
                    value: false
                  - type: bool
                    value: true
          - type: responder
            tag: StartTurn
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:SirrusTarget
                            callbacks:
                              - marker: TouchButton
                                receiver: respondermod:$StartTurn
                                user: 0
                        waiton: -1
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:SirrusToy
                            animname: SirrusRotate
                            cmds:
                              - continue
                        waiton: 0
                      - type: soundmsg
                        params:
                            receivers:
                              - 0011:<name of emitter>
                            cmds:
                              - play
                              - setvolume
                            volume: 1 #adjust volume 0 - 1
                        waiton: -1
                    nextstate: 0
                    ncallbacks: 1
                    waittocmd:
                      - key: 0
                        msg: 0
                curstate: 0
                flags:
                  - detecttrigger
          - type: responder
            tag: StopTurn
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:SirrusTarget
                            callbacks:
                              - marker: TouchButton
                                receiver: respondermod:$StopTurn
                                user: 0
                        waiton: -1
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:SirrusToy
                            animname: SirrusRotate
                            cmds:
                              - stop
                        waiton: 0
                      - type: soundmsg
                        params:
                            receivers:
                              - 0011:<name of emitter>
                            cmds:
                              - play
                              - setvolume
                            volume: 1 #adjust volume 0 - 1
                        waiton: -1
                    nextstate: 0
                    ncallbacks: 1
                    waittocmd:
                      - key: 0
                        msg: 0
                curstate: 0
                flags:
                  - detecttrigger
"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: Triggered Looping Animations

Postby Justintime9 » Sun Aug 29, 2010 7:23 am

Ah, thx. Although I actually meant the animation itself having a sound (e.g if there's a machine, when you push the button and the gears start turning a machine sound will loop endlessly until it's turned off.) O, and could you modify the FMMSphere script instead of the SirrusToy?
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

Re: Triggered Looping Animations

Postby D'Lanor » Sun Aug 29, 2010 8:53 am

I see. That would look like this.

Code: Select all
FMMSphere:
    animations:
      - name: FMMFall
        autostart: 0
        loop: 1
    logic:
        actions:
          - type: pythonfile
            tag: BoolRespond
            pythonfile:
                file: xAgeSDLBoolRespond
                parameters:
                  - type: string
                    value: FMFall
                  - type: responder
                    ref: $StartTurn
                  - type: responder
                    ref: $StopTurn
                  - type: bool
                    value: false
                  - type: bool
                    value: true
          - type: responder
            tag: StartTurn
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:FMMTarget
                            callbacks:
                              - marker: DoorButtonTouch
                                receiver: respondermod:$StartTurn
                                user: 0
                        waiton: -1
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:FMMSphere
                            animname: FMMFall
                            cmds:
                              - continue
                        waiton: 0
                      - type: soundmsg
                        params:
                            receivers:
                              - 0011:<name of emitter>
                            cmds:
                              - play
                              - setvolume
                            volume: 1 #adjust volume 0 - 1
                        waiton: -1
                    nextstate: 0
                    ncallbacks: 1
                    waittocmd:
                      - key: 0
                        msg: 0
                curstate: 0
                flags:
                  - detecttrigger
          - type: responder
            tag: StopTurn
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:FMMTarget
                            callbacks:
                              - marker: DoorButtonTouch
                                receiver: respondermod:$StopTurn
                                user: 0
                        waiton: -1
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:FMMSphere
                            animname: FMMFall
                            cmds:
                              - stop
                        waiton: 0
                      - type: soundmsg
                        params:
                            receivers:
                              - 0011:<name of emitter>
                            cmds:
                              - stop
                        waiton: -1
                    nextstate: 0
                    ncallbacks: 1
                    waittocmd:
                      - key: 0
                        msg: 0
                curstate: 0
                flags:
                  - detecttrigger

And your emitter must have the - looping flag.
"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

Previous

Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests

cron