Discuss Scratch

MeDiaMond
Scratcher
500+ posts

Ask and wait for () secs block

Now there's only this block:
ask [] and wait
But sometimes if you want to have a time limit for each question it'd be useful if there'd be a block like this:
ask [] and wait for () secs
I know you could replace this block but it's quite expensive cause you need many scripts then.
Please tell me what you think about this!
ExtremeLogic
Scratcher
500+ posts

Ask and wait for () secs block

What if someone doesn't answer in time or just leaves it blank? The answer would be blank?
Also, if there were some letters/words/numbers in the answer box and the amount of time given has passed, what would happen?

MeDiaMond
Scratcher
500+ posts

Ask and wait for () secs block

If you haven't pressed enter or clicked the checkmark, then the box would dissapear and th answer would be blank cause you didn't finished in time.
ExtremeLogic
Scratcher
500+ posts

Ask and wait for () secs block

Support, I guess.

AonymousGuy
Scratcher
1000+ posts

Ask and wait for () secs block

MeDiaMond wrote:

If you haven't pressed enter or clicked the checkmark, then the box would dissapear and th answer would be blank cause you didn't finished in time.
I think it should keep whatever was in the box, because otherwise that would be too project-specific. (And because there are more uses for whatever was in the box than a blank answer.)
MeDiaMond
Scratcher
500+ posts

Ask and wait for () secs block

AutumnFairy
New to Scratch
6 posts

Ask and wait for () secs block

I need help!!! How do you create that block? It's the most important thing to my game.
jromagnoli
Scratcher
1000+ posts

Ask and wait for () secs block

AutumnFairy wrote:

I need help!!! How do you create that block? It's the most important thing to my game.
It doesn't exist…




ROAD TO 10,000 POSTS
████████████████████████████████████████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 64%










If you can read this, my signature cubeupload has been eaten by an evil kumquat!
hehehe!Mytiptopsecrettopicidentifier!ahjdgggfhjadggahjsahasgdjfsdjfga

WolfCat67
Scratcher
1000+ posts

Ask and wait for () secs block

jromagnoli wrote:

AutumnFairy wrote:

I need help!!! How do you create that block? It's the most important thing to my game.
It doesn't exist…
I'm pretty sure they want a workaround instead…

jromagnoli
Scratcher
1000+ posts

Ask and wait for () secs block

WolfCat67 wrote:

jromagnoli wrote:

AutumnFairy wrote:

I need help!!! How do you create that block? It's the most important thing to my game.
It doesn't exist…
I'm pretty sure they want a workaround instead…
Oh, @thelogfather has a project.

Last edited by jromagnoli (March 26, 2017 21:10:56)





ROAD TO 10,000 POSTS
████████████████████████████████████████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 64%










If you can read this, my signature cubeupload has been eaten by an evil kumquat!
hehehe!Mytiptopsecrettopicidentifier!ahjdgggfhjadggahjsahasgdjfsdjfga

TheLogFather
Scratcher
1000+ posts

Ask and wait for () secs block

jromagnoli wrote:

Oh, @thelogfather has a project.
I definitely would not recommend that method any longer.

Since v450 of the Scratch player, it's been possible to remove an Ask prompt by using “stop other scripts in sprite”, or by asking in a clone and then deleting the clone:


https://scratch.mit.edu/projects/121963968/


An "ask [something] and wait N secs" block has a serious issue in that it's not at all obvious what to do in the scripting that follows that block, because you don't know whether the ask was answered or it just timed out! – and what should “answer” contain if it times out?


The two methods I give above (using a clone, or “stop other scripts”) do not have such a problem, for two reasons:

(1) it's *you* who has *chosen* to remove the ask prompt using another script, so you control what happens;
(2) the script that was running the ask has ended, so blocks after it are irrelevant.

Last edited by TheLogFather (March 27, 2017 14:57:46)


