This would be an excellent place for you to learn to use the debugger.
I will make the following comments: 1) No need to set counter=1 only to turn around and initialize it in a loop to 1. Doesn't hurt anything, just redundant. 2) There are only two exit routes from your handler. One of them returns 'counter', and since you're in a loop, it can be presumed that counter has a value. Therefore, you must be exiting through the bottom of the handler. This means that you're getting through the loop without encountering anything that triggers the if statement. Therefore there are two ways this could happen: 1) There are no 0-entries, therefore you never hit the return statement, or 2) The list is empty, therefore it never executes the loop. You say it's filled with zeros, but we can't see that here. Therefore I would suggest using a PUT or ALERT just before the loop to display what myStack is equal to. Better yet, put a breakpoint there, see what the list is equal to, then trace through the loop to see how you're getting out of it. Also, I presume on the other end you're calling it properly. A couple of things to verify: 1) You call it like: myPos =getStackPointer() Use the empty parentheses to ensure it calls a function handler and not just tries to assign it to a variable. 2) getStackPointer is in a movie script 3) You actually assign the result to something. Hopefully you're doing all three, but these are just some more-overlooked ways of getting the error to. But I'd suggest placing a breakpoint (click on the line in question and press F9 to set it) then running it and seeing what happens! - Tab At 10:48 AM 2/21/02 -0500, Matthew DeSimone wrote: >So I ran tests this time before posting (=]) and I'm still stuck, so >here goes. > >I want to have a list of objects, which form a "stack" of current >operations being >performed. Each time a new operation needs to take place, the handler >"getStackPointer" is called, which finds an empty space in a linear >list, creates a new instance of an object, and then returns the position >in the list of the new object, ie: > >(my stack is declared on startmovie to be a linear list of 25 positions) > >global myStack > >on getStackPointer > counter = 1 > repeat with counter = 1 to myStack.count > if myStack[counter] = 0 then > myStack[counter] = new(script "myScript") > return counter > end if > end repeat >end getStackPointer > >Everything seems straightforward here, and the script compiles without >syntax errors. However, when I run the movie and call the handler >myStack[counter] is always returned as VOID. Since the list is filled >with 0's at startMovie, I at least know the value is being changed. Why >is it not changed to the new script instance? Do I have a logic error >that anyone can see, or is this just illegal? > >~matt desimone >[EMAIL PROTECTED] >www.syrupnyc.com > > >[To remove yourself from this list, or to change to digest mode, go to >http://www.penworks.com/lingo-l.cgi To post messages to the list, email >[EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L >is for learning and helping with programming Lingo. Thanks!] [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
