Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: Time doesn't run out  (Read 2598 times)

0 Members and 1 Guest are viewing this topic.

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Time doesn't run out
« on: February 15, 2009, 06:09:33 AM »

I have a timed scene which works fine as long as you finish before the time doesn't run out.  The problem is that the time just doesn't run out--the timer doesn't work.

Code: WME Script
  1. var timer=6;
  2. timer = timer -1
  3. {
  4.   if(!(timer == 0))
  5. {
  6.         Game.Msg("Countdown: " + timer);
  7.         Sleep(1000);
  8. }
  9. else
  10. {
  11.   if(timer == 0)
  12. {
  13.           Sleep(50);
  14.           Game.ChangeScene("scenes\Vacation_House\Vacation_House.scene");
  15. }
  16. }
  17. }
  18.  

I don't get any script error but the scene doesn't change when the time runs down.

Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Time doesn't run out
« Reply #1 on: February 15, 2009, 06:30:12 AM »

If I use this code:

Code: WME Script
  1. for (var timer=50;timer>-1;timer = timer -1) 
  2. {
  3.         Game.Msg("Countdown: " + timer);
  4.  
  5. }
  6.  
  7. if (timer=0) 
  8. {
  9. Sleep(50);
  10. Game.ChangeScene("scenes\Vacation_House\Vacation_House.scene");
  11. }
  12.  
  13.  

Everything works the way I'd like it to but I get a script error asking me why I didn't use == instead of = in the bit if(timer=0).
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Time doesn't run out
« Reply #2 on: February 15, 2009, 06:53:24 AM »

Well, I got this to work perfectly:

: )

Code: WME Script
  1. for (var timer=50;timer>=1;timer = timer -1)
  2. {
  3.         Game.Msg("Countdown: " + timer);
  4.         Sleep(3000);
  5. }
  6.  
  7. if (timer==0) 
  8. {
  9. Sleep(50);
  10. Game.PlayMusicChannel(0,"Music\IngridVictoria'sTheme.ogg",true);
  11. Game.ChangeScene("scenes\Vacation_House\Vacation_House.scene");
  12. }
  13.  

:  )

You cannot imagine how happy I was.  :  )
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  
 

Page created in 0.082 seconds with 24 queries.