Strange timeline issue

edited October 2012 in Help request
I'm animating the appearance of the selectable options in my game's menu. However, the stack doesn't seem to be working right.

Here's what I have:
Track for the menu:
[T-CreateMainMenu]
0.0  = > > Object.GetOwnedChild ^ # Object.AddTrack < T-MenuOptionEnter
0.5  = > > Object.GetOwnedSibling < # Object.AddTrack < T-MenuOptionEnter
0.10 = > > Object.GetOwnedSibling < # Object.AddTrack < T-MenuOptionEnter
0.15 = > > Object.GetOwnedSibling < # Object.AddTrack < T-MenuOptionEnter
0.20 = > > Object.GetOwnedSibling < # Object.AddTrack < T-MenuOptionEnter
0.25 = > Object.GetOwnedSibling < # Object.AddTrack < T-MenuOptionEnter

Error Message:

[10:49:18] [SYSTEM] [orxCommand.c:orxCommand_Process():671] Can't pop stacked argument for command line [> > Object.GetOwnedSibling <]: stack is empty.
[10:49:18] [SYSTEM] [orxCommand.c:orxCommand_Process():863] Can't evaluate command line [> > Object.GetOwnedSibling <], invalid argument #1.
[10:49:18] [SYSTEM] [orxCommand.c:orxCommand_Process():863] Can't evaluate command line [Object.AddFX < FX-MenuOptionEnter], invalid argument #1.
The problem is, that this code should work perfectly fine. But I notice four things that don't look right:

1. The line it has a problem with is not the last one. However, the menu item that does not appear is the last one on the menu. 2. If I change the last line to match the rest of them, thus putting an extra, unnecessary pointer on the stack, it works, although the last menu option does not come in at the same timing the rest of them do (it's a very noticeable lag).
3. Adding an extra GetOwnedSibling line seems to fix it, even though I still get that error message.
4. I use the exact same logic in the code that fades the menu options out, and it works perfectly fine, exactly the way it should. Here's the code for this one:
[T-DestroyMainMenu]
0    = > > Object.GetOwnedChild ^ # Object.AddFX < FX-MenuOptionExit
0.05 = > > Object.GetOwnedSibling < # Object.AddFX < FX-MenuOptionExit
0.10 = > > Object.GetOwnedSibling < # Object.AddFX < FX-MenuOptionExit
0.15 = > > Object.GetOwnedSibling < # Object.AddFX < FX-MenuOptionExit
0.20 = > > Object.GetOwnedSibling < # Object.AddFX < FX-MenuOptionExit
0.25 = > Object.GetOwnedSibling < # Object.AddFX < FX-MenuOptionExit
1.26 = Object.Delete ^

The stack shouldn't be empty in the middle of this command. What's happening?

Comments

  • edited October 2012
    sonicbhoc wrote:
    The problem is, that this code should work perfectly fine.
    Well, no. That timeline is erroneous and I can see how it runs out of stack before the end. However your second timeline is different (most notably 0.05 != 0.5).

    Let's track the first one, that I reordered according to the time stamps:
    0.0  = > > Object.GetOwnedChild ^ # Object.AddTrack < T-MenuOptionEnter
    0.10 = > > Object.GetOwnedSibling < # Object.AddTrack < T-MenuOptionEnter
    0.15 = > > Object.GetOwnedSibling < # Object.AddTrack < T-MenuOptionEnter
    0.20 = > > Object.GetOwnedSibling < # Object.AddTrack < T-MenuOptionEnter
    0.25 = > Object.GetOwnedSibling < # Object.AddTrack < T-MenuOptionEnter
    0.5  = > > Object.GetOwnedSibling < # Object.AddTrack < T-MenuOptionEnter
    
    Let's analyze the stack, step by step. The number between () is the number of elements left on the stack at a given time.

    0.00: pushing 2 (2) # popping 1 (1)
    0.10: popping 1 (0), pushing 2 (2) # popping 1 (1)
    0.15: popping 1 (0), pushing 2 (2) # popping 1 (1)
    0.20: popping 1 (0), pushing 2 (2) # popping 1 (1)
    0.25: popping 1 (0), pushing 1 (1) # popping 1 (0)
    0.50: popping 1 (-1), end of story
    1. The line it has a problem with is not the last one. However, the menu item that does not appear is the last one on the menu.
    We've just established that the last item won't get the expected handling, it's consistent with your observations.
    The stack shouldn't be empty in the middle of this command. What's happening?
    Well, you now know what's happening in that case.
    If you were to use 0.05 instead of 0.5, that would be another story. :)
  • edited October 2012
    Oh, I see. How did I not notice that? I didn't make the same mistake in the nearly identical timeline underneath it... wow. I feel pretty slow now. :P
  • edited October 2012
    You need more sleep. I know that problem all too well! ;)
Sign In or Register to comment.