Siggy the Kumquat slayer:
Main account: DadOfMrLog –– Frameworks for basic pen-rendered 3D in scratch (see studio). Examples:

- - - - 3D Text - - - - - - Simple shapes - - - Controllable structures - - - On the ground - - - - - - In space - - - -

NOONEWASHERE
Scratcher
95 posts

Ask and wait for () secs block

MeDiaMond wrote:

Now there's only this block:
ask [] and wait
But sometimes if you want to have a time limit for each question it'd be useful if there'd be a block like this:
ask [] and wait for () secs
I know you could replace this block but it's quite expensive cause you need many scripts then.
Please tell me what you think about this!
define ask and wait for secs
say [question] for (2) secs



TheAdriCoolManDude
Scratcher
1000+ posts

Ask and wait for () secs block

NOONEWASHERE wrote:

MeDiaMond wrote:

Now there's only this block:
ask [] and wait
But sometimes if you want to have a time limit for each question it'd be useful if there'd be a block like this:
ask [] and wait for () secs
I know you could replace this block but it's quite expensive cause you need many scripts then.
Please tell me what you think about this!
define ask and wait for secs
say [question] for (2) secs
Don't blockspam.


DaEpikDude
Scratcher
1000+ posts

Ask and wait for () secs block

TheAdriCoolManDude wrote:

NOONEWASHERE wrote:

MeDiaMond wrote:

Now there's only this block:
ask [] and wait
But sometimes if you want to have a time limit for each question it'd be useful if there'd be a block like this:
ask [] and wait for () secs
I know you could replace this block but it's quite expensive cause you need many scripts then.
Please tell me what you think about this!
define ask and wait for secs
say [question] for (2) secs
Don't blockspam.
I think they're trying to offer a workaround even though that's not a workaround

And all the world over, each nation's the same,
They've simply no notion of playing the game.
They argue with umpires, they cheer when they've won,
And they practice beforehand, which ruins the fun!
red_king_cyclops
Scratcher
500+ posts

Ask and wait for () secs block

Here's a workaround:

