scratchfoundation / scratchx

Scratch Extension Site
https://github.com/llk/scratchx
190 stars 121 forks source link

How to create a reporter block with checkbox? #137

Closed CvanLeeuwenFt closed 6 years ago

CvanLeeuwenFt commented 6 years ago

During a day I am looking around in the documentation but I could not find a description. I only saw that it is possible but not "How to do" it. How can I create in a extension a reporter block with the check box. So that the result shows up in the left top pane? See also the images: reporterblock

I was able to reproduce the first one, the ',' with a space did the trick. ['r', 'loudness', 'getLoudness', ], However I was not able to find a solution for the second one: ['r' , 'Video %m.list1 on %m.list2 ' , 'getVideo' , 'motion' , 'stage' , ], This code did produce the reporter block but not the checkbox.

How to do it? Where this is documented?

mkacct commented 6 years ago

AFAIK it will have a checkbox if it has no default values, and will not have a checkbox if it has any default values ('motion' , 'stage')

CvanLeeuwenFt commented 6 years ago

However in the example, part of the basic Scratch script "sensing", there are two default values. list1 contains 'motion' and 'direction' and list2 contains 'stage'. The block "current" in Sensing has as default 'month'. reporterblock2

mkacct commented 6 years ago

Built-in Scratch blocks are not created with a descriptor like extension blocks, so they would not have this restriction, but extensions (AFAIK) detect whether or not there can be a Stage viewer from whether or not there are any default values for the block's fields

also what is the "example" from?

CvanLeeuwenFt commented 6 years ago

How longer I am busy with developing an extension for Scratch how more restrictions I discover. It looks like that Scratch don't like the developing of extensions. Also the differences between the older HTTP based extensions and these JavaScript extensions. See also my earlier comment on the HAT-blocks.

CvanLeeuwenFt commented 6 years ago

savaka2 Thanks for your fast comment on my problem

thisandagain commented 6 years ago

@CvanLeeuwenFt There is not a way to add monitor checkbox for extensions in Scratch 2.0 / ScratchX, but this is a feature that we will be supporting in the extensions spec for Scratch 3.0. You can see a preview of that here: https://github.com/LLK/scratch-vm/wiki/Extensions-Proposal