filmloop playback handler


[ Zettels Traum ] [ search / suche ]

von dp am 28.Juli 97 um 00:54:29:

I know of no obscure lingo to question a filmloop whether its finished.
I saw Dave's solution reposted by Michael Bashista. However, you still 
have to input the number of frames of that loop  as a constant.
I'm in the midst of a project with hundreds of filmloops with animations
like "talking", "walkingLeft", ...
I wanted a FrameScript that could treat them all with minimum adaption
necessary.
So each FilmLoop keeps the info about its length in its name.
i.e.: "talking-3", "walkingLeft-9".
If i.e. "talking-3" needs to be repeated 10 times with the filmloop living
in sprite 30
the handler below serves me well. I keep a collection of versions of it
with the typical values, drag &drop them where needed and need not care if
someone else decides to add a frame to that loop. If it happens to be
"talking-5" in the end, I won't have to change a bazillion of frame scripts.


-- FrameScript plays a FilmLoop wieOft times
on exitFrame
  global gAnimCount,gAnimTimes
  -- adapt this to the number of times you want the FilmLoop displayed
  set wieOft=10
  -- adapt this to the sprite your filmloop sits in
  set animSprite=30
  if voidP(gAnimTimes) then set gAnimTimes=1
  if voidP(gAnimCount) then set gAnimCount=1
  set dName=the name of member the member of sprite animSprite
  set da= offset("-", dName)
  set darst=chars(dName,1,da-1)
  set maxLoop=value(chars(dName,da+1,the number of chars in dName))
  if maxLoop<=gAnimCount then
    -- done once
    set gAnimCount=value(VOID)
    set gAnimTimes=gAnimTimes + 1
    -- may be once more?
    if wieOft<gAnimTimes then
      -- no, we're through
      set gAnimTimes=value(VOID)
      go the frame +1
    else
      set gAnimCount=1
      go the frame
    end if
  else
    set gAnimCount=gAnimCount + 1
    go the frame
  end if
end

Daniel Plaenitz

























D. Plänitz