Discuss Scratch

lugga
Scratcher
500+ posts

Different shaped blocks in extensions

Is there any way to make blocks such as you can in the scratchblocks2 api. What I mean is be able to make blocks that look like the ‘if’ block or ‘repeat’ block.
Let me show you what I want to make
for <> in <> do :: cstart
eat soup.
savaka
Scratcher
1000+ posts

Different shaped blocks in extensions

You can't make blocks with command inputs in extensions
But I wish you could

Last edited by savaka (Dec. 12, 2015 16:47:22)

lugga
Scratcher
500+ posts

Different shaped blocks in extensions

savaka wrote:

You can't make blocks with command inputs in extensions
But I wish you could
Yeh me too.
Jonathan50
Scratcher
1000+ posts

Different shaped blocks in extensions

(function(ext) {
  ext._shutdown = function() {};
  ext._getStatus = function() {
    return {status: 2, msg: 'Ready'};
  };
  ext.example_c = function() {
    alert('Example c block');
  };
  ext.example_cap = function() {
    alert('Example cap block');
  };
  var descriptor = {
    blocks: [
      ['c', 'example c block', 'example_c'],
      ['f', 'example cap block', 'example_cap']
    ]
  };
  ScratchExtensions.register('Example Blocks', descriptor, ext);
})({});
You can, but the C blocks are pretty useless because I don't think you can make them run the scripts inside the block…

Not yet a Knight of the Mu Calculus.
lugga
Scratcher
500+ posts

Different shaped blocks in extensions

Jonathan50 wrote:

(function(ext) {
  ext._shutdown = function() {};
  ext._getStatus = function() {
    return {status: 2, msg: 'Ready'};
  };
  ext.example_c = function() {
    alert('Example c block');
  };
  ext.example_cap = function() {
    alert('Example cap block');
  };
  var descriptor = {
    blocks: [
      ['c', 'example c block', 'example_c'],
      ['f', 'example cap block', 'example_cap']
    ]
  };
  ScratchExtensions.register('Example Blocks', descriptor, ext);
})({});
You can, but the C blocks are pretty useless because I don't think you can make them run the scripts inside the block…
Do you think you could test something like this:
(function(ext) {
  ext._shutdown = function() {};
  ext._getStatus = function() {
    return {status: 2, msg: 'Ready'};
  };
  ext.example_c = function(blocks) {
    for (var i in blocks) {
      // Somehow execute a function depending on block name. Saying that i is something like ['c', 'repeat %s', 'repeat_func'] do something like if (i[1] == 'repeat %s') { function })
    }
  };
  ext.example_cap = function() {
    alert('Example cap block');
  };
  var descriptor = {
    blocks: [
      ['c', 'example c block', 'example_c'],
      ['f', 'example cap block', 'example_cap']
    ]
  };
  ScratchExtensions.register('Example Blocks', descriptor, ext);
})({});
I am at school so I can't test as github.io and scratchx are blocked.
Jonathan50
Scratcher
1000+ posts

Different shaped blocks in extensions

lugga wrote:

Do you think you could test something like this:
(function(ext) {
  ext._shutdown = function() {};
  ext._getStatus = function() {
    return {status: 2, msg: 'Ready'};
  };
  ext.example_c = function(blocks) {
    for (var i in blocks) {
      // Somehow execute a function depending on block name. Saying that i is something like ['c', 'repeat %s', 'repeat_func'] do something like if (i[1] == 'repeat %s') { function })
    }
  };
  ext.example_cap = function() {
    alert('Example cap block');
  };
  var descriptor = {
    blocks: [
      ['c', 'example c block', 'example_c'],
      ['f', 'example cap block', 'example_cap']
    ]
  };
  ScratchExtensions.register('Example Blocks', descriptor, ext);
})({});
I don't think a way to use C-blocks has been implemented yet.
I am at school so I can't test as github.io and scratchx are blocked.
please reconsider blocking GitHub

Not yet a Knight of the Mu Calculus.
lugga
Scratcher
500+ posts

Different shaped blocks in extensions

Jonathan50 wrote:

please reconsider blocking GitHub

What do you mean?
Jonathan50
Scratcher
1000+ posts

Different shaped blocks in extensions

lugga wrote:

Jonathan50 wrote:

please reconsider blocking GitHub

What do you mean?
Your teachers should reconsider blocking GitHub

Not yet a Knight of the Mu Calculus.

Powered by DjangoBB