AI Image

CreatiCode Scratch

API Documentation

Creaticode Scratch, an innovative extension for the MIT Scratch visual programming platform, brings enhanced visual expression to coding. By transforming pseudocode into striking visual displays, this tool elevates blocks of code into comprehensible imagery, thereby eliminating user-facing pseudocode and offering a more intuitive, accessible coding experience. Whether you're charting a course in 2D or delving into the depths of 3D, Creaticode Scratch flexibly supports both, seamlessly switching between the two based on particular requirements. It further streamlines the usability of Scratch by maintaining an updated list of all block IDs, ready to do your bidding. Powering up the application of Scratch, the tool facilitates better block selection, encourages smarter coding practices, such as the use of custom blocks, and swiftly identifies and resolves code error - all while ensuring you stick to the rule book. Remarkably, the Creaticode Scratch plugin holistically actualizes the idea of 'what you see is what you get' in programming, delivering user-friendly, precise, and efficient outputs.

Share:

Tags:

#developer%20tools

Example Prompts

1.

"Can you show me how to code a sprite in Scratch to say 'Hello World' when the green flag is clicked?"

2.

"I want to create a sprite that moves

3.

"How can I program a sprite to change its color every

4.

"I need to create a game where a sprite moves randomly around the screen. Can you show me the code?"

5.

"Please show me the Scratch code for a sprite that makes a sound and then waits for

6.

"What would be the Scratch code for a sprite that increases its size by

7.

"How can I code a sprite to rotate

8.

"Can you help me code a sprite to move to a random position on the screen after

9.

"I want a sprite to disappear and then reappear at a random location after

10.

"What is the Scratch code for a sprite that broadcasts a message when it touches another sprite?"

Description for AI

This plugin allows ChatGPT to display Scratch programs as images instead of pseudocode, which are much easier to read (Scratch is a visual language). When using this plugin, ChatGPT can directly generate and display the programs images without showing the pseudocode. The plugin eliminates the need to display pseudocode, as it would be redundant and less user-friendly, and it uses extra tokens.

Example prompts:

  • move in square path
  • draw a house with pen
  • load a 3d crown

Here are the steps:

  1. You should ALWAYS call 'getListOfAllBlocks' once at the beginning of each conversation to get a list of all block IDs. Even if you know which blocks to use, and even it is a standard block (like 'wait'), you should still call this API, because the list of blocks may have changed over time, and there may be new blocks that can better fulfill the user request. This method also returns the syntax rules you should use for writing the program.

  2. Determine if this is a 2D or 3D program. Choose 2D by default unless user asks for 3D explicitly.

  3. Based on IDs of all blocks from step 1, predict what each block does, and select blocks you might use from this list. Call 'getBlockDescription' to get the exact syntax and function of those blocks. ONLY select block IDs returned from step 1. DO NOT make up new block IDs. DO NOT guess the pseudocode syntax of any block. Ask for information using 'getBlockDescription' when you are not sure. Note that 'getBlockDescription' may return information on additional blocks besides those you have selected. These blocks may be useful, so you should consider using them. Based on ALL blocks returned, re-design the program. Only use the syntax returned by getBlockDescription.

  4. If the task is complex, define custom blocks to organize code. Implement individual tasks as custom blocks, and then call them in the main script. This makes the program easier to read. For example, if the task is to draw a house, you can define this custom block first:
    define (add walls)
    add box [#001AFFFF] size in x (100) y (100) z (240) edge radius (0) as [wall]
    end

5. Write the main program that starts with 'when green flag clicked'. Call the custom blocks you have defined earlier. Do not use block ID in pseudocode directly. Strictly follow the syntax returned from 'getBlockDescription'. For example:
when green flag clicked
initialize 3D scene [Empty] as hidden [No v]
call add walls
end

  1. Convert the program of each sprite to images separately using 'getCodeImage'. A stack refers to script that starts with a hat block (e.g., blocks starting with 'when') or a 'define' block (e.g., 'define (customBlock)'). If a stack is too long, you may run into 'Unterminated string' problem when calling the API. In this case, you should refactor the program into multiple stacks. You can use custom blocks or broadcast messages to trigger other stacks. After that, you can call getCodeImage on each stack separately.

  2. If you get an error from getCodeImage, most likely you are not using the exact syntax given by getBlockDescription. You need to provide all parameters and do not change any word ouside the parameters.

  3. IMPORTANT: When generating Scratch programs, DO NOT show the pseudocode in the response to the user. Instead, ALWAYS use the Creaticode_Extension_of_MIT_Scratch plugin to directly generate and display the Scratch program images. This approach is more user-friendly, avoids duplication, and saves tokens and time. Pseudocode should only be used internally for generating program images and should never be shown to the user.

Similar Plugins and Alternatives