From 6c1860ac48ff352340eb55e3484d86bb648e7ba7 Mon Sep 17 00:00:00 2001 From: yuri-kiss <135030944+yuri-kiss@users.noreply.github.com> Date: Thu, 8 May 2025 15:22:37 -0400 Subject: [PATCH 1/2] Implement checkbox on the vm side (1/2) --- src/blocks/scratch3_operators.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/blocks/scratch3_operators.js b/src/blocks/scratch3_operators.js index a2a5ab4bd2b..4a86e4738b9 100644 --- a/src/blocks/scratch3_operators.js +++ b/src/blocks/scratch3_operators.js @@ -33,10 +33,15 @@ class Scratch3OperatorsBlocks { operator_contains: this.contains, operator_mod: this.mod, operator_round: this.round, - operator_mathop: this.mathop + operator_mathop: this.mathop, + checkbox: this.checkbox }; } + checkbox () { + return true; + } + add (args) { return Cast.toNumber(args.NUM1) + Cast.toNumber(args.NUM2); } From 23c7270b905b0975fe00d7f6b6ad54ce34a7b621 Mon Sep 17 00:00:00 2001 From: yuri-kiss <135030944+yuri-kiss@users.noreply.github.com> Date: Thu, 8 May 2025 15:23:57 -0400 Subject: [PATCH 2/2] Implement checkbox on the vm side (2/2) --- src/compiler/irgen.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/compiler/irgen.js b/src/compiler/irgen.js index 4c3137939a9..c2724f4685d 100644 --- a/src/compiler/irgen.js +++ b/src/compiler/irgen.js @@ -177,6 +177,11 @@ class ScriptTreeGenerator { kind: 'constant', value: block.fields.TEXT.value }; + case 'checkbox': + return { + kind: 'constant', + value: true + }; case 'argument_reporter_string_number': { const name = block.fields.VALUE.value;