Discuss Scratch
- Discussion Forums
- » Suggestions
- » Ask and Wait but with Numbers
- sportfan999
-
1000+ posts
Ask and Wait but with Numbers
You probably know the "ask and wait" block;
The block will look like this:
If this is a dupe, I'm sorry, but there was nothing like this when I was looking for dupes.
ask [] and waitbut I am suggesting one where you can only do numbers.
The block will look like this:
ask [] and wait for numbers::sensingand whenever it happens in a script, a keypad will pop up on the screen with the numbers 0-9.
If this is a dupe, I'm sorry, but there was nothing like this when I was looking for dupes.
- p2Ep2E
-
57 posts
Ask and Wait but with Numbers
you mean basically a number input like the ask block? Well, you can use
I think that there should be a better way of getting input via the keyboard then the ask block (s). So kinda support but that other thing would be better.
set [result v] to []I guess. That's the simple workaround.
repeat until <not <(result) = []>>
ask [number?] and wait
if <not <((answer) + (0)) = ((answer) + (1))>> then
set [result v] to (answer)
end
end
I think that there should be a better way of getting input via the keyboard then the ask block (s). So kinda support but that other thing would be better.
Last edited by p2Ep2E (Sept. 19, 2020 16:08:30)
- pavcato
-
1000+ posts
Ask and Wait but with Numbers
This seems kinda specific, but it's a good idea. Like if your trying to make like a math game, it would be easier. Support. Would it be like the number pad for variables?
- sportfan999
-
1000+ posts
Ask and Wait but with Numbers
Yes! Would it be like the number pad for variables?
Also, thanks for the support!
Last edited by sportfan999 (Sept. 19, 2020 16:09:29)
- fdreerf
-
1000+ posts
Ask and Wait but with Numbers
You can reduce the number of blocks required you mean basically a number input like the ask block? Well, you can use
-snip-
I guess. That's the simple workaround.
set [result v] to []
repeat until <not <(result) = []>>
ask [number?] and wait
if <(answer) = ((answer) / (1))> then
set [result v] to (answer)
end
end
- p2Ep2E
-
57 posts
Ask and Wait but with Numbers
Removing the +0 block and replacing the +1 with /1 isn't exactly a radical change.
- fdreerf
-
1000+ posts
Ask and Wait but with Numbers
Not block amount wise but the two addition blocks and the not block made it quite long Removing the +0 block and replacing the +1 with /1 isn't exactly a radical change.
- p2Ep2E
-
57 posts
Ask and Wait but with Numbers
Okay, you're right, but it's still more or less the same.
- EIectron
-
60 posts
Ask and Wait but with Numbers
But… It isn't so useful? You don't need that so often and if you need it the workaround is easy and mentioned in posts before this.
And there is many ways to create this workaround… It could be more blocks in a tighter space like
And there is many ways to create this workaround… It could be more blocks in a tighter space like
repeat until <<(answer) contains (0)> or <<<(answer) contains (1)> or <<<(answer) contains (2)> or <<<(answer) contains (3)> or <<<(answer) contains (4)> or <<<(answer) contains (5)> or <<<(answer) contains (6)> or <<<<(answer) contains (7)> and <<(answer) contains (8)>> or <<(answer) contains (9)>>>>>>>>
ask [G'day madam, would you like to tell me a number.] and wait
end
- p2Ep2E
-
57 posts
Ask and Wait but with Numbers
Not really, since you could write haha123thisisweird and it would be fine. It could be more blocks in a tighter space likesnip::grey
- fdreerf
-
1000+ posts
Ask and Wait but with Numbers
That won't work as the contains block is for whether the input is an entry in a list. But… It isn't so useful? You don't need that so often and if you need it the workaround is easy and mentioned in posts before this.
And there is many ways to create this workaround… It could be more blocks in a tighter space likerepeat until <<(answer) contains (0)> or <<<(answer) contains (1)> or <<<(answer) contains (2)> or <<<(answer) contains (3)> or <<<(answer) contains (4)> or <<<(answer) contains (5)> or <<<(answer) contains (6)> or <<<<(answer) contains (7)> and <<(answer) contains (8)>> or <<(answer) contains (9)>>>>>>>>
ask [G'day madam, would you like to tell me a number.] and wait
end
- k0d3rrr
-
1000+ posts
Ask and Wait but with Numbers
In case you're wondering how I found this topic, I found this while looking for a duplicate of this topic with the really long title even though someone already found the duplicate.
This could be really useful for mystery games where you have to enter a code to be able to go inside a mysterious mansion.
You can already do this using lists and sprites, but this would be even more useful!
An example of how this could be used:
This could be really useful for mystery games where you have to enter a code to be able to go inside a mysterious mansion.
You can already do this using lists and sprites, but this would be even more useful!
An example of how this could be used:
ask [What's the keycode?] and wait for numbers:: sensing
if <(answer) = [whatever you want the keycode to be]> then
say [Welcome to the mansion!] for (2) secs
else
if <not <(answer) = [whatever you want the keycode to be]>> then
repeat (3)
say [Intruder!] for (2) secs
wait (0.1) secs
end
end
end
- juahmed
-
2 posts
Ask and Wait but with Numbers
Hahahahahahahahahahahhahahahaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
- Discussion Forums
- » Suggestions
-
» Ask and Wait but with Numbers