Discuss Scratch

han614698
Scratcher
1000+ posts

Mouse/Key Press Emulation Blocks

The blocks I'm suggesting are:
emulate (space v) key press and wait::events

emulate (space v) key press::events
When those blocks is clicked (or hit in the code), it will trigger all of the “key pressed” blocks of a certain key.

I'm also suggesting this block:
emulate cursor click at x: () y: ()::events
This would do exactly what it says - simulate a mouse click in a set position.

These blocks, specifically the first few, would make testing easier and would be easy to activate code while a game is playing WITHOUT having to deal with broadcasting.

The other dropdowns would be the other keys. Also, note that the dropdown is OVAL instead of rectangular, for putting in join blocks to make enter, /, <, >, etc. keys.


Last edited by han614698 (Nov. 8, 2024 02:58:13)

misteray
Scratcher
1000+ posts

Mouse/Key Press Emulation Blocks

Support!
han614698
Scratcher
1000+ posts

Mouse/Key Press Emulation Blocks

removed

Last edited by han614698 (Sept. 22, 2021 23:19:46)

-EmeraldThunder-
Scratcher
1000+ posts

Mouse/Key Press Emulation Blocks

I support. This would be good for testing without having to edit large amounts of code.

If it is implemented however I recommend you change the text to.

Trigger event key (space v) press
han614698
Scratcher
1000+ posts

Mouse/Key Press Emulation Blocks

-EmeraldThunder- wrote:

I support. This would be good for testing without having to edit large amounts of code.

If it is implemented however I recommend you change the text to.

Trigger event key (space v) press
Sure, thanks.
-EmeraldThunder-
Scratcher
1000+ posts

Mouse/Key Press Emulation Blocks

misteray wrote:

Support!
Please tell us why you support.
Maximouse
Scratcher
1000+ posts

Mouse/Key Press Emulation Blocks

-EmeraldThunder- wrote:

I support. This would be good for testing without having to edit large amounts of code.

If it is implemented however I recommend you change the text to.

Trigger event key (space v) press
An even better name might be
simulate (space v) key press :: control

I think it should press the key for one frame, so “key pressed?” blocks that run in the next frame would return true. There could also be blocks blocks that press and release the key:
simulate (space v) key press start :: control
simulate (space v) key press end :: control
han614698
Scratcher
1000+ posts

Mouse/Key Press Emulation Blocks

Maximouse wrote:

-EmeraldThunder- wrote:

I support. This would be good for testing without having to edit large amounts of code.

If it is implemented however I recommend you change the text to.

Trigger event key (space v) press
An even better name might be
simulate (space v) key press :: control

I think it should press the key for one frame, so “key pressed?” blocks that run in the next frame would return true. There could also be blocks blocks that press and release the key:
simulate (space v) key press start :: control
simulate (space v) key press end :: control
What category do you suggest? I was thinking about events, but you're saying control.
Also, what do you think of the hat block?
scratchastroLOL
Scratcher
1000+ posts

Mouse/Key Press Emulation Blocks

so what about
Trigger event key (space v) press and wait :: events
han614698
Scratcher
1000+ posts

Mouse/Key Press Emulation Blocks

scratchastroLOL wrote:

so what about
Trigger event key (space v) press and wait :: events
Compromises; great idea!
Chiroyce
Scratcher
1000+ posts

Mouse/Key Press Emulation Blocks

An even better name might be
key down (space v) key press :: control
key up (space v) key press :: control
press key (space v) for () seconds :: control

han614698
Scratcher
1000+ posts

Mouse/Key Press Emulation Blocks

Chiroyce wrote:

An even better name might be
key down (space v) key press :: control
key up (space v) key press :: control
press key (space v) for () seconds :: control

Maybe, but you might want to add a simulate in there like so:
simulate key down (space v) key press :: control
simulate key up (space v) key press :: control
simulate press key (space v) for () seconds :: control
These are getting a bit long, though, but that's another suggestion. (To make it so you can scroll either way on the blocks palette).
1Oaktree2
Scratcher
1000+ posts

Mouse/Key Press Emulation Blocks

Cool idea for testing, especially if the key isn't working, or you want to make a mobile version
Then again:

when [..v] key pressed
Simulate [.. v]

Last edited by 1Oaktree2 (March 3, 2021 14:54:24)

the2000
Scratcher
1000+ posts

Mouse/Key Press Emulation Blocks

1Oaktree2 wrote:

Then again:
when [..v] key pressed
Simulate [.. v]
You can do that with broadcasts already.
han614698
Scratcher
1000+ posts

Mouse/Key Press Emulation Blocks

Last edited by han614698 (April 1, 2022 11:28:36)

the2000
Scratcher
1000+ posts

Mouse/Key Press Emulation Blocks

han614698 wrote:

the2000 wrote:

You can do that with broadcasts already.
the2000, do you support or not. What are your ideas, especially about the hat block.
I have the right to remain with my stance on the suggestion unstated.

Anyway, this would be useful, but I'm not sure if it would belong in the main palette. Since there already is an extension with only two blocks (Translate IIRC) I don't think that it would be too out of place to make this an extension. Or they could just be hidden blocks, IDK. This could make an easy way to create mobile controls, which would be nice.
han614698
Scratcher
1000+ posts

Mouse/Key Press Emulation Blocks

the2000 wrote:

han614698 wrote:

the2000 wrote:

You can do that with broadcasts already.
the2000, do you support or not. What are your ideas, especially about the hat block.
I have the right to remain with my stance on the suggestion unstated.

Anyway, this would be useful, but I'm not sure if it would belong in the main palette. Since there already is an extension with only two blocks (Translate IIRC) I don't think that it would be too out of place to make this an extension. Or they could just be hidden blocks, IDK. This could make an easy way to create mobile controls, which would be nice.
Ok, thanks. Do you like the hat block?
Chiroyce
Scratcher
1000+ posts

Mouse/Key Press Emulation Blocks

Can you change the title to
“Key press emulation blocks” or something more technically understandable ?
the2000
Scratcher
1000+ posts

Mouse/Key Press Emulation Blocks

han614698 wrote:

the2000 wrote:

Anyway, this would be useful, but I'm not sure if it would belong in the main palette. Since there already is an extension with only two blocks (Translate IIRC) I don't think that it would be too out of place to make this an extension. Or they could just be hidden blocks, IDK. This could make an easy way to create mobile controls, which would be nice.
Ok, thanks. Do you like the hat block?
Seems like it would sorta ruin the point to differentiate between real and simulated inputs? You could just use broadcasts for every purpose that the hat would come in handy for. I'm not sure why it's a rounded drop-down, either.
han614698
Scratcher
1000+ posts

Mouse/Key Press Emulation Blocks

Last edited by han614698 (April 1, 2022 11:29:06)

Powered by DjangoBB