WaitToCmd and a sliding door

WaitToCmd and a sliding door

Postby Paradox » Fri Apr 18, 2008 2:55 pm

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.
Paradox
 
Posts: 1290
Joined: Fri Sep 28, 2007 6:48 pm
Location: Canada

Re: WaitToCmd and a sliding door

Postby Aloys » Fri Apr 18, 2008 5:55 pm

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. :)
User avatar
Aloys
 
Posts: 1968
Joined: Sun Oct 21, 2007 7:57 pm
Location: France (GMT +1)

Re: WaitToCmd and a sliding door

Postby Paradox » Fri Apr 18, 2008 6:04 pm

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 >.<
Paradox
 
Posts: 1290
Joined: Fri Sep 28, 2007 6:48 pm
Location: Canada

Re: WaitToCmd and a sliding door

Postby Paradox » Fri Apr 18, 2008 8:17 pm

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.
Paradox
 
Posts: 1290
Joined: Fri Sep 28, 2007 6:48 pm
Location: Canada

Re: WaitToCmd and a sliding door

Postby Jojon » Sat Apr 19, 2008 12:28 pm

Neat-o.

I guess soon we'll have access to the members only dancefloors at club Paradox. B^7
Jojon
 
Posts: 1116
Joined: Sun Sep 30, 2007 5:49 am

Re: WaitToCmd and a sliding door

Postby Robert The Rebuilder » Mon Apr 21, 2008 4:21 am

That's great news, Paradox!

I'm eager to gut all my ugly Python animation code once this capability is mature.
Can we rebuild it? Yes, we can - here's how.

MOULagain KI# 1299

Myst Movie coming soon - spread the word!
User avatar
Robert The Rebuilder
 
Posts: 1383
Joined: Sat Sep 29, 2007 7:24 am
Location: Virginia, US

Re: WaitToCmd and a sliding door

Postby Marcello » Sat May 10, 2008 1:15 am

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.
User avatar
Marcello
 
Posts: 374
Joined: Sun Nov 04, 2007 8:59 am
Location: Haarlem, The Netherlands


Return to Paradox's Journal

Who is online

Users browsing this forum: No registered users and 1 guest