This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-07-13 15:35:01

Yargleman
Scratcher
Registered: 2008-07-12
Posts: 6

little question about the timer.

i no this is stupid but how do u make the timer stop after all the commands stop (when the game is over: When my cow trun into the object) I would like to be able for the timer to stop and to be able to see what time i got.


the stop all button dont seem2  work though.

thanks

Last edited by Yargleman (2008-07-13 15:59:04)

Offline

 

#2 2008-07-13 15:41:16

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: little question about the timer.

<stop all>  is one way to do it. Another would be:

<if><( <{ Timed  }>  <=> 1 )>
<reset timer>
<stop script>


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#3 2008-07-13 15:50:51

Zelda123
Scratcher
Registered: 2007-11-21
Posts: 1000+

Re: little question about the timer.

Bluestribute wrote:

Another would be:

<if><( <{ Timed  }>  <=> 1 )>
<reset timer>
<stop script>

This would set the timer to 0 and you wouldn't be able to see what the timer was set at.

Offline

 

#4 2008-07-13 15:51:39

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: little question about the timer.

Zelda123 wrote:

Bluestribute wrote:

Another would be:

<if><( <{ Timed  }>  <=> 1 )>
<reset timer>
<stop script>

This would set the timer to 0 and you wouldn't be able to see what the timer was set at.

You would broadcast first and than change the variable. It would happen after the point you want it to reset


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#5 2008-07-15 02:30:51

Yargleman
Scratcher
Registered: 2008-07-12
Posts: 6

Re: little question about the timer.

bump

Offline

 

#6 2008-07-15 02:53:57

Yargleman
Scratcher
Registered: 2008-07-12
Posts: 6

Re: little question about the timer.

further bump

Offline

 

#7 2008-07-15 12:12:30

Yargleman
Scratcher
Registered: 2008-07-12
Posts: 6

Re: little question about the timer.

cmon plz

Offline

 

#8 2008-07-15 12:46:13

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: little question about the timer.

Funny discovery, Yargleman!

I never noticed that the timer doesn't stop once the red stop button is pressed (or the according block invoked), but I guess that's quite intentional (after all, time never stops, doesn't it?). If I were you I'd try saving the elapsed time to a variable instead of displaying the timer itself on the stage (that might have been what Bluestribute actually meant).

You could reset the timer when a game starts:

[blocks]
<when I receive[ new game
<reset timer>
[/blocks]

Once the game is over you could make a 'snapshot' of the timer:

[blocks]
<when I receive[ game over
<set{ elapsed time }to( <timer>
<say[ this game took ]for( 1 )secs>
<say[ <{ elapsed time }> ]for( 1 )secs>
<say[ seconds
[/blocks]

Another idea would be to also reset the 'elapsed time' variable each time a new game commences and setting it to the timer during a loop that stops once the game is over. That way you could always show the 'elapsed time' variable on the stage and watch it while playing.

Hope that helps...


Jens Mönig

Offline

 

#9 2008-07-15 12:49:32

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: little question about the timer.

Jens wrote:

If I were you I'd try saving the elapsed time to a variable instead of displaying the timer itself on the stage (that might have been what Bluestribute actually meant):

Actually, I DID use a variable, but it "stopped" the timer by using a variable. But your way seems better. Actually, a lot better


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#10 2008-07-15 13:42:17

registeel
Scratcher
Registered: 2008-04-27
Posts: 500+

Re: little question about the timer.

Use a variable by every 1 second it increases by 1  tongue  AND DON'T FORGET!
<when green flag clicked>
<set{ timer  }to(  0

So it should look like this!
<when green flag clicked>
<set{ Timer }to( 0 )
<forever>
<change{ Timer  }by( 1 )
<end>

Last edited by registeel (2008-07-15 13:47:10)

Offline

 

#11 2008-07-15 13:56:24

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: little question about the timer.

registeel wrote:

Use a variable by every 1 second it increases by 1  tongue  AND DON'T FORGET!
<when green flag clicked>
<set{ timer  }to(  0

So it should look like this!
<when green flag clicked>
<set{ Timer }to( 0 )
<forever>
<change{ Timer  }by( 1 )
<end>

That's what I usually do to.  It works just fine, and it stops when you want it to!


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#12 2008-07-15 14:00:37

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: little question about the timer.

Good idea, registeel! I think you should add a 'wait 1 sec' block into the forever loop, though...


Jens Mönig

Offline

 

#13 2008-07-15 14:01:34

newareagle
Scratcher
Registered: 2008-06-10
Posts: 100+

Re: little question about the timer.

Paddle2See wrote:

registeel wrote:

Use a variable by every 1 second it increases by 1  tongue  AND DON'T FORGET!
<when green flag clicked>
<set{ timer  }to(  0

So it should look like this!
<when green flag clicked>
<set{ Timer }to( 0 )
<forever>
<change{ Timer  }by( 1 )
<end>

That's what I usually do to.  It works just fine, and it stops when you want it to!

I find that the time is a bit off, even if you do the wait 1 second, just because the timing is off.


My Guitar Hero Game.
8/9 Projects on the Front Page at Once!

Offline

 

#14 2008-07-15 14:15:41

Zelda123
Scratcher
Registered: 2007-11-21
Posts: 1000+

Re: little question about the timer.

Jens wrote:

Good idea, registeel! I think you should add a 'wait 1 sec' block into the forever loop, though...

registeel added to wait 1 sec at the top.

Offline

 

#15 2008-07-15 15:01:26

Yargleman
Scratcher
Registered: 2008-07-12
Posts: 6

Re: little question about the timer.

cheers guys

Offline

 

#16 2008-07-15 15:17:09

registeel
Scratcher
Registered: 2008-04-27
Posts: 500+

Re: little question about the timer.

Jens wrote:

Good idea, registeel! I think you should add a 'wait 1 sec' block into the forever loop, though...

Woops i forgot to do that  tongue

Offline

 

#17 2008-07-15 18:17:35

Rurigok
Scratcher
Registered: 2008-01-24
Posts: 93

Re: little question about the timer.

If the variable timer is off, try changing it to somewhere bewteen wait 0.9 or 0.99


Creator of Imperion Online(a MMO)
ImperionOnline/Cyclone103's forums.

Offline

 

Board footer