Skip Intro with a key?

Posted By: Deha

Skip Intro with a key? - 04/19/10 12:22

Hi everyone!

i have a problem with skipping a intro movie-file.
i want to skip my intro with a special key like spacebar or something else, but i don't know how.Is there a skip function in 3dgs? I could not find something in the manual.

"media_stop" would only stop my media but not skip i think..so any idea?

the function have to look like something like this i think:

if ((key_space) && spacebar_clear)
{
...(?)
}

[Sorry for my english]

Greetings
Posted By: Lukas

Re: Skip Intro with a key? - 04/19/10 12:41

Well, I guess while you are playing your video, you have a loop like this:

while(media_playing(yourhandle)) wait(1);

If you use media_stop, it should also cancel your loop.
Posted By: Deha

Re: Skip Intro with a key? - 04/19/10 14:16

My function(short form)

var x

function start_program()
{ mouse_mode = 0;
wait(1);
freeze_mode = 1;
media_play("intro.wmv",NULL,100);
wait(999);
wait(999);
wait(999);
wait(999);
wait(999);
wait(999);
wait(999);
wait(999);
wait(39);
media_stop(x);
freeze_mode = 0;
set(loadingscreen_panel, SHOW);
...
}

I know it is not a really clean programming code, but it works! laugh
Where do i have to paste the 'if (key_space) then media_stop'?
After media_play? need help please...:(
Posted By: Lukas

Re: Skip Intro with a key? - 04/19/10 14:19

OMFG...

Replace all that wait(999) lines by the loop I posted above.

Also, note that those wait(999) are waiting a number of frames, not a given time, which means it can continue before the video is finished or continue too late.
Posted By: MrGuest

Re: Skip Intro with a key? - 04/19/10 14:41

Originally Posted By: Lukas
Well, I guess while you are playing your video, you have a loop like this:

while(media_playing(yourhandle)) wait(1);

If you use media_stop, it should also cancel your loop.
how does that exactly skip or stop anything using spacebar?

try something like
Code:
void game_start(){
   
}

void game_intro(){
  
  var hnd_intro = media_play("intro.wmv",NULL,100);
  while(media_playing(hnd_intro) && (!key_space)){
    wait(1);
  }
  game_start();
}

void main(){
  //...blah
  wait(1);
  game_intro();
}

hope this helps

*untested*
Posted By: Lukas

Re: Skip Intro with a key? - 04/19/10 14:45

"how does that exactly skip or stop anything using spacebar?"

If he uses an other function that calls media_stop, media_playing(yourhandle) becomes zero and the loop stops. wink
© 2024 lite-C Forums