Skip to content
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

CLI: scratchblocks output #131

Open
towerofnix opened this issue Apr 24, 2024 · 2 comments
Open

CLI: scratchblocks output #131

towerofnix opened this issue Apr 24, 2024 · 2 comments
Labels
command-line Features or improvements for sb-edit CLI fmt: scratchblocks Pertains to scratchblocks format (forum BBCode)

Comments

@towerofnix
Copy link
Member

Following #129, we should be able to export to the other formats sb-edit has complete or partial support for.

Some notes:

  • scratchblocks conversion (Scratchblocks Export #15) does support exporting every sprite at once, though it discards / ignores assets like costumes, sounds, initial sprite position/state, etc. But that's OK, since scratchblocks isn't a programming language (boo hoo).
    • Again, since it's not a programming language, we don't have precedent for a specific format to represent the entire project at once by. The interface outputs a mapping of target name to string including all its scripts. It's not the interface's job to make a call on what to do with the output; the CLI needs to choose an output structure.
    • Any output structure will work; personally, we'd just put all the results in a folder and write a txt for each target, containing exactly the string output by toScratchblocks.
  • There's no standard file extension for scratchblocks (spoilers: .sb is used by Scratch 1.4 projects) so we can never infer this output type; it's up to the user to specify -ot scratchblocks / --output-type scratchblocks. Otherwise we'll just export the default (when to a folder), which is leopard.
  • We don't really need to support .zip output for scratchblocks, but it would be nice, because leopard-zip and sb3 are both already portable / easy-to-share output types.
    • The CLI uses JSZip for zipping Leopard output (it's certainly not part of toLeopard's own behavior). There's not really any logic to factor out here since we're skipping costume/sound output and JSZip's own interface is pretty dead simple.
@towerofnix towerofnix added fmt: scratchblocks Pertains to scratchblocks format (forum BBCode) command-line Features or improvements for sb-edit CLI labels Apr 24, 2024
@PullJosh
Copy link
Collaborator

One use case I can see for this is if users want to copy a script from a Scratch project into bbcode on the Scratch forums. I'm wondering if it would be useful to provide an interactive terminal output option where you can use arrow keys to select a certain sprite, then arrow keys to select a certain script, and then view that script as scratchblocks and potentially copy it to your clipboard.

@towerofnix
Copy link
Member Author

That would be really awesome. I wonder how difficult it would be? I think it would be the most useful if you can see a full preview of the script you have selected as you navigate through (and not just, for example, guess based on the top block). But that involves either a full-screen interface or "repainting" a possibly large (e.g. 8-12 lines) region of the terminal. Commander (used in the CLI right now) appears to be much more about just making a useful entry interface, not doing interesting live interaction effects, so we'd probably need to find some other library to handle this stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
command-line Features or improvements for sb-edit CLI fmt: scratchblocks Pertains to scratchblocks format (forum BBCode)
Projects
None yet
Development

No branches or pull requests

2 participants