@@ -367,18 +367,16 @@ def execute(block, s, events=eventContainer.EventContainer()):
367367 return nextBlock
368368
369369 elif opcode == "control_if" : # if <> then {...}
370- print ("entered if" , block .blockID )
371370 if block .target .blocks [inputs ["CONDITION" ][1 ]].evaluateBlockValue (events ):
372371 # If there are blocks, get them
373372 if inputs ["SUBSTACK" ][1 ]:
374- print ("Running if substack" )
375373 # No blocks will be flagged as ran inside a forever loop
376374 for b in block .substack :
377375 s .target .blocks [b ].blockRan = False
378376 nextBlock = s .target .blocks [inputs ["SUBSTACK" ][1 ]]
379377 nb = s .target .blocks [inputs ["SUBSTACK" ][1 ]]
380378 block .substack .add (nb .blockID )
381- while nb .next and nb .next != block .blockID :
379+ while nb .next and nb .next not in block .substack :
382380 nb .blockRan = False
383381 nb .waiting = False
384382 nb .timeDelay = 0
@@ -387,13 +385,10 @@ def execute(block, s, events=eventContainer.EventContainer()):
387385 block .substack .add (nb .blockID )
388386 nb .next = block .next
389387 block .blockRan = True
390- print (nextBlock .blockID )
391388 return nextBlock
392- print ("No substack" )
393389 block .blockRan = True
394390 # TODO why does it hang???
395391 else :
396- print ("condition is false, leaving" )
397392 block .blockRan = True
398393 return s .target .blocks [block .next ]
399394
@@ -460,9 +455,9 @@ def execute(block, s, events=eventContainer.EventContainer()):
460455 if block .proccode == "log %s" : # Scratch Addons log ()
461456 print ("[" , datetime .now ().strftime ("%H:%M:%S:%f" ), "]" , _ ("project-log" ), block .getCustomInputValue (0 ), file = sys .stderr )
462457 elif block .proccode == "warn %s" : # Scratch Addons warn ()
463- print (_ ("project-warn" ), block .getCustomInputValue (0 ), file = sys .stderr )
458+ print ("[" , datetime . now (). strftime ( "%H:%M:%S:%f" ), "]" , _ ("project-warn" ), block .getCustomInputValue (0 ), file = sys .stderr )
464459 elif block .proccode == "error %s" : # Scratch Addons error ()
465- print (_ ("project-error" ), block .getCustomInputValue (0 ), file = sys .stderr )
460+ print ("[" , datetime . now (). strftime ( "%H:%M:%S:%f" ), "]" , _ ("project-error" ), block .getCustomInputValue (0 ), file = sys .stderr )
466461
467462 else :
468463 print (_ ("unknown-opcode" ), opcode )
0 commit comments