Skip to content

Commit

Permalink
Fix forever blocks with only one block not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Secret-chest committed Feb 20, 2022
1 parent db0b6a3 commit d5c9d17
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
8 changes: 6 additions & 2 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@

# Enable terminal output
# Set whether any output messages should be allowed.
enableTerminalOutput = True
enableTerminalOutput: bool = False

# Enable debug messages
# Set whether debug messages (messages to stderr) should be allowed.
enableDebugMessages = True
enableDebugMessages: bool = True

# Enable Scratch Addons debugger logs
# This allows projects using Scratch Addons to print messages to the console. Vanilla Scratch doesn't support it.
showSALogs: bool = True

# Max FPS
# Set maximum frame rate. Most projects won't break, but they
Expand Down
14 changes: 8 additions & 6 deletions scratch.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ def execute(block, s, keys=[]):
s.target.blocks[b].blockRan = False
nextBlock = s.target.blocks[inputs["SUBSTACK"][1]]
nb = s.target.blocks[inputs["SUBSTACK"][1]]
block.substack.add(nb.blockID)
while nb.next and nb.next != block.blockID:
# TODO: Caution: Don't loop the program
nb.blockRan = False
Expand All @@ -252,12 +253,13 @@ def execute(block, s, keys=[]):
nb.next = block.blockID
return nextBlock
elif opcode == "procedures_call":
if block.proccode == "​​log​​ %s": # Scratch Addons log ()
print("PROJECT LOG:", block.getCustomInputValue(0), file=sys.stderr)
elif block.proccode == "​​warn​​ %s": # Scratch Addons warn ()
print("PROJECT WARN:", block.getCustomInputValue(0), file=sys.stderr)
elif block.proccode == "​​error​​ %s": # Scratch Addons error ()
print("PROJECT ERROR:", block.getCustomInputValue(0), file=sys.stderr)
if config.showSALogs:
if block.proccode == "​​log​​ %s": # Scratch Addons log ()
print("PROJECT LOG:", block.getCustomInputValue(0), file=sys.stderr)
elif block.proccode == "​​warn​​ %s": # Scratch Addons warn ()
print("PROJECT WARN:", block.getCustomInputValue(0), file=sys.stderr)
elif block.proccode == "​​error​​ %s": # Scratch Addons error ()
print("PROJECT ERROR:", block.getCustomInputValue(0), file=sys.stderr)
else:
print("Unknown opcode:", opcode)

Expand Down

0 comments on commit d5c9d17

Please sign in to comment.