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

#1 2010-06-06 22:06:54

minadoan
Scratcher
Registered: 2010-06-06
Posts: 10

Work on timer??????

Hey guys, can you help me with the timer, please?

My game requires: Start the timer when the question begins (not when flag clicked). In 50 seconds, the player needs to do as much questions as they can. After 50 seconds, the timer will stop then hide. The game displays score.

What I did: I make a variable named "time"> Reset timer> Set "time" to timer > Set time to 0 >

The problem is :
_ At the beginning of the game, I don't need the timer and it still shows up.
_ Don't know how to get the timer stop > No idea how to displays score after 50 seconds.
_ The timer doesn't hide when displays score.

Please help me, thank you :-)

Offline

 

#2 2010-06-06 22:27:10

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Work on timer??????

I'd forget the timer entirely and use this:

[blocks]<when I receive[ question
<set{ time }to( 0
<repeat( 50
<change{ time }by( 1
<wait( 1 )secsc>
<end>[/blocks]
then do the score stuff here.

Last edited by ScratchReallyROCKS (2010-06-06 22:27:34)


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#3 2010-06-06 22:39:24

minadoan
Scratcher
Registered: 2010-06-06
Posts: 10

Re: Work on timer??????

oh sorry, I thought my internet doesn't work so I post like 2-3 questions like that TT

Offline

 

#4 2010-06-07 03:35:35

minadoan
Scratcher
Registered: 2010-06-06
Posts: 10

Re: Work on timer??????

I already get how to start the time. However, I couldn't get it stop after time to 50 seconds. Another problem is that I don't know how to HIDE it at the beginning of the game because it suppose to appears only when the player is answering questions TT PLEASE help [crying]

Offline

 

#5 2010-06-07 04:42:24

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

Re: Work on timer??????

minadoan wrote:

I already get how to start the time. However, I couldn't get it stop after time to 50 seconds. Another problem is that I don't know how to HIDE it at the beginning of the game because it suppose to appears only when the player is answering questions TT PLEASE help [crying]

The timer has a few issues.  It doesn't hide and it doesn't stop.  Try making a variable and setting it to the timer in a Forever loop - then work with the variable instead.  You can hide a variable and you can stop changing it's value:

[blocks]
<when green flag clicked>
hide variable Time <=== sorry there's no forum block for this command

<when I receive[ Show Answer Timer
<reset timer>
show variable Time  <=== sorry there's no forum block for this command
<forever if> <( <timer> <<> 50 )
<set{ Time  }to( <timer>
<end>
[/blocks]

That might do what you want.  Be aware, though, that there is a bug in the online Java player with hidden variables.  They need to be showing when the project is shared or they won't work right.  So you might have to play some games with the Hide/Show scripts to make sure that happens.


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

Offline

 

#6 2010-06-07 14:41:21

scratch_yoshi
Scratcher
Registered: 2009-06-12
Posts: 1000+

Re: Work on timer??????

Paddle2See wrote:

minadoan wrote:

I already get how to start the time. However, I couldn't get it stop after time to 50 seconds. Another problem is that I don't know how to HIDE it at the beginning of the game because it suppose to appears only when the player is answering questions TT PLEASE help [crying]

The timer has a few issues.  It doesn't hide and it doesn't stop.  Try making a variable and setting it to the timer in a Forever loop - then work with the variable instead.  You can hide a variable and you can stop changing it's value:

[blocks]
<when green flag clicked>
hide variable Time <=== sorry there's no forum block for this command

<when I receive[ Show Answer Timer
<reset timer>
show variable Time  <=== sorry there's no forum block for this command
<forever if> <( <timer> <<> 50 )
<set{ Time  }to( <timer>
<end>
[/blocks]

That might do what you want.  Be aware, though, that there is a bug in the online Java player with hidden variables.  They need to be showing when the project is shared or they won't work right.  So you might have to play some games with the Hide/Show scripts to make sure that happens.

*facepalm* he/she already MADE a variable named "timer"! He/she is trying to find how to hide his/her own variables, and helped with that.


Retired from Scratch, but just the language itself. Not the forums.

Offline

 

#7 2010-06-07 22:14:25

minadoan
Scratcher
Registered: 2010-06-06
Posts: 10

Re: Work on timer??????

What I did was : Reset timer > Set Time to timer > Set Time to 0 > Repeat until timer = 50 >>> Questions >>> next costume

@ Paddle to see: I try to put the "Forever If" after the questions and it doesn't work. I also try to put <the questions and set time to timer> INSIDE the "Forever If"..... and it still does not works. And I have no idea why :-(

Do you think there is another tool and can replace the timer??
Do anyone have any idea ???

Offline

 

#8 2010-06-07 22:17:33

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Work on timer??????

minadoan wrote:

What I did was : Reset timer > Set Time to timer > Set Time to 0 > Repeat until timer = 50 > Questions > next costume

@ Paddle to see: I try to put the "Forever If" after the questions and it doesn't work. I also try to put <the questions and set time to timer> INSIDE the "Forever If"..... and it still does not works. And I have no idea why :-(

Do you think there is another tool and can replace the timer??
Do anyone have any idea ???

If you make a completely seperate script for the questions, the time variable should update itself properly - the issue now seems to be that the answers are stalling the update of the time variable.

Offline

 

#9 2010-06-07 22:34:57

minadoan
Scratcher
Registered: 2010-06-06
Posts: 10

Re: Work on timer??????

Sorry for didn't tell you guys. Before the questions, I asks the player if they are ready to start now.
_ If they answer yes: next costume (explain the game) > start question
_ If no: switch the costume game over

If I seperate the questions into an individual script, then how can I start it on time ? I have tried like this: When I receive "yes" > start questions (and it doesn't work TT)

Offline

 

#10 2010-06-07 22:38:11

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Work on timer??????

I can probably make a sample project for you tomorrow, if you'd like. That way you won't have to deal with all the hassles of programming it and sorting out bugs yourself.

Offline

 

#11 2010-06-08 00:08:32

minadoan
Scratcher
Registered: 2010-06-06
Posts: 10

Re: Work on timer??????

THANKS ALOT!
My email is [email removed by Forum Moderator - please don't post personal information] if you want to send by mail. Thank you!

Last edited by Paddle2See (2010-06-08 04:17:07)

Offline

 

#12 2010-06-08 16:15:20

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Work on timer??????

Here you go: http://scratch.mit.edu/projects/coolfixit/1108959
Everything is explained in the project. If you need any help, just ask.

Offline

 

Board footer