Discuss Scratch

jamol91
Scratcher
1 post

How to ask and wait number of seconds?

I want my scratch to ask a question and wait for user answer a given number of seconds and give next question. There is ask and wait block in Sensing but I cannot set how many seconds it is allowed to wait. Any workarounds? Please help.

Last edited by jamol91 (April 22, 2014 13:08:18)

GoldeScratcher
Scratcher
34 posts

How to ask and wait number of seconds?

I'm not sure if there is a way to do this, but I'll check it out.
drmcw
Scratcher
1000+ posts

How to ask and wait number of seconds?

You can't do that with the ask block, only the user can end an ask block by pressing enter or clicking the tick. You'd have to write your own ask block to achieve that.
Tramcrazy
Scratcher
100+ posts

How to ask and wait number of seconds?

Instead of using the ask block try using something like this. For an explanation look at the workaround section of this wiki page. then just stop the script after the given time.
MeDiaMond
Scratcher
500+ posts

How to ask and wait number of seconds?

You can do it this way I think:
whenclickedaskQuestion ?andwait

whenclickedwait10secsstopscript 1
It's a bit expensive cause you need one script for each question but it should be possible…
I hope this helps. Good luck!
MasterCard786
Scratcher
100+ posts

How to ask and wait number of seconds?

MeDiaMond wrote:

You can do it this way I think:
whenclickedaskQuestion ?andwait

whenclickedwait10secsstopscript 1
It's a bit expensive cause you need one script for each question but it should be possible…
I hope this helps. Good luck!

This is the best you can do.
You cannot go to the next question! Unless you have different sprites and each sprite says a different question but that would still leave the writing down answer thingy still there.
TheLogFather
Scratcher
1000+ posts

How to ask and wait number of seconds?

The only way to get rid of ask-and-wait from script is with “stop all”. Not exactly useful…

Personally, I'd like to see it go away when a script in the same sprite reaches “stop other scripts in sprite” - that would be kinda handy, and I suspect it would break hardly any existing projects if that change was made…

However, there is a way to work around the current limitation using the timer - I've just thrown together a little demo project:

http://scratch.mit.edu/projects/21056899/

Enjoy!

Last edited by TheLogFather (April 22, 2014 21:38:05)

MeDiaMond
Scratcher
500+ posts

How to ask and wait number of seconds?

I suggested a ask and wait for () secs block. Here's the link: http://scratch.mit.edu/discuss/topic/36583/?page=1#post-305847
cooldude5367
Scratcher
100+ posts

How to ask and wait number of seconds?

whenclickedwait...secs

or:

whenclickedaskquestion?andwait
yaymeiwin
Scratcher
52 posts

How to ask and wait number of seconds?


whenclickedbroadcastTimeraskDo you like dancing?andwait
whenIreceiveTimerwaitUrtimeheresecsstopother scripts in sprite
QuinnD2006
Scratcher
38 posts

How to ask and wait number of seconds?

hey what if you did
whenclickedsetvaribleaskto1foreverifvalueask=1doaskwhatisyournameandwaitincresevalueaskby1elseifask=2doaskhowoldareyouandwaitbadgrammer

Last edited by QuinnD2006 (Aug. 4, 2015 20:42:44)

BF10
Scratcher
500+ posts

How to ask and wait number of seconds?

QuinnD2006 wrote:

hey what if you did
whenclickedsetvaribleaskto1foreverifvalueask=1doaskwhatisyournameandwaitincresevalueaskby1elseifask=2doaskhowoldareyouandwaitbadgrammer/quoteNecrobump.
julianandwill
Scratcher
500+ posts

How to ask and wait number of seconds?

You could do just this:
whenclickedaskDo you like tacos?andwaitwaithowevermuchtimesecs
coke11
Scratcher
1000+ posts

How to ask and wait number of seconds?

Try this:

whenclickedaskHow many secondsandwaitsayHiforanswersecs

That should work!
deck26
Scratcher
1000+ posts

How to ask and wait number of seconds?

coke11 wrote:

Try this:

whenclickedaskHow many secondsandwaitsayHiforanswersecs

That should work!
That's not what was asked for. They wanted the question to only be asked for a limited time, not the answer only being shown for a limited time.
coke11
Scratcher
1000+ posts

How to ask and wait number of seconds?

Oh like this sorry i did not understand 1st:

whenclickedaskHow many seconds questionsandwaitset(answer)tosecondswaitsecondssecsaskWhat is your best friends nameandwaitwaitsecondssecsaskWhat is your scratch usernameandwait
coke11
Scratcher
1000+ posts

How to ask and wait number of seconds?

deck26 wrote:

coke11 wrote:

Try this:

whenclickedaskHow many secondsandwaitsayHiforanswersecs

That should work!
That's not what was asked for. They wanted the question to only be asked for a limited time, not the answer only being shown for a limited time.

Oh i don't know then.
BF10
Scratcher
500+ posts

How to ask and wait number of seconds?

Two scripts, like this?


whenclickedaskandwait


whenclickedwaitsecsstopother scripts in this spritesayToo Late!
TheLogFather
Scratcher
1000+ posts

How to ask and wait number of seconds?

As I said above, there is currently only *one way* to remove ask-and-wait…

Other suggestions above have included “stop other scripts in sprite”.
This will not work.

Another idea that you might think to try would be to ask in a different clone, then delete that clone.
That also does not work.

I would like to see Scratch changed so that both of above *do* work, since you would intuitively expect them to.

However, until then, if you want to create a cancel button for ask-and-wait, or show it for a limited time, you have to use “stop all”, unfortunately.

(I've suggested this topic be closed, since it has been answered.)

Last edited by TheLogFather (Aug. 8, 2015 09:24:28)

coke11
Scratcher
1000+ posts

How to ask and wait number of seconds?

Wait you could try this:

whenclickedaskHow old are you?andwaitwait10secsstopthis scripit

Powered by DjangoBB