How to detect when a menu slot has been clicked?

I know about the

when slot [ V] signals [menu V]

block but I can’t figure out how to detect when the menu gets clicked.

Clicking the dropdown arrow runs the script associated with the menu. The menu is only shown whenever that script reaches a report () block or ends.

Which dropdown? I’m confused.

Maybe a script pic of what you mean?

I think what you’re issue is that you don’t know when the block is being triggered.

The hat block triggers when you click to show the dropdown, not after you choose an option. This block is only meant to be used to create dynamic menus, because you can make the script report a list and have that list be the menu.

But the block doesn’t work when I click the dropdown.


Just found out that this was here during the development of the slot system but got removed :thinking:

yeah, it started out as a menu signal block and an edit signal block. Then they were combined last-minute. There was also an additional expand [ V] to () slots which got moved to the Metaprogramming library since the ability to do the same thing with the set slot [ V] to [] block was added also last-minute.

All I can see in your video is that you clicked on the menu and selected “banana”, and then did nothing else. If you had clicked it a second time, I’m pretty sure the sprite would have said “hello”.

You should try this script instead of what you’re doing, so that you can understand why that’s happening.

And also, make sure to click on it multiple times, otherwise you won’t really see any results.

Tried clicking on the old script 2 times, and also the new script, still no results

I honestly don’t know what snap does with 2 hat blocks for the same input, so try removing your original script, and only have the one I gave you in the block.

Edit: Actually I think I found the problem. You have a custom menu set on the input slot, so snap isn’t running the dropdown script. What you need to do instead is set the menu to scripted.

Then the hat block will run. This also means that you have to put your options in a report block in the when slot [ V] signals [menu V] script.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.