animation quickscript test

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

Re: animation quickscript test

Postby Nadnerb » Tue Sep 02, 2008 3:32 pm

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.
Live KI: 34914 MOULa KI: 23247 Gehn KI: 11588 Available Ages: TunnelDemo3, BoxAge, Odema
Nadnerb
 
Posts: 1057
Joined: Fri Sep 28, 2007 8:01 pm
Location: US (Eastern Time)

Re: animation quickscript test

Postby D'Lanor » Tue Sep 02, 2008 4:37 pm

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.
"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 Nadnerb » Tue Sep 02, 2008 8:28 pm

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.
Live KI: 34914 MOULa KI: 23247 Gehn KI: 11588 Available Ages: TunnelDemo3, BoxAge, Odema
Nadnerb
 
Posts: 1057
Joined: Fri Sep 28, 2007 8:01 pm
Location: US (Eastern Time)

Re: animation quickscript test

Postby D'Lanor » Tue Sep 02, 2008 9:01 pm

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?
"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 Nadnerb » Thu Sep 04, 2008 4:48 pm

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)
Live KI: 34914 MOULa KI: 23247 Gehn KI: 11588 Available Ages: TunnelDemo3, BoxAge, Odema
Nadnerb
 
Posts: 1057
Joined: Fri Sep 28, 2007 8:01 pm
Location: US (Eastern Time)

Re: animation quickscript test

Postby D'Lanor » Tue Sep 09, 2008 2:11 pm

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.
"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 Gbadji » Sat Sep 12, 2009 4:02 am

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.
The French's Mystpedia age Project - http://www.mystpedia.net
To find me in the Cavern: Gbadji KI #6911493 or Alatan KI#7869109
User avatar
Gbadji
 
Posts: 73
Joined: Sat Feb 02, 2008 5:59 am

Re: animation quickscript test

Postby D'Lanor » Sat Sep 12, 2009 4:36 am

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.
"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 Gbadji » Sat Sep 12, 2009 5:23 am

Thanks D'Lanor, I can wait the PyPRP 1.6 :D

See you soon.
The French's Mystpedia age Project - http://www.mystpedia.net
To find me in the Cavern: Gbadji KI #6911493 or Alatan KI#7869109
User avatar
Gbadji
 
Posts: 73
Joined: Sat Feb 02, 2008 5:59 am

Previous

Return to Scripting

Who is online

Users browsing this forum: No registered users and 2 guests

cron