Thank so much for the great response to my question. As you can guess I am completely self taught, and to receive a reply that directs my strategic approach to solving scripting tasks, really in general, and opens up completely new vistas to me is terrific. And to have also included the actual code examples is more than I could have hoped for.

This is of surival level importance to me, as my business depends on making these kiosk movies work.

Thank you very much!

Paul Fretheim

Alex da Franca wrote:


Am 31.03.2006 um 01:15 schrieb Paul Fretheim:

I have been running kiosks which run on Win XP for a long time. I need to create a Director movie that is cross platform. I have both Mac and Win versions of Director MX 2004.

When I try to use the same utility scripts I have been using for a long time with Win XP Dir projectors they don't work with the Mac. I include the syntax I have been using followed by what I have been trying with the Mac version.

The Mac won't update the stage. It hangs until the end of the repeat, and then displays the pano like a slide show at the end of each pan as the movie advances through the sequential scripts.


it may be related to the fact, that the qtvr is processed outside of director -> xtra -> system:quicktime updatestage only allows the director engine to update its own image of the stage, but in case of a dts sprite director is not involved in rendering the content of the sprite. in your case it's the quicktime engine, which processes the content of the sprite. since you do not give any cpu time to other processes, for the time you are inside the repeat loop, quicktime can't update the content of the sprite. the fact that it works on windows and not on mac, may be related in either the way quicktimeVR is handled in windows (maybe it is not even set to DTS) or that it may be the case, that part of updatestage is a system call, which triggers an event to other applications.

in either case, what you have shown is widely known as a "tight repeat loop". "tight repeat loops" are something that you should try to avoid. use a repeat loop for short tasks, but don't use a repeat loop to "wait" for events, since you block ALL other tasks, which otherwise do "their work" silently in the background. It is kind of unpolite behavior to treat your programming task "as the center of the earth" and don't care for others. :-)

we shouldn't need to use the keyword updatestage in an ideally programmed director movie (theorethically!!)

to make the long story short move your handler to be frame based instead.

you should anyway look into behaviors, as what you do is MUCH better suited for a behavior than for a movie script. the behavior "knows" its sprite and you simply send the event to the sprite, which does its own work in its own variable space (no need to waste the public variable space with global variables). much cleaner and much tidier solution.



----------------- behavior
property pCurrentPan
property pIncrement, pCounter

on roboPan me, panCrement, repeatTimes
  pIncrement  = panCrement
  pCounter  = repeatTimes
if voidP(pCurrentPan) then pCurrentPan = the pan of sprite (me.spritenum)
  (the actorlist).deleteOne(me)
  (the actorlist).add(me)
end roboPan

on stepframe me
  pCurrentPan = pCurrentPan + pIncrement
  the pan of sprite(me.spritenum) = pCurrentPan
  pCounter = pCounter - 1
  if  pCounter < 1 then (the actorlist).deleteOne(me)
end
------------------





still this is a bad solutiuon as it will perform at different speed on different computers. better is a time based solution, where you specify a target pan and how much time it shall take until that target pan is reached.
the time can be relative => the higher the pan delta the longer it takes
or absolut => take xy seconds to reach the specified pan. if the way to pan is long pan fast and otherwise pan slow.



---------------------------------------------------
----------------- time based behavior
property pPanSpeed
property pAnimationList

---------------------------------------------------

on beginsprite me
  pPanSpeed = pPanSpeed / 360. -- time in ms for one unit
  pAnimationList = [:]
end

---------------------------------------------------

on getpropertyDescriptionList
  retlist = [:]
retlist[#pPanSpeed] = [#default:5000, #format:#integer, #comment:"Pan speed in milliseconds"]
  return retlist
end

---------------------------------------------------

on roboPan me, panTo, panTime
  if ilk(panTime)  <> #integer then
-- absolut time, we move at the speed specified in the GPDL -> pPanSpeed for one complete turnaround
    panTime = abs(panTo - sprite(me.spritenum).pan) * pPanSpeed
  end if
  pAnimationList.setaprop(#duration, float(panTime))
  pAnimationList.setaprop(#starttime, the milliseconds)

  currPan = sprite(me.spritenum).pan
  pAnimationList.setaprop(#startValue, currPan )
  pAnimationList.setaprop(#delta, (panTo - currPan ))

  (the actorlist).deleteOne(me)
  (the actorlist).add(me)
end roboPan

---------------------------------------------------

on stepframe me
perc = (the milliseconds - pAnimationList.getaprop(#starttime)) / pAnimationList.getaprop(#duration)

-- if you want you can apply some dynamics calc here for example ease in with cos()
  -- perc = 1 - cos(pi()/2 * perc)

  if perc > 0 or perc = 0 then
sprite(me.spritenum).pan = pAnimationList.getaprop(#startValue) + pAnimationList.getaprop(#delta)
    pAnimationList = [:]
    (the actorlist).deleteOne(me)
  else
sprite(me.spritenum).pan = pAnimationList.getaprop(#startValue) + (perc * pAnimationList.getaprop(#delta))
  end if
end
---------------------------------------------------
---------------------------------------------------





and now you can either:

sendSprite(xy, #roboPan, 120, 1000)

to animate the pan in 1 second to pan 120

or
sendSprite(xy, #roboPan, 120)

to animate the pan to 120 at the fixed speed defined in the GPDL


Please beware, that this is email lingo, which I typed right away. I leave the testing and debugging to you. just to give you an idea...



HTH





---------------------------

  |||
a¿ex







[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!]

Reply via email to