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)
My Profile / My User Page / My Talk Page
——————–
Progress bar to 1000+ Posts - Image might not be up to date
——————–
My browser / operating system: Windows NT 10.0 (Windows 11 - 22H2), Firefox 122.0b4
——————–
My ScratchX Extensions——–If you like this post, give me an internet!——–Sharp Scratch Mod
- savaka
- Scratcher
1000+ posts
What did I do wrong
Use of = instead of == was probably causing syntax error, thanks! 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 ()
- Discussion Forums
- » Developing Scratch Extensions
- » What did I do wrong