Page 4 of 4

Re: animation quickscript test

PostPosted: Tue Sep 02, 2008 3:32 pm
by Nadnerb
you should be able to do it via alcscript with an enablemsg. I don't see any docs on enablemsg in the wiki, so I'll just pull some code out of my age..
Code: Select all
                   - type: enablemsg
                     params:
                        receivers:
                         - scnobj:ResSluiceWater
                        cmds:
                         - drawable
                         - enable
                         - disable


basically, you send this message to any type of object, including logicmod, scnobj, etc... if it's a drawable, you need the drawable flag in cmds, otherwise choose one, enable or disable.

Re: animation quickscript test

PostPosted: Tue Sep 02, 2008 4:37 pm
by D'Lanor
Yep, I knew that one. But we don't want to disable the visibility of an object (button) that still needs to be animated, do we? Or its "physical" properties for that matter, which would be closer to the mark. I think if you disable the activator through Python you disable just that, its clickability.

Edit: Ok, scratch that last part. It looks like Python also disables the physics. So I am going to try something this.

Code: Select all
                    - type: enablemsg
                      params:
                          receivers:
                            - scnobj:<clickable>
                          cmds:
                            - physical
                            - disable
                      waiton: -1

                  #do other responder stuff

                    - type: enablemsg
                      params:
                          receivers:
                            - scnobj:<clickable>
                          cmds:
                            - physical
                            - enable
                      waiton: -1


Edit 2: Status - failure. Physics are not enabled when the Cyan Python script fast forwards the animation state at link in, even though it is the last step in the responder sequence. So the button is no longer a clickable. :(

Edit 3: I tried to directly reference the logicmod but that did not seem to have any effect.

Code: Select all
                    - type: enablemsg
                      params:
                          receivers:
                            - logicmod:$<modifier tag>
                          cmds:
                            - physical
                            - disable
                      waiton: -1

                  #do other responder stuff

                    - type: enablemsg
                      params:
                          receivers:
                            - logicmod:$<modifier tag>
                          cmds:
                            - physical
                            - enable
                      waiton: -1


The button was clickable all the time as in the original script. Maybe that was because the logicmod does not listen to "- physical - disable". But more likely the enable message at the end should wait for a callback from the last action in the sequence. Callbacks however are currently only implemented for oneshotmods. So I am giving up for now.

Re: animation quickscript test

PostPosted: Tue Sep 02, 2008 8:28 pm
by Nadnerb
Well, to be specific, I was suggesting that you disable the logicmod. Anyway, unless you have some sort of callback or waiting in your responder, it will just send all the messages at once, and so it will be enabled and disabled at the same time. If you want to keep it all in alcscript without making it too complicated, you could try a timercallbackmsg.

Code: Select all
                   - type: timercallbackmsg
                     params:
                        receivers:
                         - respondermod:<this responder>
                        id: 0
                        time: 2.0
                     waiton: -1
                   - type: somerandommsg
                     waiton: 0
                  # this is a table at the bottom of the responder that defines which messages wait on which actions.
                  # in this example, somerandommsg will be executed when the timer calls back after 2 seconds
                  # the messages with a waiton value of msg will be executed when the callback with id value of key returns
                  waittocmd:
                    - key: 0
                      msg: 0


execution blocks at a message that is waiting on a callback and no further messages will be sent from that responder until the waiting one is sent.

Re: animation quickscript test

PostPosted: Tue Sep 02, 2008 9:01 pm
by D'Lanor
Thanks. I had found and considered the timer callback. This would normally do the trick, but for a generic quickscript it is not the best solution. The user could be running an animation that is much longer than the time we set.

I would rather have a callback from an animcmdmsg or a soundmsg. Is that possible? They both seem to have a command "addcallbacks" but can that be used?

Re: animation quickscript test

PostPosted: Thu Sep 04, 2008 4:48 pm
by Nadnerb
You can get a callback for a oneshot if you activate it from your responder with a oneshotmsg

Code: Select all
# this goes in the responder
                   - type: oneshotmsg
                     params:
                        receivers:
                         - oneshotmod:DoorButtonOneshot
                        callbacks:
                         - marker: "DoorButtonTouch"
                           receiver: respondermod:DoorOpen
                           user: 0
                     waiton: -1

# this is the definition of the oneshotmod being referenced
DoorButtonOneshot:
    logic:
        actions:
            - type: oneshot
              name: DoorButtonOneshot
              oneshot:
                 animation: DoorButtonTouch


The "user" parameter for the callback is equivalent to the "id" parameter in the timercallbackmsg
I haven't checked the locations of all the markers in all the oneshot animations, but the marker with the name of the animation seems to be at the end of each. (that, or it just calls back at the end of the anim, whether it found the marker or not)

Re: animation quickscript test

PostPosted: Tue Sep 09, 2008 2:11 pm
by D'Lanor
Ok, thanks for the suggestions. The oneshot callback is already being used for this quickscript. However, the avatar animation takes place before the actual animation even begins which makes the oneshot callback useless for this purpose.

So I picked the timer callback option.

It works as follows: Users must time their own animation sequence (including avatar animation) and then set the disabled time for the clickable themselves. This time out can be specified with the new "clicktimeout" parameter. For example:

Code: Select all
<clickable object>:
    quickscript:
        stateanimation:
            clicktimeout: 5.5

Note: other parameters left out for readability. See first post for full description.

This will disable the clickable for five and a half seconds from the moment of being clicked. The new script has been submitted to the subversion repository. For now it can be downloaded here.

Re: animation quickscript test

PostPosted: Sat Sep 12, 2009 4:02 am
by Gbadji
Hi,

is it that prp_QuickScripts.py available in pyPRP 1.5 ?

Or we still have to use the full alscript shown in the wiki ?

Thanks.

Re: animation quickscript test

PostPosted: Sat Sep 12, 2009 4:36 am
by D'Lanor
No, but it is in the nightly build. However, if you can wait another day you can get it with PyPRP 1.6 which will be released tomorrow.

Re: animation quickscript test

PostPosted: Sat Sep 12, 2009 5:23 am
by Gbadji
Thanks D'Lanor, I can wait the PyPRP 1.6 :D

See you soon.