Discuss Scratch
- Discussion Forums
- » Developing Scratch Extensions
- » What did I do wrong
- Mrcomputer1
-
Scratcher
500+ posts
What did I do wrong
NOTE: Some changes I did may not have been needed. The comments say the changes
(function(ext) { // Added ext in () and removed new var descriptor = { blocks: [ ['b', '%s as boolean', 'asboolean'], ['r', 'report %s', 'report'] //Change type to r ], url : "https://github.com/savaka2/scratch-extensions/wiki/Convert-to-Boolean-extension" }; ext._shutdown = function() { }; ext._getStatus = function() { return {status:2, msg:'Ready'}; }; ext.asboolean = function(s) { if (s == true || s == 'true') { // Used == and not = return true; } else { return false; } }; ext.report = function(s) { return s; }; ScratchExtensions.register('Convert to Boolean', descriptor, ext); })({}); // Added {} inside ()
Last edited by Mrcomputer1 (Nov. 2, 2015 09:08:27)
- savaka
-
Scratcher
1000+ posts
What did I do wrong
NOTE: Some changes I did may not have been needed. The comments say the changesUse of = instead of == was probably causing syntax error, thanks!(function(ext) { // Added ext in () and removed new var descriptor = { blocks: [ ['b', '%s as boolean', 'asboolean'], ['r', 'report %s', 'report'] //Change type to r ], url : "https://github.com/savaka2/scratch-extensions/wiki/Convert-to-Boolean-extension" }; ext._shutdown = function() { }; ext._getStatus = function() { return {status:2, msg:'Ready'}; }; ext.asboolean = function(s) { if (s == true || s == 'true') { // Used == and not = return true; } else { return false; } }; ext.report = function(s) { return s; }; ScratchExtensions.register('Convert to Boolean', descriptor, ext); })({}); // Added {} inside ()
- Discussion Forums
- » Developing Scratch Extensions
-
» What did I do wrong

