Page 1 of 1

WaitToCmd and a sliding door

PostPosted: Fri Apr 18, 2008 2:55 pm
by Paradox
My goal for Shell 410 is for the user to click the door, have the avatar walk over and touch it, and then have the door slide down with a rumbling sound.

I've got 2/3 parts working now. I've got the OneShotMod for the avatar to touch the door, I've got the sound, I've even got the actual animation objects created with a hex editor ready to be imported. I just need to write a message to start the animation (which I'll hopefully get working soon).

The key here is that the door should not start sliding down and the sound should not play until after the OneShotMod has finished animating. Luckily, there's an easy way to handle all of this. The ResponderModifier objects have a fWaitToCmd table, and all commands have an fWaitOn value. I set the fWaitOn value of my SoundMsg command to 0 (default is -1), and add an entry to the fWaitToCmd table. Key 0 has value 0.

Now, if I run Uru, I can click on the door, but the sound will never play, and the object will not be clickable again. I need to tell the ResponderModifier that the OneShotMod has finished, and that it can run the SoundMsg. In my OneShotMsg, I add a callback event that sends a notice to the ResponderModifier with a "user" variable. The user variable's value is the value of the fWaitToCmd table that we specified above.

The cmd fWaitOn gives a key for the fWaitToCmd table.
The value of that key is the user of a callback event from a message.

Once that callback is received by the ResponderModifier, the Wait'ed command will run.

Re: WaitToCmd and a sliding door

PostPosted: Fri Apr 18, 2008 5:55 pm
by Aloys
I didn't understand half of the Python details, but at least I understand you are able to have an avatar click a button, play the animation, play the sound in due time and have the door animate, and that's pretty cool. :)

Re: WaitToCmd and a sliding door

PostPosted: Fri Apr 18, 2008 6:04 pm
by Paradox
Actually, this doesn't use any Python. It's entirely ResponderModifier and AlcScript based :D

I've got all of the animation stuff done now except the message to actually start the anim >.<

Re: WaitToCmd and a sliding door

PostPosted: Fri Apr 18, 2008 8:17 pm
by Paradox
Animation is working nicely :D

I can click my door, have the avatar walk over and press it, and then have sound play while it sinks down. All without using any Python, and all based entirely with ResponderModifiers.

Re: WaitToCmd and a sliding door

PostPosted: Sat Apr 19, 2008 12:28 pm
by Jojon
Neat-o.

I guess soon we'll have access to the members only dancefloors at club Paradox. B^7

Re: WaitToCmd and a sliding door

PostPosted: Mon Apr 21, 2008 4:21 am
by Robert The Rebuilder
That's great news, Paradox!

I'm eager to gut all my ugly Python animation code once this capability is mature.

Re: WaitToCmd and a sliding door

PostPosted: Sat May 10, 2008 1:15 am
by Marcello
Paradox I'm currently learning more about programming pattern (for PhP programming). Would it be possible to wrap stuff like this in base classes which use patterns like that? What you are describing sounds like an observer kinda pattern to me.