Block Menu Index

Using the BlockMenu extension, there’s both option and index. What is the index in the block menu for and how do you use it?

So you know how you passed in an array like this to display:

["Option 1", "Option 2", "Option 3]

If you selected Option 1, the index would be 0, because you selected the 0th element. The selected option would still be Option 1. But if you selected Option 3, the index woukd be 2 while the option would be Option 3.

2 Likes

The explanation from @UnsignedArduino is correct; the index of the first menu option is 0. So the indexes are: 0, 1, 2 for the three items. Where you might use it could be for the following:

There is a bug in my code when trying to update the text sprite, but this should give you the general idea.

2 Likes

The block menu is in extensions, how did you get that one

1 Like

Import the block extension menu with this link:


SHAMELESS SELF PROMOTION
I have curated a list of extensions here.

There is a link which you have to put into the search bar above the already existing extensions! So exactly underneath HERE!
image
Then copy this link! (ctrl c to copy and ctrl v to paste (or strg on other keyboards))
Enter this link: riknoll/arcade-custom-menu like this


Then click on the seach button or enter! Then this should show up!
image
Else if it looks like this you did it wrong…

That means that you entered the wrong link! Often there is spaces between things! Those have to be removed! If the block-menu extension does show up just click on it to get it! Do you need an explenation on how to use it? Then just like this post! @Raed438
Also this extension is made by @richard (riknoll is his github name(github is basically the forum but way bigger! There is more or less every coder there! Not just the Makecoders! So people who use other engines like Unity, Unreal Engine or others! These might look better but are way harder…) I hope this helps you out! (Like this post if you need a further step by step explaination ob how to make a menu work and do something)
Also welcome to Makecode!

2 Likes