Delete utils/block_function_v1.py
Browse files- utils/block_function_v1.py +0 -759
utils/block_function_v1.py
DELETED
|
@@ -1,759 +0,0 @@
|
|
| 1 |
-
import json
|
| 2 |
-
import copy
|
| 3 |
-
|
| 4 |
-
import json
|
| 5 |
-
import copy
|
| 6 |
-
|
| 7 |
-
def generate_blocks_from_opcodes(opcode_counts, all_block_definitions):
|
| 8 |
-
"""
|
| 9 |
-
Generates a dictionary of Scratch-like blocks based on a list of opcodes and a reference block definition.
|
| 10 |
-
It now correctly links parent and menu blocks using their generated unique keys, and handles various block categories.
|
| 11 |
-
It ensures that menu blocks are only generated as children of their respective parent blocks.
|
| 12 |
-
|
| 13 |
-
Args:
|
| 14 |
-
opcode_counts (list): An array of objects, each with an 'opcode' and 'count' property.
|
| 15 |
-
Example: [{"opcode": "motion_gotoxy", "count": 1}]
|
| 16 |
-
all_block_definitions (dict): A comprehensive dictionary containing definitions for all block types.
|
| 17 |
-
|
| 18 |
-
Returns:
|
| 19 |
-
dict: A JSON object where keys are generated block IDs and values are the block definitions.
|
| 20 |
-
"""
|
| 21 |
-
generated_blocks = {}
|
| 22 |
-
opcode_occurrences = {} # To keep track of how many times each opcode (main or menu) has been used for unique keys
|
| 23 |
-
|
| 24 |
-
# Define explicit parent-menu relationships for linking purposes
|
| 25 |
-
# This maps main_opcode -> list of (input_field_name, menu_opcode)
|
| 26 |
-
explicit_menu_links = {
|
| 27 |
-
"motion_goto": [("TO", "motion_goto_menu")],
|
| 28 |
-
"motion_glideto": [("TO", "motion_glideto_menu")],
|
| 29 |
-
"motion_pointtowards": [("TOWARDS", "motion_pointtowards_menu")],
|
| 30 |
-
"sensing_keypressed": [("KEY_OPTION", "sensing_keyoptions")],
|
| 31 |
-
"sensing_of": [("OBJECT", "sensing_of_object_menu")],
|
| 32 |
-
"sensing_touchingobject": [("TOUCHINGOBJECTMENU", "sensing_touchingobjectmenu")],
|
| 33 |
-
"control_create_clone_of": [("CLONE_OPTION", "control_create_clone_of_menu")],
|
| 34 |
-
"sound_play": [("SOUND_MENU", "sound_sounds_menu")],
|
| 35 |
-
"sound_playuntildone": [("SOUND_MENU", "sound_sounds_menu")],
|
| 36 |
-
"looks_switchcostumeto": [("COSTUME", "looks_costume")],
|
| 37 |
-
"looks_switchbackdropto": [("BACKDROP", "looks_backdrops")],
|
| 38 |
-
}
|
| 39 |
-
|
| 40 |
-
# --- Step 1: Process explicitly requested opcodes and generate their instances and associated menus ---
|
| 41 |
-
for item in opcode_counts:
|
| 42 |
-
opcode = item.get("opcode")
|
| 43 |
-
count = item.get("count", 1)
|
| 44 |
-
|
| 45 |
-
if not opcode:
|
| 46 |
-
print("Warning: Skipping item with missing 'opcode'.")
|
| 47 |
-
continue
|
| 48 |
-
|
| 49 |
-
if opcode not in all_block_definitions:
|
| 50 |
-
print(f"Warning: Opcode '{opcode}' not found in all_block_definitions. Skipping.")
|
| 51 |
-
continue
|
| 52 |
-
|
| 53 |
-
for _ in range(count):
|
| 54 |
-
# Increment occurrence count for the current main opcode
|
| 55 |
-
opcode_occurrences[opcode] = opcode_occurrences.get(opcode, 0) + 1
|
| 56 |
-
main_block_instance_num = opcode_occurrences[opcode]
|
| 57 |
-
|
| 58 |
-
main_block_unique_key = f"{opcode}_{main_block_instance_num}"
|
| 59 |
-
|
| 60 |
-
# Create a deep copy of the main block definition
|
| 61 |
-
main_block_data = copy.deepcopy(all_block_definitions[opcode])
|
| 62 |
-
|
| 63 |
-
# Set properties for a top-level main block
|
| 64 |
-
main_block_data["parent"] = None
|
| 65 |
-
main_block_data["next"] = None
|
| 66 |
-
main_block_data["topLevel"] = True
|
| 67 |
-
main_block_data["shadow"] = False # Main blocks are typically not shadows
|
| 68 |
-
|
| 69 |
-
generated_blocks[main_block_unique_key] = main_block_data
|
| 70 |
-
|
| 71 |
-
# If this main block has associated menus, generate and link them now
|
| 72 |
-
if opcode in explicit_menu_links:
|
| 73 |
-
for input_field_name, menu_opcode_type in explicit_menu_links[opcode]:
|
| 74 |
-
if menu_opcode_type in all_block_definitions:
|
| 75 |
-
# Increment the occurrence for the menu block type
|
| 76 |
-
opcode_occurrences[menu_opcode_type] = opcode_occurrences.get(menu_opcode_type, 0) + 1
|
| 77 |
-
menu_block_instance_num = opcode_occurrences[menu_opcode_type]
|
| 78 |
-
|
| 79 |
-
menu_block_data = copy.deepcopy(all_block_definitions[menu_opcode_type])
|
| 80 |
-
|
| 81 |
-
# Generate a unique key for this specific menu instance
|
| 82 |
-
menu_unique_key = f"{menu_opcode_type}_{menu_block_instance_num}"
|
| 83 |
-
|
| 84 |
-
# Set properties for a shadow menu block
|
| 85 |
-
menu_block_data["shadow"] = True
|
| 86 |
-
menu_block_data["topLevel"] = False
|
| 87 |
-
menu_block_data["next"] = None
|
| 88 |
-
menu_block_data["parent"] = main_block_unique_key # Link menu to its parent instance
|
| 89 |
-
|
| 90 |
-
# Update the main block's input to point to this unique menu instance
|
| 91 |
-
if input_field_name in main_block_data.get("inputs", {}) and \
|
| 92 |
-
isinstance(main_block_data["inputs"][input_field_name], list) and \
|
| 93 |
-
len(main_block_data["inputs"][input_field_name]) > 1 and \
|
| 94 |
-
main_block_data["inputs"][input_field_name][0] == 1:
|
| 95 |
-
|
| 96 |
-
main_block_data["inputs"][input_field_name][1] = menu_unique_key
|
| 97 |
-
|
| 98 |
-
generated_blocks[menu_unique_key] = menu_block_data
|
| 99 |
-
|
| 100 |
-
return generated_blocks
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
# --- Consolidated Block Definitions from all provided JSONs ---
|
| 104 |
-
all_block_definitions = {
|
| 105 |
-
# motion_block.json
|
| 106 |
-
"motion_movesteps": {
|
| 107 |
-
"opcode": "motion_movesteps", "next": None, "parent": None,
|
| 108 |
-
"inputs": {"STEPS": [1, [4, "10"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 109 |
-
"x": 464, "y": -416
|
| 110 |
-
},
|
| 111 |
-
"motion_turnright": {
|
| 112 |
-
"opcode": "motion_turnright", "next": None, "parent": None,
|
| 113 |
-
"inputs": {"DEGREES": [1, [4, "15"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 114 |
-
"x": 467, "y": -316
|
| 115 |
-
},
|
| 116 |
-
"motion_turnleft": {
|
| 117 |
-
"opcode": "motion_turnleft", "next": None, "parent": None,
|
| 118 |
-
"inputs": {"DEGREES": [1, [4, "15"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 119 |
-
"x": 464, "y": -210
|
| 120 |
-
},
|
| 121 |
-
"motion_goto": {
|
| 122 |
-
"opcode": "motion_goto", "next": None, "parent": None,
|
| 123 |
-
"inputs": {"TO": [1, "motion_goto_menu"]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 124 |
-
"x": 465, "y": -95
|
| 125 |
-
},
|
| 126 |
-
"motion_goto_menu": {
|
| 127 |
-
"opcode": "motion_goto_menu", "next": None, "parent": "motion_goto",
|
| 128 |
-
"inputs": {}, "fields": {"TO": ["_random_", None]}, "shadow": True, "topLevel": False
|
| 129 |
-
},
|
| 130 |
-
"motion_gotoxy": {
|
| 131 |
-
"opcode": "motion_gotoxy", "next": None, "parent": None,
|
| 132 |
-
"inputs": {"X": [1, [4, "0"]], "Y": [1, [4, "0"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 133 |
-
"x": 468, "y": 12
|
| 134 |
-
},
|
| 135 |
-
"motion_glideto": {
|
| 136 |
-
"opcode": "motion_glideto", "next": None, "parent": None,
|
| 137 |
-
"inputs": {"SECS": [1, [4, "1"]], "TO": [1, "motion_glideto_menu"]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 138 |
-
"x": 470, "y": 129
|
| 139 |
-
},
|
| 140 |
-
"motion_glideto_menu": {
|
| 141 |
-
"opcode": "motion_glideto_menu", "next": None, "parent": "motion_glideto",
|
| 142 |
-
"inputs": {}, "fields": {"TO": ["_random_", None]}, "shadow": True, "topLevel": False
|
| 143 |
-
},
|
| 144 |
-
"motion_glidesecstoxy": {
|
| 145 |
-
"opcode": "motion_glidesecstoxy", "next": None, "parent": None,
|
| 146 |
-
"inputs": {"SECS": [1, [4, "1"]], "X": [1, [4, "0"]], "Y": [1, [4, "0"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 147 |
-
"x": 476, "y": 239
|
| 148 |
-
},
|
| 149 |
-
"motion_pointindirection": {
|
| 150 |
-
"opcode": "motion_pointindirection", "next": None, "parent": None,
|
| 151 |
-
"inputs": {"DIRECTION": [1, [8, "90"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 152 |
-
"x": 493, "y": 361
|
| 153 |
-
},
|
| 154 |
-
"motion_pointtowards": {
|
| 155 |
-
"opcode": "motion_pointtowards", "next": None, "parent": None,
|
| 156 |
-
"inputs": {"TOWARDS": [1, "motion_pointtowards_menu"]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 157 |
-
"x": 492, "y": 463
|
| 158 |
-
},
|
| 159 |
-
"motion_pointtowards_menu": {
|
| 160 |
-
"opcode": "motion_pointtowards_menu", "next": None, "parent": "motion_pointtowards",
|
| 161 |
-
"inputs": {}, "fields": {"TOWARDS": ["_mouse_", None]}, "shadow": True, "topLevel": False
|
| 162 |
-
},
|
| 163 |
-
"motion_changexby": {
|
| 164 |
-
"opcode": "motion_changexby", "next": None, "parent": None,
|
| 165 |
-
"inputs": {"DX": [1, [4, "10"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 166 |
-
"x": 851, "y": -409
|
| 167 |
-
},
|
| 168 |
-
"motion_setx": {
|
| 169 |
-
"opcode": "motion_setx", "next": None, "parent": None,
|
| 170 |
-
"inputs": {"X": [1, [4, "0"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 171 |
-
"x": 864, "y": -194
|
| 172 |
-
},
|
| 173 |
-
"motion_changeyby": {
|
| 174 |
-
"opcode": "motion_changeyby", "next": None, "parent": None,
|
| 175 |
-
"inputs": {"DY": [1, [4, "10"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 176 |
-
"x": 861, "y": -61
|
| 177 |
-
},
|
| 178 |
-
"motion_sety": {
|
| 179 |
-
"opcode": "motion_sety", "next": None, "parent": None,
|
| 180 |
-
"inputs": {"Y": [1, [4, "0"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 181 |
-
"x": 864, "y": 66
|
| 182 |
-
},
|
| 183 |
-
"motion_ifonedgebounce": {
|
| 184 |
-
"opcode": "motion_ifonedgebounce", "next": None, "parent": None,
|
| 185 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 186 |
-
"x": 1131, "y": -397
|
| 187 |
-
},
|
| 188 |
-
"motion_setrotationstyle": {
|
| 189 |
-
"opcode": "motion_setrotationstyle", "next": None, "parent": None,
|
| 190 |
-
"inputs": {}, "fields": {"STYLE": ["left-right", None]}, "shadow": False, "topLevel": True,
|
| 191 |
-
"x": 1128, "y": -287
|
| 192 |
-
},
|
| 193 |
-
"motion_xposition": {
|
| 194 |
-
"opcode": "motion_xposition", "next": None, "parent": None,
|
| 195 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 196 |
-
"x": 1193, "y": -136
|
| 197 |
-
},
|
| 198 |
-
"motion_yposition": {
|
| 199 |
-
"opcode": "motion_yposition", "next": None, "parent": None,
|
| 200 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 201 |
-
"x": 1181, "y": -64
|
| 202 |
-
},
|
| 203 |
-
"motion_direction": {
|
| 204 |
-
"opcode": "motion_direction", "next": None, "parent": None,
|
| 205 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 206 |
-
"x": 1188, "y": 21
|
| 207 |
-
},
|
| 208 |
-
|
| 209 |
-
# control_block.json
|
| 210 |
-
"control_wait": {
|
| 211 |
-
"opcode": "control_wait", "next": None, "parent": None,
|
| 212 |
-
"inputs": {"DURATION": [1, [5, "1"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 213 |
-
"x": 337, "y": 129
|
| 214 |
-
},
|
| 215 |
-
"control_repeat": {
|
| 216 |
-
"opcode": "control_repeat", "next": None, "parent": None,
|
| 217 |
-
"inputs": {"TIMES": [1, [6, "10"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 218 |
-
"x": 348, "y": 265
|
| 219 |
-
},
|
| 220 |
-
"control_forever": {
|
| 221 |
-
"opcode": "control_forever", "next": None, "parent": None,
|
| 222 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 223 |
-
"x": 334, "y": 439
|
| 224 |
-
},
|
| 225 |
-
"control_if": {
|
| 226 |
-
"opcode": "control_if", "next": None, "parent": None,
|
| 227 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 228 |
-
"x": 331, "y": 597
|
| 229 |
-
},
|
| 230 |
-
"control_if_else": {
|
| 231 |
-
"opcode": "control_if_else", "next": None, "parent": None,
|
| 232 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 233 |
-
"x": 335, "y": 779
|
| 234 |
-
},
|
| 235 |
-
"control_wait_until": {
|
| 236 |
-
"opcode": "control_wait_until", "next": None, "parent": None,
|
| 237 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 238 |
-
"x": 676, "y": 285
|
| 239 |
-
},
|
| 240 |
-
"control_repeat_until": {
|
| 241 |
-
"opcode": "control_repeat_until", "next": None, "parent": None,
|
| 242 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 243 |
-
"x": 692, "y": 381
|
| 244 |
-
},
|
| 245 |
-
"control_stop": {
|
| 246 |
-
"opcode": "control_stop", "next": None, "parent": None,
|
| 247 |
-
"inputs": {}, "fields": {"STOP_OPTION": ["all", None]}, "shadow": False, "topLevel": True,
|
| 248 |
-
"x": 708, "y": 545, "mutation": {"tagName": "mutation", "children": [], "hasnext": "false"}
|
| 249 |
-
},
|
| 250 |
-
"control_start_as_clone": {
|
| 251 |
-
"opcode": "control_start_as_clone", "next": None, "parent": None,
|
| 252 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 253 |
-
"x": 665, "y": 672
|
| 254 |
-
},
|
| 255 |
-
"control_create_clone_of": {
|
| 256 |
-
"opcode": "control_create_clone_of", "next": None, "parent": None,
|
| 257 |
-
"inputs": {"CLONE_OPTION": [1, "control_create_clone_of_menu"]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 258 |
-
"x": 648, "y": 797
|
| 259 |
-
},
|
| 260 |
-
"control_create_clone_of_menu": {
|
| 261 |
-
"opcode": "control_create_clone_of_menu", "next": None, "parent": "control_create_clone_of",
|
| 262 |
-
"inputs": {}, "fields": {"CLONE_OPTION": ["_myself_", None]}, "shadow": True, "topLevel": False
|
| 263 |
-
},
|
| 264 |
-
"control_delete_this_clone": {
|
| 265 |
-
"opcode": "control_delete_this_clone", "next": None, "parent": None,
|
| 266 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 267 |
-
"x": 642, "y": 914
|
| 268 |
-
},
|
| 269 |
-
|
| 270 |
-
# data_block.json
|
| 271 |
-
"data_setvariableto": {
|
| 272 |
-
"opcode": "data_setvariableto", "next": None, "parent": None,
|
| 273 |
-
"inputs": {"VALUE": [1, [10, "0"]]}, "fields": {"VARIABLE": ["my variable", "`jEk@4|i[#Fk?(8x)AV.-my variable"]}, "shadow": False, "topLevel": True,
|
| 274 |
-
"x": 348, "y": 241
|
| 275 |
-
},
|
| 276 |
-
"data_changevariableby": {
|
| 277 |
-
"opcode": "data_changevariableby", "next": None, "parent": None,
|
| 278 |
-
"inputs": {"VALUE": [1, [4, "1"]]}, "fields": {"VARIABLE": ["my variable", "`jEk@4|i[#Fk?(8x)AV.-my variable"]}, "shadow": False, "topLevel": True,
|
| 279 |
-
"x": 313, "y": 363
|
| 280 |
-
},
|
| 281 |
-
"data_showvariable": {
|
| 282 |
-
"opcode": "data_showvariable", "next": None, "parent": None,
|
| 283 |
-
"inputs": {}, "fields": {"VARIABLE": ["my variable", "`jEk@4|i[#Fk?(8x)AV.-my variable"]}, "shadow": False, "topLevel": True,
|
| 284 |
-
"x": 415, "y": 473
|
| 285 |
-
},
|
| 286 |
-
"data_hidevariable": {
|
| 287 |
-
"opcode": "data_hidevariable", "next": None, "parent": None,
|
| 288 |
-
"inputs": {}, "fields": {"VARIABLE": ["my variable", "`jEk@4|i[#Fk?(8x)AV.-my variable"]}, "shadow": False, "topLevel": True,
|
| 289 |
-
"x": 319, "y": 587
|
| 290 |
-
},
|
| 291 |
-
"data_addtolist": {
|
| 292 |
-
"opcode": "data_addtolist", "next": None, "parent": None,
|
| 293 |
-
"inputs": {"ITEM": [1, [10, "thing"]]}, "fields": {"LIST": ["MY_LIST", "o6`kIhtT{xWH+rX(5d,A"]}, "shadow": False, "topLevel": True,
|
| 294 |
-
"x": 385, "y": 109
|
| 295 |
-
},
|
| 296 |
-
"data_deleteoflist": {
|
| 297 |
-
"opcode": "data_deleteoflist", "next": None, "parent": None,
|
| 298 |
-
"inputs": {"INDEX": [1, [7, "1"]]}, "fields": {"LIST": ["MY_LIST", "o6`kIhtT{xWH+rX(5d,A"]}, "shadow": False, "topLevel": True,
|
| 299 |
-
"x": 384, "y": 244
|
| 300 |
-
},
|
| 301 |
-
"data_deletealloflist": {
|
| 302 |
-
"opcode": "data_deletealloflist", "next": None, "parent": None,
|
| 303 |
-
"inputs": {}, "fields": {"LIST": ["MY_LIST", "o6`kIhtT{xWH+rX(5d,A"]}, "shadow": False, "topLevel": True,
|
| 304 |
-
"x": 387, "y": 374
|
| 305 |
-
},
|
| 306 |
-
"data_insertatlist": {
|
| 307 |
-
"opcode": "data_insertatlist", "next": None, "parent": None,
|
| 308 |
-
"inputs": {"ITEM": [1, [10, "thing"]], "INDEX": [1, [7, "1"]]}, "fields": {"LIST": ["MY_LIST", "o6`kIhtT{xWH+rX(5d,A"]}, "shadow": False, "topLevel": True,
|
| 309 |
-
"x": 366, "y": 527
|
| 310 |
-
},
|
| 311 |
-
"data_replaceitemoflist": {
|
| 312 |
-
"opcode": "data_replaceitemoflist", "next": None, "parent": None,
|
| 313 |
-
"inputs": {"INDEX": [1, [7, "1"]], "ITEM": [1, [10, "thing"]]}, "fields": {"LIST": ["MY_LIST", "o6`kIhtT{xWH+rX(5d,A"]}, "shadow": False, "topLevel": True,
|
| 314 |
-
"x": 365, "y": 657
|
| 315 |
-
},
|
| 316 |
-
"data_itemoflist": {
|
| 317 |
-
"opcode": "data_itemoflist", "next": None, "parent": None,
|
| 318 |
-
"inputs": {"INDEX": [1, [7, "1"]]}, "fields": {"LIST": ["MY_LIST", "o6`kIhtT{xWH+rX(5d,A"]}, "shadow": False, "topLevel": True,
|
| 319 |
-
"x": 862, "y": 117
|
| 320 |
-
},
|
| 321 |
-
"data_itemnumoflist": {
|
| 322 |
-
"opcode": "data_itemnumoflist", "next": None, "parent": None,
|
| 323 |
-
"inputs": {"ITEM": [1, [10, "thing"]]}, "fields": {"LIST": ["MY_LIST", "o6`kIhtT{xWH+rX(5d,A"]}, "shadow": False, "topLevel": True,
|
| 324 |
-
"x": 883, "y": 238
|
| 325 |
-
},
|
| 326 |
-
"data_lengthoflist": {
|
| 327 |
-
"opcode": "data_lengthoflist", "next": None, "parent": None,
|
| 328 |
-
"inputs": {}, "fields": {"LIST": ["MY_LIST", "o6`kIhtT{xWH+rX(5d,A"]}, "shadow": False, "topLevel": True,
|
| 329 |
-
"x": 876, "y": 342
|
| 330 |
-
},
|
| 331 |
-
"data_listcontainsitem": {
|
| 332 |
-
"opcode": "data_listcontainsitem", "next": None, "parent": None,
|
| 333 |
-
"inputs": {"ITEM": [1, [10, "thing"]]}, "fields": {"LIST": ["MY_LIST", "o6`kIhtT{xWH+rX(5d,A"]}, "shadow": False, "topLevel": True,
|
| 334 |
-
"x": 871, "y": 463
|
| 335 |
-
},
|
| 336 |
-
"data_showlist": {
|
| 337 |
-
"opcode": "data_showlist", "next": None, "parent": None,
|
| 338 |
-
"inputs": {}, "fields": {"LIST": ["MY_LIST", "o6`kIhtT{xWH+rX(5d,A"]}, "shadow": False, "topLevel": True,
|
| 339 |
-
"x": 931, "y": 563
|
| 340 |
-
},
|
| 341 |
-
"data_hidelist": {
|
| 342 |
-
"opcode": "data_hidelist", "next": None, "parent": None,
|
| 343 |
-
"inputs": {}, "fields": {"LIST": ["MY_LIST", "o6`kIhtT{xWH+rX(5d,A"]}, "shadow": False, "topLevel": True,
|
| 344 |
-
"x": 962, "y": 716
|
| 345 |
-
},
|
| 346 |
-
|
| 347 |
-
# event_block.json
|
| 348 |
-
"event_whenflagclicked": {
|
| 349 |
-
"opcode": "event_whenflagclicked", "next": None, "parent": None,
|
| 350 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 351 |
-
"x": 166, "y": -422
|
| 352 |
-
},
|
| 353 |
-
"event_whenkeypressed": {
|
| 354 |
-
"opcode": "event_whenkeypressed", "next": None, "parent": None,
|
| 355 |
-
"inputs": {}, "fields": {"KEY_OPTION": ["space", None]}, "shadow": False, "topLevel": True,
|
| 356 |
-
"x": 151, "y": -329
|
| 357 |
-
},
|
| 358 |
-
"event_whenthisspriteclicked": {
|
| 359 |
-
"opcode": "event_whenthisspriteclicked", "next": None, "parent": None,
|
| 360 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 361 |
-
"x": 156, "y": -223
|
| 362 |
-
},
|
| 363 |
-
"event_whenbackdropswitchesto": {
|
| 364 |
-
"opcode": "event_whenbackdropswitchesto", "next": None, "parent": None,
|
| 365 |
-
"inputs": {}, "fields": {"BACKDROP": ["backdrop1", None]}, "shadow": False, "topLevel": True,
|
| 366 |
-
"x": 148, "y": -101
|
| 367 |
-
},
|
| 368 |
-
"event_whengreaterthan": {
|
| 369 |
-
"opcode": "event_whengreaterthan", "next": None, "parent": None,
|
| 370 |
-
"inputs": {"VALUE": [1, [4, "10"]]}, "fields": {"WHENGREATERTHANMENU": ["LOUDNESS", None]}, "shadow": False, "topLevel": True,
|
| 371 |
-
"x": 150, "y": 10
|
| 372 |
-
},
|
| 373 |
-
"event_whenbroadcastreceived": {
|
| 374 |
-
"opcode": "event_whenbroadcastreceived", "next": None, "parent": None,
|
| 375 |
-
"inputs": {}, "fields": {"BROADCAST_OPTION": ["message1", "5O!nei;S$!c!=hCT}0:a"]}, "shadow": False, "topLevel": True,
|
| 376 |
-
"x": 141, "y": 118
|
| 377 |
-
},
|
| 378 |
-
"event_broadcast": {
|
| 379 |
-
"opcode": "event_broadcast", "next": None, "parent": None,
|
| 380 |
-
"inputs": {"BROADCAST_INPUT": [1, [11, "message1", "5O!nei;S$!c!=hCT}0:a"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 381 |
-
"x": 151, "y": 229
|
| 382 |
-
},
|
| 383 |
-
"event_broadcastandwait": {
|
| 384 |
-
"opcode": "event_broadcastandwait", "next": None, "parent": None,
|
| 385 |
-
"inputs": {"BROADCAST_INPUT": [1, [11, "message1", "5O!nei;S$!c!=hCT}0:a"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 386 |
-
"x": 157, "y": 340
|
| 387 |
-
},
|
| 388 |
-
|
| 389 |
-
# look_block.json
|
| 390 |
-
"looks_sayforsecs": {
|
| 391 |
-
"opcode": "looks_sayforsecs", "next": None, "parent": None,
|
| 392 |
-
"inputs": {"MESSAGE": [1, [10, "Hello!"]], "SECS": [1, [4, "2"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 393 |
-
"x": 408, "y": 91
|
| 394 |
-
},
|
| 395 |
-
"looks_say": {
|
| 396 |
-
"opcode": "looks_say", "next": None, "parent": None,
|
| 397 |
-
"inputs": {"MESSAGE": [1, [10, "Hello!"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 398 |
-
"x": 413, "y": 213
|
| 399 |
-
},
|
| 400 |
-
"looks_thinkforsecs": {
|
| 401 |
-
"opcode": "looks_thinkforsecs", "next": None, "parent": None,
|
| 402 |
-
"inputs": {"MESSAGE": [1, [10, "Hmm..."]], "SECS": [1, [4, "2"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 403 |
-
"x": 413, "y": 317
|
| 404 |
-
},
|
| 405 |
-
"looks_think": {
|
| 406 |
-
"opcode": "looks_think", "next": None, "parent": None,
|
| 407 |
-
"inputs": {"MESSAGE": [1, [10, "Hmm..."]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 408 |
-
"x": 412, "y": 432
|
| 409 |
-
},
|
| 410 |
-
"looks_switchcostumeto": {
|
| 411 |
-
"opcode": "looks_switchcostumeto", "next": None, "parent": None,
|
| 412 |
-
"inputs": {"COSTUME": [1, "8;bti4wv(iH9nkOacCJ|"]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 413 |
-
"x": 411, "y": 555
|
| 414 |
-
},
|
| 415 |
-
"looks_costume": {
|
| 416 |
-
"opcode": "looks_costume", "next": None, "parent": "Q#a,6LPWHqo9-0Nu*[SV",
|
| 417 |
-
"inputs": {}, "fields": {"COSTUME": ["costume2", None]}, "shadow": True, "topLevel": False
|
| 418 |
-
},
|
| 419 |
-
"looks_nextcostume": {
|
| 420 |
-
"opcode": "looks_nextcostume", "next": None, "parent": None,
|
| 421 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 422 |
-
"x": 419, "y": 687
|
| 423 |
-
},
|
| 424 |
-
"looks_switchbackdropto": {
|
| 425 |
-
"opcode": "looks_switchbackdropto", "next": None, "parent": None,
|
| 426 |
-
"inputs": {"BACKDROP": [1, "-?yeX}29V*wd6W:unW0i"]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 427 |
-
"x": 901, "y": 91
|
| 428 |
-
},
|
| 429 |
-
"looks_backdrops": {
|
| 430 |
-
"opcode": "looks_backdrops", "next": None, "parent": "`Wm^p~l[(IWzc1|wNv*.",
|
| 431 |
-
"inputs": {}, "fields": {"BACKDROP": ["backdrop1", None]}, "shadow": True, "topLevel": False
|
| 432 |
-
},
|
| 433 |
-
"looks_changesizeby": {
|
| 434 |
-
"opcode": "looks_changesizeby", "next": None, "parent": None,
|
| 435 |
-
"inputs": {"CHANGE": [1, [4, "10"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 436 |
-
"x": 895, "y": 192
|
| 437 |
-
},
|
| 438 |
-
"looks_setsizeto": {
|
| 439 |
-
"opcode": "looks_setsizeto", "next": None, "parent": None,
|
| 440 |
-
"inputs": {"SIZE": [1, [4, "100"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 441 |
-
"x": 896, "y": 303
|
| 442 |
-
},
|
| 443 |
-
"looks_changeeffectby": {
|
| 444 |
-
"opcode": "looks_changeeffectby", "next": None, "parent": None,
|
| 445 |
-
"inputs": {"CHANGE": [1, [4, "25"]]}, "fields": {"EFFECT": ["COLOR", None]}, "shadow": False, "topLevel": True,
|
| 446 |
-
"x": 892, "y": 416
|
| 447 |
-
},
|
| 448 |
-
"looks_seteffectto": {
|
| 449 |
-
"opcode": "looks_seteffectto", "next": None, "parent": None,
|
| 450 |
-
"inputs": {"VALUE": [1, [4, "0"]]}, "fields": {"EFFECT": ["COLOR", None]}, "shadow": False, "topLevel": True,
|
| 451 |
-
"x": 902, "y": 527
|
| 452 |
-
},
|
| 453 |
-
"looks_cleargraphiceffects": {
|
| 454 |
-
"opcode": "looks_cleargraphiceffects", "next": None, "parent": None,
|
| 455 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 456 |
-
"x": 902, "y": 638
|
| 457 |
-
},
|
| 458 |
-
"looks_show": {
|
| 459 |
-
"opcode": "looks_show", "next": None, "parent": None,
|
| 460 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 461 |
-
"x": 908, "y": 758
|
| 462 |
-
},
|
| 463 |
-
"looks_hide": {
|
| 464 |
-
"opcode": "looks_hide", "next": None, "parent": None,
|
| 465 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 466 |
-
"x": 455, "y": 861
|
| 467 |
-
},
|
| 468 |
-
"looks_gotofrontback": {
|
| 469 |
-
"opcode": "looks_gotofrontback", "next": None, "parent": None,
|
| 470 |
-
"inputs": {}, "fields": {"FRONT_BACK": ["front", None]}, "shadow": False, "topLevel": True,
|
| 471 |
-
"x": 853, "y": 878
|
| 472 |
-
},
|
| 473 |
-
"looks_goforwardbackwardlayers": {
|
| 474 |
-
"opcode": "looks_goforwardbackwardlayers", "next": None, "parent": None,
|
| 475 |
-
"inputs": {"NUM": [1, [7, "1"]]}, "fields": {"FORWARD_BACKWARD": ["forward", None]}, "shadow": False, "topLevel": True,
|
| 476 |
-
"x": 851, "y": 999
|
| 477 |
-
},
|
| 478 |
-
"looks_costumenumbername": {
|
| 479 |
-
"opcode": "looks_costumenumbername", "next": None, "parent": None,
|
| 480 |
-
"inputs": {}, "fields": {"NUMBER_NAME": ["number", None]}, "shadow": False, "topLevel": True,
|
| 481 |
-
"x": 458, "y": 1007
|
| 482 |
-
},
|
| 483 |
-
"looks_backdropnumbername": {
|
| 484 |
-
"opcode": "looks_backdropnumbername", "next": None, "parent": None,
|
| 485 |
-
"inputs": {}, "fields": {"NUMBER_NAME": ["number", None]}, "shadow": False, "topLevel": True,
|
| 486 |
-
"x": 1242, "y": 753
|
| 487 |
-
},
|
| 488 |
-
"looks_size": {
|
| 489 |
-
"opcode": "looks_size", "next": None, "parent": None,
|
| 490 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 491 |
-
"x": 1249, "y": 876
|
| 492 |
-
},
|
| 493 |
-
|
| 494 |
-
# operator_block.json
|
| 495 |
-
"operator_add": {
|
| 496 |
-
"opcode": "operator_add", "next": None, "parent": None,
|
| 497 |
-
"inputs": {"NUM1": [1, [4, ""]], "NUM2": [1, [4, ""]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 498 |
-
"x": 128, "y": 153
|
| 499 |
-
},
|
| 500 |
-
"operator_subtract": {
|
| 501 |
-
"opcode": "operator_subtract", "next": None, "parent": None,
|
| 502 |
-
"inputs": {"NUM1": [1, [4, ""]], "NUM2": [1, [4, ""]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 503 |
-
"x": 134, "y": 214
|
| 504 |
-
},
|
| 505 |
-
"operator_multiply": {
|
| 506 |
-
"opcode": "operator_multiply", "next": None, "parent": None,
|
| 507 |
-
"inputs": {"NUM1": [1, [4, ""]], "NUM2": [1, [4, ""]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 508 |
-
"x": 134, "y": 278
|
| 509 |
-
},
|
| 510 |
-
"operator_divide": {
|
| 511 |
-
"opcode": "operator_divide", "next": None, "parent": None,
|
| 512 |
-
"inputs": {"NUM1": [1, [4, ""]], "NUM2": [1, [4, ""]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 513 |
-
"x": 138, "y": 359
|
| 514 |
-
},
|
| 515 |
-
"operator_random": {
|
| 516 |
-
"opcode": "operator_random", "next": None, "parent": None,
|
| 517 |
-
"inputs": {"FROM": [1, [4, "1"]], "TO": [1, [4, "10"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 518 |
-
"x": 311, "y": 157
|
| 519 |
-
},
|
| 520 |
-
"operator_gt": {
|
| 521 |
-
"opcode": "operator_gt", "next": None, "parent": None,
|
| 522 |
-
"inputs": {"OPERAND1": [1, [10, ""]], "OPERAND2": [1, [10, "50"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 523 |
-
"x": 348, "y": 217
|
| 524 |
-
},
|
| 525 |
-
"operator_lt": {
|
| 526 |
-
"opcode": "operator_lt", "next": None, "parent": None,
|
| 527 |
-
"inputs": {"OPERAND1": [1, [10, ""]], "OPERAND2": [1, [10, "50"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 528 |
-
"x": 345, "y": 286
|
| 529 |
-
},
|
| 530 |
-
"operator_equals": {
|
| 531 |
-
"opcode": "operator_equals", "next": None, "parent": None,
|
| 532 |
-
"inputs": {"OPERAND1": [1, [10, ""]], "OPERAND2": [1, [10, "50"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 533 |
-
"x": 345, "y": 372
|
| 534 |
-
},
|
| 535 |
-
"operator_and": {
|
| 536 |
-
"opcode": "operator_and", "next": None, "parent": None,
|
| 537 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 538 |
-
"x": 701, "y": 158
|
| 539 |
-
},
|
| 540 |
-
"operator_or": {
|
| 541 |
-
"opcode": "operator_or", "next": None, "parent": None,
|
| 542 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 543 |
-
"x": 705, "y": 222
|
| 544 |
-
},
|
| 545 |
-
"operator_not": {
|
| 546 |
-
"opcode": "operator_not", "next": None, "parent": None,
|
| 547 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 548 |
-
"x": 734, "y": 283
|
| 549 |
-
},
|
| 550 |
-
"operator_join": {
|
| 551 |
-
"opcode": "operator_join", "next": None, "parent": None,
|
| 552 |
-
"inputs": {"STRING1": [1, [10, "apple "]], "STRING2": [1, [10, "banana"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 553 |
-
"x": 663, "y": 378
|
| 554 |
-
},
|
| 555 |
-
"operator_letter_of": {
|
| 556 |
-
"opcode": "operator_letter_of", "next": None, "parent": None,
|
| 557 |
-
"inputs": {"LETTER": [1, [6, "1"]], "STRING": [1, [10, "apple"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 558 |
-
"x": 664, "y": 445
|
| 559 |
-
},
|
| 560 |
-
"operator_length": {
|
| 561 |
-
"opcode": "operator_length", "next": None, "parent": None,
|
| 562 |
-
"inputs": {"STRING": [1, [10, "apple"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 563 |
-
"x": 664, "y": 521
|
| 564 |
-
},
|
| 565 |
-
"operator_contains": {
|
| 566 |
-
"opcode": "operator_contains", "next": None, "parent": None,
|
| 567 |
-
"inputs": {"STRING1": [1, [10, "apple"]], "STRING2": [1, [10, "a"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 568 |
-
"x": 634, "y": 599
|
| 569 |
-
},
|
| 570 |
-
"operator_mod": {
|
| 571 |
-
"opcode": "operator_mod", "next": None, "parent": None,
|
| 572 |
-
"inputs": {"NUM1": [1, [4, ""]], "NUM2": [1, [4, ""]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 573 |
-
"x": 295, "y": 594
|
| 574 |
-
},
|
| 575 |
-
"operator_round": {
|
| 576 |
-
"opcode": "operator_round", "next": None, "parent": None,
|
| 577 |
-
"inputs": {"NUM": [1, [4, ""]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 578 |
-
"x": 307, "y": 674
|
| 579 |
-
},
|
| 580 |
-
"operator_mathop": {
|
| 581 |
-
"opcode": "operator_mathop", "next": None, "parent": None,
|
| 582 |
-
"inputs": {"NUM": [1, [4, ""]]}, "fields": {"OPERATOR": ["abs", None]}, "shadow": False, "topLevel": True,
|
| 583 |
-
"x": 280, "y": 754
|
| 584 |
-
},
|
| 585 |
-
|
| 586 |
-
# sensing_block.json
|
| 587 |
-
"sensing_touchingobject": {
|
| 588 |
-
"opcode": "sensing_touchingobject", "next": None, "parent": None,
|
| 589 |
-
"inputs": {"TOUCHINGOBJECTMENU": [1, "sensing_touchingobjectmenu"]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 590 |
-
"x": 359, "y": 116
|
| 591 |
-
},
|
| 592 |
-
"sensing_touchingobjectmenu": {
|
| 593 |
-
"opcode": "sensing_touchingobjectmenu", "next": None, "parent": "sensing_touchingobject",
|
| 594 |
-
"inputs": {}, "fields": {"TOUCHINGOBJECTMENU": ["_mouse_", None]}, "shadow": True, "topLevel": False
|
| 595 |
-
},
|
| 596 |
-
"sensing_touchingcolor": {
|
| 597 |
-
"opcode": "sensing_touchingcolor", "next": None, "parent": None,
|
| 598 |
-
"inputs": {"COLOR": [1, [9, "#55b888"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 599 |
-
"x": 360, "y": 188
|
| 600 |
-
},
|
| 601 |
-
"sensing_coloristouchingcolor": {
|
| 602 |
-
"opcode": "sensing_coloristouchingcolor", "next": None, "parent": None,
|
| 603 |
-
"inputs": {"COLOR": [1, [9, "#d019f2"]], "COLOR2": [1, [9, "#2b0de3"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 604 |
-
"x": 348, "y": 277
|
| 605 |
-
},
|
| 606 |
-
"sensing_askandwait": {
|
| 607 |
-
"opcode": "sensing_askandwait", "next": None, "parent": None,
|
| 608 |
-
"inputs": {"QUESTION": [1, [10, "What's your name?"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 609 |
-
"x": 338, "y": 354
|
| 610 |
-
},
|
| 611 |
-
"sensing_answer": {
|
| 612 |
-
"opcode": "sensing_answer", "next": None, "parent": None,
|
| 613 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 614 |
-
"x": 782, "y": 111
|
| 615 |
-
},
|
| 616 |
-
"sensing_keypressed": {
|
| 617 |
-
"opcode": "sensing_keypressed", "next": None, "parent": None,
|
| 618 |
-
"inputs": {"KEY_OPTION": [1, "sensing_keyoptions"]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 619 |
-
"x": 762, "y": 207
|
| 620 |
-
},
|
| 621 |
-
"sensing_keyoptions": {
|
| 622 |
-
"opcode": "sensing_keyoptions", "next": None, "parent": "sensing_keypressed",
|
| 623 |
-
"inputs": {}, "fields": {"KEY_OPTION": ["space", None]}, "shadow": True, "topLevel": False
|
| 624 |
-
},
|
| 625 |
-
"sensing_mousedown": {
|
| 626 |
-
"opcode": "sensing_mousedown", "next": None, "parent": None,
|
| 627 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 628 |
-
"x": 822, "y": 422
|
| 629 |
-
},
|
| 630 |
-
"sensing_mousex": {
|
| 631 |
-
"opcode": "sensing_mousex", "next": None, "parent": None,
|
| 632 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 633 |
-
"x": 302, "y": 528
|
| 634 |
-
},
|
| 635 |
-
"sensing_mousey": {
|
| 636 |
-
"opcode": "sensing_mousey", "next": None, "parent": None,
|
| 637 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 638 |
-
"x": 668, "y": 547
|
| 639 |
-
},
|
| 640 |
-
"sensing_setdragmode": {
|
| 641 |
-
"opcode": "sensing_setdragmode", "next": None, "parent": None,
|
| 642 |
-
"inputs": {}, "fields": {"DRAG_MODE": ["draggable", None]}, "shadow": False, "topLevel": True,
|
| 643 |
-
"x": 950, "y": 574
|
| 644 |
-
},
|
| 645 |
-
"sensing_loudness": {
|
| 646 |
-
"opcode": "sensing_loudness", "next": None, "parent": None,
|
| 647 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 648 |
-
"x": 658, "y": 703
|
| 649 |
-
},
|
| 650 |
-
"sensing_timer": {
|
| 651 |
-
"opcode": "sensing_timer", "next": None, "parent": None,
|
| 652 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 653 |
-
"x": 459, "y": 671
|
| 654 |
-
},
|
| 655 |
-
"sensing_resettimer": {
|
| 656 |
-
"opcode": "sensing_resettimer", "next": None, "parent": None,
|
| 657 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 658 |
-
"x": 462, "y": 781
|
| 659 |
-
},
|
| 660 |
-
"sensing_of": {
|
| 661 |
-
"opcode": "sensing_of", "next": None, "parent": None,
|
| 662 |
-
"inputs": {"OBJECT": [1, "sensing_of_object_menu"]}, "fields": {"PROPERTY": ["backdrop #", None]}, "shadow": False, "topLevel": True,
|
| 663 |
-
"x": 997, "y": 754
|
| 664 |
-
},
|
| 665 |
-
"sensing_of_object_menu": {
|
| 666 |
-
"opcode": "sensing_of_object_menu", "next": None, "parent": "sensing_of",
|
| 667 |
-
"inputs": {}, "fields": {"OBJECT": ["_stage_", None]}, "shadow": True, "topLevel": False
|
| 668 |
-
},
|
| 669 |
-
"sensing_current": {
|
| 670 |
-
"opcode": "sensing_current", "next": None, "parent": None,
|
| 671 |
-
"inputs": {}, "fields": {"CURRENTMENU": ["YEAR", None]}, "shadow": False, "topLevel": True,
|
| 672 |
-
"x": 627, "y": 884
|
| 673 |
-
},
|
| 674 |
-
"sensing_dayssince2000": {
|
| 675 |
-
"opcode": "sensing_dayssince2000", "next": None, "parent": None,
|
| 676 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 677 |
-
"x": 959, "y": 903
|
| 678 |
-
},
|
| 679 |
-
"sensing_username": {
|
| 680 |
-
"opcode": "sensing_username", "next": None, "parent": None,
|
| 681 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 682 |
-
"x": 833, "y": 757
|
| 683 |
-
},
|
| 684 |
-
|
| 685 |
-
# sound_block.json
|
| 686 |
-
"sound_playuntildone": {
|
| 687 |
-
"opcode": "sound_playuntildone", "next": None, "parent": None,
|
| 688 |
-
"inputs": {"SOUND_MENU": [1, "sound_sounds_menu"]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 689 |
-
"x": 253, "y": 17
|
| 690 |
-
},
|
| 691 |
-
"sound_sounds_menu": {
|
| 692 |
-
"opcode": "sound_sounds_menu", "next": None, "parent": "sound_playuntildone and sound_play",
|
| 693 |
-
"inputs": {}, "fields": {"SOUND_MENU": ["Meow", None]}, "shadow": True, "topLevel": False
|
| 694 |
-
},
|
| 695 |
-
"sound_play": {
|
| 696 |
-
"opcode": "sound_play", "next": None, "parent": None,
|
| 697 |
-
"inputs": {"SOUND_MENU": [1, "sound_sounds_menu"]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 698 |
-
"x": 245, "y": 122
|
| 699 |
-
},
|
| 700 |
-
"sound_stopallsounds": {
|
| 701 |
-
"opcode": "sound_stopallsounds", "next": None, "parent": None,
|
| 702 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 703 |
-
"x": 253, "y": 245
|
| 704 |
-
},
|
| 705 |
-
"sound_changeeffectby": {
|
| 706 |
-
"opcode": "sound_changeeffectby", "next": None, "parent": None,
|
| 707 |
-
"inputs": {"VALUE": [1, [4, "10"]]}, "fields": {"EFFECT": ["PITCH", None]}, "shadow": False, "topLevel": True,
|
| 708 |
-
"x": 653, "y": 14
|
| 709 |
-
},
|
| 710 |
-
"sound_seteffectto": {
|
| 711 |
-
"opcode": "sound_seteffectto", "next": None, "parent": None,
|
| 712 |
-
"inputs": {"VALUE": [1, [4, "100"]]}, "fields": {"EFFECT": ["PITCH", None]}, "shadow": False, "topLevel": True,
|
| 713 |
-
"x": 653, "y": 139
|
| 714 |
-
},
|
| 715 |
-
"sound_cleareffects": {
|
| 716 |
-
"opcode": "sound_cleareffects", "next": None, "parent": None,
|
| 717 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 718 |
-
"x": 651, "y": 242
|
| 719 |
-
},
|
| 720 |
-
"sound_changevolumeby": {
|
| 721 |
-
"opcode": "sound_changevolumeby", "next": None, "parent": None,
|
| 722 |
-
"inputs": {"VOLUME": [1, [4, "-10"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 723 |
-
"x": 645, "y": 353
|
| 724 |
-
},
|
| 725 |
-
"sound_setvolumeto": {
|
| 726 |
-
"opcode": "sound_setvolumeto", "next": None, "parent": None,
|
| 727 |
-
"inputs": {"VOLUME": [1, [4, "100"]]}, "fields": {}, "shadow": False, "topLevel": True,
|
| 728 |
-
"x": 1108, "y": 5
|
| 729 |
-
},
|
| 730 |
-
"sound_volume": {
|
| 731 |
-
"opcode": "sound_volume", "next": None, "parent": None,
|
| 732 |
-
"inputs": {}, "fields": {}, "shadow": False, "topLevel": True,
|
| 733 |
-
"x": 1136, "y": 123
|
| 734 |
-
},
|
| 735 |
-
}
|
| 736 |
-
|
| 737 |
-
# #Example input with opcodes from various categories
|
| 738 |
-
# input_opcodes = [
|
| 739 |
-
# {"opcode": "sound_play", "count": 2}, # New: Sound block with menu
|
| 740 |
-
# {"opcode": "sound_playuntildone", "count": 2}, # New: Sound block with menu
|
| 741 |
-
# ]
|
| 742 |
-
|
| 743 |
-
# Example input with opcodes from various categories
|
| 744 |
-
input_opcodes = [
|
| 745 |
-
{"opcode": "sound_play", "count": 2},
|
| 746 |
-
{"opcode": "sound_playuntildone", "count": 2},
|
| 747 |
-
{"opcode":"motion_goto","count":2},
|
| 748 |
-
{"opcode":"motion_glideto","count":2},
|
| 749 |
-
{"opcode":"looks_switchbackdropto","count":2},
|
| 750 |
-
{"opcode":"looks_switchcostumeto","count":2},
|
| 751 |
-
{"opcode":"control_create_clone_of","count":2},
|
| 752 |
-
{"opcode":"sensing_touchingobject","count":2},
|
| 753 |
-
{"opcode":"sensing_of","count":2},
|
| 754 |
-
{"opcode":"sensing_keypressed","count":2},
|
| 755 |
-
{"opcode":"motion_pointtowards","count":2},
|
| 756 |
-
]
|
| 757 |
-
|
| 758 |
-
generated_output = generate_blocks_from_opcodes(input_opcodes, all_block_definitions)
|
| 759 |
-
print(json.dumps(generated_output, indent=2))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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