[comp.sys.mac.hypercard] Recursion, etc...

flip@pixar.UUCP (Flip Phillips) (02/14/89)

I have a background script wich, when it gets an openCard
message it waits a certain amount of time, then does a go to next
card. This is bad since this thing recurses... and hypercard complains
only a few cards into the stack. It is essentially a 'hands off' slide show, 
i.e. the gotonextcard isnt imbedded in a mouseUp message, but is timed.

is there another way i should be doing this?

-- 
Flip Phillips                                        {sun | ucbvax}!pixar!flip
Pixar - Marin County, California

jdevoto@Apple.COM (Jeanne A. E. DeVoto) (02/15/89)

In article <3134@pixar.UUCP> flip@pixar.UUCP (Flip Phillips) writes:
>I have a background script wich, when it gets an openCard
>message it waits a certain amount of time, then does a go to next
>card. This is bad since this thing recurses...
>...
>is there another way i should be doing this?

Here is one way to get around this problem:
 - instead of using the openCard message to continue the slide show,
put the whole sequence in a repeat loop located in the handler that
starts the slide show. For instance,
   on mouseUp
     repeat for the number of cards
       wait 5 seconds
       go to next card
     end repeat
   end mouseUp

jeanne a. e. devoto
jdevoto@apple.com

carterbk@apple.com (Bryan 'STAKMan' Carter) (02/17/89)

In article <3134@pixar.UUCP> flip@pixar.UUCP (Flip Phillips) writes:
> I have a background script wich, when it gets an openCard
> message it waits a certain amount of time, then does a go to next
> card. This is bad since this thing recurses... and hypercard complains
> only a few cards into the stack. It is essentially a 'hands off' slide 
show, 
> i.e. the gotonextcard isnt imbedded in a mouseUp message, but is timed.
> 
> is there another way i should be doing this?

Many people have called me for help on this very problem.  (I don't have 
the time to help everyone all the time, yet I love helping people out.  
This is a Catch Hyper22.)

Never depend upon "openCard" handlers to control an automatic/slide-show 
type stack.  Such a script should be done with one script,  possibly 
calling sub-scripts for each card.   By using the 'openCard' or 
'closeCard' handlers, after about 5-7 cards (6 is the magic number) an 
error reports "Too much recursion."    You can only call a handler 5 
levels deep before the error occurs.

So, the best way around this is to create a 'mouseUp' which controls the 
slide-show.  I believe that someone else already posted such a similar 
suggestion.  I just wanted to put my two cents in (after I spent 5 hours 
telling one guy not to depend on 'openCard' handlers.


'STAKMan'aging,
Bryan K. 'STAKMan' Carter
President, Apple HyperCard User Group, AHUG
AppleLink:  UG.AHUG
All opinions/views/comments are mine!!
<<<There are two of every kind of snow flake in the world, it just depends 
upon who's second grade class your in.>>>