when green flag clicked //example code
say [Question!] for (2) secs
ask [What's your favourite colour?] and wait for (5) secs::custom
say (join (answer::variables) [ is a cool colour.]) for (2) secs

define ask (question) and wait for (secs) secs
delete (all v) of [chars v]
say (question::custom)
reset timer
repeat until <<(timer) = (secs::custom)> or <(timer) > (secs::custom)>>
if <key [a v] pressed?> then
add [a] to [chars v]
end
if <key [b v] pressed?> then
add [b] to [chars v]
end
if <key [c v] pressed?> then
add [c] to [chars v]
end
...
end
set [answer v] to (chars::list)
say [Question done!] for (2) secs
However, this workaround is too long to be very practical, so support.

2+2=4
2*2=4
2^2=4
2^^2=4
2^^^2=4
2^^^^2=4

I see a pattern.
TheAdriCoolManDude
Scratcher
1000+ posts

Ask and wait for () secs block

Support, it would be useful for games where you answer questions in a certain amount of time.


ScratchDiogoh
Scratcher
1000+ posts

Ask and wait for () secs block

support, this can be useful for time trial quiz
1700 post

+1700 Bad Posts
Not_Me_You_Me_Me
Scratcher
100+ posts

Ask and wait for () secs block

As stated by the TheLogFather, having a clone ask and then deleting it will remove the prompt. So, something like this should work:
when I start as a clone
broadcast [Timer v]
ask [What's your favorite color?] and wait
...:: grey

when I receive [Timer v]
wait (10) secs
delete this clone

<~^w^~::operators>// This is predicat, she protects me from evil kumquats and also people who think she's called a boolean.
TheLogFather
Scratcher
1000+ posts

Ask and wait for () secs block

Not_Me_You_Me_Me wrote:

As stated by the TheLogFather, having a clone ask and then deleting it will remove the prompt. So, something like this should work…
You can avoid the broadcast by using a second “when I start as a clone” script. Also, you might want to prevent the “delete this clone” from happening straight after the 10s timeout if the response is in the clone and it will take some time (e.g. if it's saying something for a few secs):
when I start as a clone
ask [What's your favorite color?] and wait
stop [other scripts in sprite v] // to stop the script below from deleting this clone on timeout
whatever to do in response to the (answer) given...:: grey
delete this clone // probably delete the clone once done
when I start as a clone
wait (10) secs
delete this clone // time's up!

Or, if you want to do other things after the time's up:
when I start as a clone
ask [What's your favorite color?] and wait
stop [other scripts in sprite v] // to stop the script below from deleting this clone on timeout
whatever to do in response to the (answer) given...:: grey
delete this clone // probably delete the clone once done
when I start as a clone
wait (10) secs
stop [other scripts in sprite v] // this stops above script and removes the ask prompt
whatever to do when time is up... :: grey
delete this clone


Here's an alternative way that doesn't use any clones (instead, it makes use of a ‘quirk’ of broadcast – re-sending a broadcast will terminate and restart any receiver script still running from the previous broadcast, and any ask prompt it was showing gets removed when the script terminates):

set [question v] to [What's your favourite colour?]
set [timeout v] to ((timer)+(10)) // timeout in ten seconds from now
broadcast [start/stop asking v] // this shows question since timeout got set to >timer above
wait until <(timeout)<(timer)> // wait for timeout, or for answer
if <(timeout)=[0]> then // got an answer before timeout
whatever to do in response to (answer) given... :: grey
else
broadcast [start/stop asking v] // took too long, this makes ask prompt go away
whatever else to do when time is up... :: grey
end
when I receive [start/stop asking v] // re-sending broadcast removes ask prompt if still showing since last broadcast
if <(timeout)>(timer)> then // want to ask a (new) question
ask (question) and wait
set [timeout v] to [0] // tell above script that we got an answer before timeout
end


Finally, I'll note that the problem with the suggestion of an "ask [question] and wait (N) secs" block is that you don't know what blocks should come after it – you don't know if the reason the ask block finished was because the time was up or because the user gave an answer. Unless there's some new way to gain that information (e.g. a new block, such as <ask timed out?>, or the (answer) block gives some ‘special’ value that means timeout [but which then cannot be typed as an answer]).

Last edited by TheLogFather (Sept. 5, 2018 11:24:53)


Siggy the Kumquat slayer:
Main account: DadOfMrLog –– Frameworks for basic pen-rendered 3D in scratch (see studio). Examples:

- - - - 3D Text - - - - - - Simple shapes - - - Controllable structures - - - On the ground - - - - - - In space - - - -

Steve0Greatness
Scratcher
1000+ posts

Ask and wait for () secs block

PoIygon wrote:

BUTT (bump up this topic)
you know, need more posts

/hj is the worst tone indicator. It's confusing and ambiguous. I hate it. The point of tone indicators is to indicate tone, or the way that a piece of text should be read, but what does “half joking” mean? Do you just wake up in the morning and think “wow, I really have something I want to talk about seriously but also kinda not, IDK you decide.” It's useless. I hate it. It just provokes a deep rooted anger within me whenever I see it. People just comment /hj as if it makes any sense. It doesn't. Oh wow, it's a tone indicator that's has a relative meaning, how useful, I'll use it in every comment I post. NO. STOP IT. You're a tone indicator, you have only one job, and yet you sit there doing nothing apart angering me.

/srs

^^^ (there's more below)
This one is useful because it tells you that this signature is fully 100% serious. (/srs) Who would've thought that tone indicators needed to tell you something about the piece of text they're attached to? /s

I'm serious, I'm not even going to put multiple (/hj)s a the end of my signature as to mock the previous paragraph for not getting the point of something(like previous version of my signature). /srs

Powered by DjangoBB