Re: Auto Card Advance

Phil Davis (ideaguy@imagina.com)
Thu, 4 Sep 97 12:39:56 -0700

>Subject: Auto Card Advance
>Sent: 9/4/97 7:26 AM
>Received: 9/4/97 11:50 AM
>From: Wayne Aldrich, wayne_aldrich@mclean.sterling.com
>To: metacard-list@lists.best.com
>
>Hi-
>
>I have a 57 card CBT stack with audio on each card. The client would like
>me to give them the option to select one of two options: 1. to run
>through the stack manually (as it operates now, with forward and back
>buttons), and 2. to have each card in the stack automatically advance to
>the next card when its audio has finished.
>
>This request means I have to figure out two things. First, I have to put
>a selection screen at the beginning of the program offering the user the
>two choices, and then somehow capturing that choice. Second, I have to
>build in an auto page-turn which knows whether or not the user has
>selected the auto option and also knows when the card's audio file has
>finished playing.

There are several ways you could approach this. Here's one:

-- stack script ----------------------------------------

on openStack
-- ask the user if they want manual or auto advance
answer "Which way?" with "Manual" or "Auto"
if it is "Auto"
then insert the script of btn "auto" into back
else insert the script of btn "manual" into back
end openStack

on openCard
send "startSound" to this card
send "autoAdvance" to this card
end openCard

-- script of btn "auto" (hidden on card 1) -------------

on startSound
play audioClip (short name of this card)
end startSound

on autoAdvance
if the sound is "done"
then go next card
else send "autoAdvance" to this card
end autoAdvance

-- script of btn "manual" (hidden on card 1) -------------

on startSound
-- trap message and do nothing
end startSound

on autoAdvance
-- trap message and do nothing
end autoAdvance

DISCLAIMER: This code is completely untested.

>
>I have just started working on this, so it may not be fair to ask for
>input yet:-)
>but I thought that some of you may have done similar things and might be
>able to save me some time.
>
>I know the "sound" property allows me to check whether audio is playing,
>but I haven't quite worked out the syntax yet. Also, I assume that I
>should be able to set a variable depending on the user selection regarding
>auto page turn. However, it seems to me that a standard global variable
>only remains active within a single script (I could be wrong), so I'm not
>sure how to set a global variable throughout a stack.

Just declare the global in any handler where you want to use it - the
value will remain the same from one use to the next (within a given
MetaCard session - from program launch to program exit).

on openCard
doFirst
doSecond
end openCard

on doFirst
global gName
put "Wayne" into gName
end doFirst

on doSecond
global gName
answer gName -- will display "Wayne" in the dialog
end doSecond

>
>Enough questions. Thank you!
>
>Wayne
>

Phil Davis
--------------------------------------
ideaguy@imagina.com (503) 557-5656