Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: Kaz on March 06, 2010, 12:58:03 PM

Title: Can't control video in an entity container
Post by: Kaz on March 06, 2010, 12:58:03 PM
Hi all

In a window there is an entity and in the entity a video runs using PlayTheora(). But most other instructions in the script seem to be ignored and so I can't control the video.

What am I doing wrong? Here's the code from the entity script.

Cheers

Code: [Select]
this.Interactive = true; // Redundant, as Entity already has Active=TRUE
this.SetCursor("sprites\system\ArberthCursors\Action2.sprite"); // NOT executed
//
while(PDA.GoVideo != true) // wait until you're told to play
  {
  Game.Msg("Waiting to start video"); // Works
  Sleep(20);
  }
var a = PDA.Call;  // which video to play?
if(PDA.Call != null)
  {
  if(a =="Tony01")
    {
this.PlayTheora("interface\PDA\Oggs\Tony1.ogg"); // Works
}
  while(this.IsTheoraPlaying())
    {
    Game.Msg("Entity waiting for the video to end"); // TEST - works
    Sleep(20);
    }
  }
PDA.GoVideo = null; // hand control back to the window - works
//
// EVENTS, all ignored
on "LeftClick"
  {
  Game.Msg("LeftClick detected"); // NOT executed
  }
on "MouseEntry"
  {
  this.PauseTheora(); // NOT executed
  }
on "MouseLeave"
  {
  this.ResumeTheora(); // NOT executed
  }
 
Title: Re: Can't control video in an entity container
Post by: Kaz on March 07, 2010, 11:55:38 AM
Hi all

Stumbled upon a post by Metamorphium that said it can't be done, that Theoras can't be made interactive. The answer is to superimpose an interactive region above the entity displaying the ogg. His example, using a scene, refers the the dynamic creation of an entity. I'm using a window, so I added a button and that works as well.

Code: [Select]
on "Button"
  {
  // var Video = this.GetControl("Video");  // for completeness only - actually happens elsewhere in script
  if(Video != null)
    {
    var v = Video.GetEntity();
    if(v.IsTheoraPlaying())
      {
      v.StopTheora();
      PDA.GoVideo = null;  // just my control variable
      }
    }
  }