Temporary picts

Ken Ray kray at sonsothunder.com
Thu Mar 21 12:32:01 EST 2002


Shari,

Couldn't you reduce the lines of code like this:

global gCurrSoundNum,gSoundList,gSoundTimes

on StartItUp
  put "darnyou.wav,aaah.wav,goodie.wav,oh yeah.wav,talk to you.wav" into
gSoundList
  put "531,1020,472,628" into gSoundTimes -- stores callbacktimes
  put 0 into gCurrSoundNum
  PlayIt
end StartItUp

on PlayIt
  add 1 to gCurrSound
  put the effective filename of this stack into wit
  set the itemDelimiter to "/"
  put item gCurrSound of gSoundList into that last item of wit
  set the fileName of player "Music" to wit
  set the startTime of player "Music" to "0"
  set the currentTime of player "Music" to "0"
  set the itemDelimiter to ","
  if gCurrSoundNum = (the number of items of gSoundList) then
    set the callbacks of player "Music" to empty
  else
    set the callbacks of player "Music" to (item gCurrSound of gSoundTimes)
& ",PlayIt"
  end if
  start player "Music"
end PlayIt


This should work (although I'm typing it off the top of my head)... the only
thing that may not work is the "set the callbacks" line with the variable -
it may need to be quoted, or executed with a "do", but it should work and
reduce the number of lines of code to 22...

Just a thought...

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web site: http://www.sonsothunder.com/


----- Original Message -----
From: "Shari" <gogypsy at bellsouth.net>
To: <metacard at lists.runrev.com>
Sent: Wednesday, March 20, 2002 9:41 PM
Subject: Re: Temporary picts


> >>So the solution has to be to avoid modal dialogs. You could do that by
> >>creating your own dialog stack and storing it as a substack in your main
> >>stack. You'd fill the text field with the appropriate response and set
> >>the button labels to whatever you want. Then display it as modeless:
> >>
> >>   modeless "myDialog"
> >
> >This would definitely be an option for the current project...
>
> Didn't work *sigh*
>
> Tried three versions.  All had the same result as using the answer
> command.  The first half of "darn you.wav" plays, and the last half
> of "talk to you" plays, and all the rest gets cut off.
>
> So it will have to be the long version.
>
> Wishful versions (5 lines of code):
>
> put "darn you.wav,aaah.wav,goodie.wav,oh yeah.wav,talk to you.wav"
> into soundList
>      repeat with x = 1 to the number of items of soundList
>        play (item x of soundList)
>      end repeat
>      answer "some info"
>
> put "darn you.wav,aaah.wav,goodie.wav,oh yeah.wav,talk to you.wav"
> into soundList
>      repeat with x = 1 to the number of items of soundList
>        play (item x of soundList)
>      end repeat
>      go cd "info" of stack "dLog" in a new window
>
> put "darn you.wav,aaah.wav,goodie.wav,oh yeah.wav,talk to you.wav"
> into soundList
>      repeat with x = 1 to the number of items of soundList
>        play (item x of soundList)
>      end repeat
>      go cd "info" of stack "dLog" as modeless
>
> put "darn you.wav,aaah.wav,goodie.wav,oh yeah.wav,talk to you.wav"
> into soundList
>      repeat with x = 1 to the number of items of soundList
>        play (item x of soundList)
>      end repeat
>      go cd "info" of stack "dLog" as modal
>
> Working version (about 50 lines of code) and requires a player on each
card:
>
> set the startTime of player "Music" to "0"
>      set the currentTime of player "Music" to "0"
>      put the effective filename of this stack into wit
>      set the itemdelimiter to "/"
>      put "darn you.wav" into the last item of wit
>      set the fileName of player "Music" to wit
>      set the callbacks of player "Music" to "531,end1"
>      start player "Music"
>
> on end1
>    put the effective filename of this stack into wit
>    set the itemdelimiter to "/"
>    put "aaah.wav" into the last item of wit
>    set the fileName of player "Music" to wit
>    set the startTime of player "Music" to "0"
>    set the currentTime of player "Music" to "0"
>    set the callbacks of player "Music" to "1020,end2"
>    start player "Music"
> end end1
>
> on end2
>    put the effective filename of this stack into wit
>    set the itemdelimiter to "/"
>    put "goodie.wav" into the last item of wit
>    set the fileName of player "Music" to wit
>    set the startTime of player "Music" to "0"
>    set the currentTime of player "Music" to "0"
>    set the callbacks of player "Music" to "472,end3"
>    start player "Music"
> end end2
>
> on end3
>    put the effective filename of this stack into wit
>    set the itemdelimiter to "/"
>    put "oh yeah.wav" into the last item of wit
>    set the fileName of player "Music" to wit
>    set the startTime of player "Music" to "0"
>    set the currentTime of player "Music" to "0"
>    set the callbacks of player "Music" to "628,end4"
>    start player "Music"
> end end3
>
> on end4
>    put the effective filename of this stack into wit
>    set the itemdelimiter to "/"
>    put "talk to you.wav" into the last item of wit
>    set the fileName of player "Music" to wit
>    set the startTime of player "Music" to "0"
>    set the currentTime of player "Music" to "0"
>    set the callbacks of player "Music" to empty
>    start player "Music"
> end end4
> --
> --Shareware Games for the Mac--
> http://www.gypsyware.com
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metacard
>




More information about the metacard mailing list