-
-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create CommentPlus.js #1200
Create CommentPlus.js #1200
Changes from all commits
5f22bdf
1000d03
b3bb0b3
c5eeb07
a630725
8bd3525
4a14ee2
358730e
0a982e1
abf43af
e04c3c3
f6fbe47
b390e41
d278da3
d0ed2b1
ae22367
25ae3c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,372 @@ | ||
// Name: Comment Plus | ||
// ID: mytacomments | ||
// Description: More Comment Blocks. | ||
// By: Mastered YT Aditya <https://mastered-yt-aditya.github.io/> | ||
// Original: LilyMakesThings <https://scratch.mit.edu/users/LilyMakesThings/> | ||
|
||
(function (Scratch) { | ||
"use strict"; | ||
|
||
class CommentPlus { | ||
getInfo() { | ||
return { | ||
id: "mytacomments", | ||
name: "Comment Plus", | ||
color1: "#a9e43a", | ||
color2: "#84b02b", | ||
color3: "#567419", | ||
blocks: [ | ||
{ | ||
opcode: "commentHat", | ||
blockType: Scratch.BlockType.HAT, | ||
text: "// [COMMENT]", | ||
isEdgeActivated: false, | ||
arguments: { | ||
COMMENT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "comment", | ||
}, | ||
}, | ||
}, | ||
{ | ||
opcode: "commentCommand", | ||
blockType: Scratch.BlockType.COMMAND, | ||
text: "// [COMMENT]", | ||
arguments: { | ||
COMMENT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "comment", | ||
}, | ||
}, | ||
}, | ||
{ | ||
opcode: "commentC", | ||
blockType: Scratch.BlockType.CONDITIONAL, | ||
text: "// [COMMENT]", | ||
arguments: { | ||
COMMENT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "comment", | ||
}, | ||
}, | ||
}, | ||
{ | ||
opcode: "commentReporter", | ||
blockType: Scratch.BlockType.REPORTER, | ||
text: "[INPUT] // [COMMENT]", | ||
arguments: { | ||
COMMENT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "comment", | ||
}, | ||
INPUT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "", | ||
}, | ||
}, | ||
}, | ||
{ | ||
opcode: "commentBoolean", | ||
blockType: Scratch.BlockType.BOOLEAN, | ||
text: "[INPUT] // [COMMENT]", | ||
arguments: { | ||
COMMENT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "comment", | ||
}, | ||
INPUT: { | ||
type: Scratch.ArgumentType.BOOLEAN, | ||
}, | ||
}, | ||
}, | ||
{ | ||
opcode: "commentReporterPPP", | ||
blockType: Scratch.BlockType.REPORTER, | ||
text: "// [COMMENT] [INPUT]", | ||
arguments: { | ||
COMMENT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "comment", | ||
}, | ||
INPUT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "", | ||
}, | ||
}, | ||
}, | ||
{ | ||
opcode: "commentBooleanPPP", | ||
blockType: Scratch.BlockType.BOOLEAN, | ||
text: "// [COMMENT] [INPUT]", | ||
arguments: { | ||
COMMENT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "comment", | ||
}, | ||
INPUT: { | ||
type: Scratch.ArgumentType.BOOLEAN, | ||
}, | ||
}, | ||
}, | ||
{ | ||
opcode: "commentReporterPPPP", | ||
blockType: Scratch.BlockType.REPORTER, | ||
text: "// [COMMENT] [INPUT]", | ||
arguments: { | ||
COMMENT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "comment", | ||
}, | ||
INPUT: { | ||
type: Scratch.ArgumentType.BOOLEAN, | ||
}, | ||
}, | ||
}, | ||
{ | ||
opcode: "commentBooleanPPPP", | ||
blockType: Scratch.BlockType.BOOLEAN, | ||
text: "// [COMMENT] [INPUT]", | ||
arguments: { | ||
COMMENT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "comment", | ||
}, | ||
INPUT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "", | ||
}, | ||
}, | ||
}, | ||
{ | ||
opcode: "commentBooleanPlus", | ||
blockType: Scratch.BlockType.BOOLEAN, | ||
text: "// [COMMENT]", | ||
arguments: { | ||
COMMENT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "comment" | ||
}, | ||
}, | ||
}, | ||
{ | ||
opcode: "commentReporterPlus", | ||
blockType: Scratch.BlockType.REPORTER, | ||
text: "// [COMMENT]", | ||
arguments: { | ||
COMMENT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "comment" | ||
}, | ||
}, | ||
}, | ||
{ | ||
opcode: "commentCap", | ||
blockType: Scratch.BlockType.COMMAND, | ||
isTerminal: true, | ||
text: "// [COMMENT]", | ||
arguments: { | ||
COMMENT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "comment" | ||
}, | ||
}, | ||
}, | ||
{ | ||
opcode: "commentCPlus", | ||
blockType: Scratch.BlockType.CONDITIONAL, | ||
isTerminal: true, | ||
text: "// [COMMENT]", | ||
arguments: { | ||
COMMENT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "comment", | ||
}, | ||
}, | ||
}, | ||
{ | ||
opcode: "commentReporterPlusPlus", | ||
blockType: Scratch.BlockType.REPORTER, | ||
text: "[INPUT] // [COMMENT]", | ||
arguments: { | ||
COMMENT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "comment", | ||
}, | ||
INPUT: { | ||
type: Scratch.ArgumentType.BOOLEAN, | ||
}, | ||
}, | ||
}, | ||
{ | ||
opcode: "commentBooleanPlusPlus", | ||
blockType: Scratch.BlockType.BOOLEAN, | ||
text: "[INPUT] // [COMMENT]", | ||
arguments: { | ||
COMMENT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "comment", | ||
}, | ||
INPUT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "", | ||
}, | ||
}, | ||
}, | ||
{ | ||
opcode: "commentReporterP6", | ||
blockType: Scratch.BlockType.REPORTER, | ||
text: "[COLOR] // [COMMENT]", | ||
arguments: { | ||
COMMENT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "comment", | ||
}, | ||
COLOR: { | ||
type: Scratch.ArgumentType.COLOR, | ||
defaultValue: "#037b03", | ||
}, | ||
}, | ||
}, | ||
{ | ||
opcode: "commentBooleanP6", | ||
blockType: Scratch.BlockType.BOOLEAN, | ||
text: "[COLOR] // [COMMENT]", | ||
arguments: { | ||
COMMENT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "comment", | ||
}, | ||
COLOR: { | ||
type: Scratch.ArgumentType.COLOR, | ||
defaultValue: "#037b03", | ||
}, | ||
}, | ||
}, | ||
{ | ||
opcode: "commentReporterP7", | ||
blockType: Scratch.BlockType.REPORTER, | ||
text: "// [COMMENT] [COLOR]", | ||
arguments: { | ||
COMMENT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "comment", | ||
}, | ||
COLOR: { | ||
type: Scratch.ArgumentType.COLOR, | ||
defaultValue: "#037b03", | ||
}, | ||
}, | ||
}, | ||
{ | ||
opcode: "commentBooleanP7", | ||
blockType: Scratch.BlockType.BOOLEAN, | ||
text: "// [COMMENT] [COLOR]", | ||
arguments: { | ||
COMMENT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "comment", | ||
}, | ||
COLOR: { | ||
type: Scratch.ArgumentType.COLOR, | ||
defaultValue: "#037b03", | ||
}, | ||
}, | ||
}, | ||
{ | ||
opcode: "commentCPlusPlus", | ||
blockType: Scratch.BlockType.CONDITIONAL, | ||
branchCount: 2, | ||
text: "// [COMMENT]", | ||
arguments: { | ||
COMMENT: { | ||
type: Scratch.ArgumentType.STRING, | ||
defaultValue: "comment", | ||
}, | ||
}, | ||
}, | ||
], | ||
}; | ||
} | ||
|
||
commentHat() { | ||
// no-op | ||
} | ||
|
||
commentCommand() { | ||
// no-op | ||
} | ||
|
||
commentC(args, util) { | ||
return true; | ||
} | ||
|
||
commentReporter(args) { | ||
return args.INPUT; | ||
} | ||
|
||
commentBoolean(args) { | ||
return args.INPUT || false; | ||
} | ||
|
||
commentReporterPPP(args) { | ||
return args.INPUT; | ||
} | ||
|
||
commentBooleanPPP(args) { | ||
return args.INPUT || false; | ||
} | ||
|
||
commentReporterPPPP(args) { | ||
return args.INPUT || false; | ||
} | ||
|
||
commentBooleanPPPP(args) { | ||
return args.INPUT; | ||
} | ||
|
||
commentBooleanPlus(args) { | ||
MYTAditya marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please don't mark issues as resolved unless they are actually resolved. This still does not return anything. That is a bug. Please fix it |
||
// no-op | ||
} | ||
|
||
commentReporterPlus(args) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This still doesn't return anything; reporters cannot return nothing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please don't mark issues as resolved unless they are actually resolved. This still does not return anything. That is a bug. Please fix it |
||
// no-op | ||
} | ||
|
||
commentCap() { | ||
MYTAditya marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove your unused functions |
||
// no-op | ||
} | ||
|
||
commentCPlus(args, util) { | ||
return true; | ||
} | ||
|
||
commentReporterPlusPlus(args) { | ||
return args.INPUT || false; | ||
MYTAditya marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
commentBooleanPlusPlus(args) { | ||
return args.INPUT; | ||
} | ||
|
||
commentReporterP6(args) { | ||
return args.COLOR; | ||
} | ||
|
||
commentBooleanP6(args) { | ||
return args.COLOR; | ||
} | ||
|
||
commentReporterP7(args) { | ||
return args.COLOR; | ||
} | ||
|
||
commentBooleanP7(args) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand where or why you'd need a color input inside of a boolean. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah you're right because reporters could do that. You can say, I just created it for Boolean shaped block. If you say, I would remove Booleans which had colors strings. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In an ideal world you'd just remove all of the color blocks |
||
return args.COLOR; | ||
} | ||
|
||
commentCPlusPlus(args, util) { | ||
return true; | ||
MYTAditya marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
Scratch.extensions.register(new CommentPlus()); | ||
})(Scratch); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you specify what the point of a double-branch comment block is? As stated previously, the second branch doesn't even run because of how you return the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that block is just pointless, but I created that for the blocks put in first branch would work (like previous ones) and next branch wouldn't work. If you can, please write and comment me the code where both branches would work in the same block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not going to write this extension for you as a block like that shouldn't exist to begin with