Scratch User Guide: Help, I'm Stuck! Troubleshooting a Program in Scratch
Scratch Tutorial Note
This user guide was written for Scratch version 1.4, which is available at the Scratch 1.4 download page. Additional tutorials are available on the download page. Information about the most recent version of Scratch is available at the MIT Scratch website.
Part of learning Scratch is figuring out how to make scripts (sets of instruction blocks snapped together) that make the sprites do what you want them to do. In the beginning, this might take some trial and error. It is completely normal for a program to not run perfectly the first time! Keep trying and experimenting—you might be surprised at how skilled you become at working out solutions. Below are some tips for how to get your Scratch program working the way you want. Remember, be patient and don't give up!
Figuring Out Where the Problem Is
The simple truth is, you can't "fix" a problem until you know "what" and "where" the problem is. If you've created a script and it doesn't perform the way you expected, you might have forgotten to put in some blocks or used the wrong blocks. You can try one or more of the methods below to figure out what part of your script isn't working the way you anticipated.
- Method 1: If your script doesn't perform the way you expected, you can diagnose where the problem is by stepping through the project.
- Under the "Edit" category, click on "Start Single Stepping." Now when you run your program, each block will be highlighted as the computer performs that instruction.
- If you want to slow down how fast the blocks (instructions) are being executed, you can also choose "Set Single Stepping" and select "Flash blocks (slow)" from the Edit category. This will slow down the action (it's kind of like watching something in slow motion), so that you can better see what is happening in each part of the code and correct any problems.
- Even with slow single-stepping, it might be difficult at times to know "where you are at" and whether or not different scripts are being activated as you intended. To help keep track of this, you can add blocks to your scripts, like a "Say" block that says "hello" or "starting xyz script now," that can give you feedback about when a script is functioning.
- Method 2: If you had a script, or set of scripts, that were working, but stopped working after you added some additional blocks, you know that the problem lies somewhere in the new additions you made.
- If you've saved an earlier version of your program (which is always a good idea!), you can go back to that and re-evaluate your changes.
- If you don't have a saved working version, you can start breaking apart your script.
- Break each script into smaller pieces and make sure they work as you expect.
- When you find a piece that doesn't do what you expected, you've figured out where the problem is and can start trying other solutions.
- Method 3: If you are using variables in your script (symbols that can take on different values), it can be helpful to know what the values of these variables are as your script executes.
- Under the Variables category, there is a "Show Variables" block that will allow you to see the values of different variables as the program runs.
- You can also use the "Say" block under the Looks category to "say" the value of the variable.
Finding the Solution to the Problem
Once you've figured out where your problem is, it might be obvious to you what the solution is. If so, great! At other times, you might be left scratching your head. If that's the case, it might be time to step away from the computer for a moment and grab a pencil and pad of paper. Write down what you want each of your scripts to do. Think about the kinds of blocks you'd need to execute the task. Once you have the theory straight in your head, go back and look at your program again. Did you miss something the first time?
- If you're still stuck and need help figuring out the solution, or are just looking for some inspiration for your next programming project, there are a lot of places to turn. Table 1 lists a variety of resources.
Type of Resource | Citation |
---|---|
Book for beginners about programming with Scratch. | Ford Jr., Jerry Lee. Scratch Programming for Teens. Boston: Course Technology, 2009. |
Book for beginners about programming with Scratch. | Badger, Michael. Scratch 1.4 Beginners Guide. Packt Publishing, 2009. |
Official Scratch getting started resources | https://scratch.mit.edu/tips |
Scratch wiki with more information about Scratch | https://wiki.scratch.mit.edu/wiki/Scratch_Wiki_Home |
Scratch forum where you can ask questions | https://scratch.mit.edu/discuss/ |
- Looking at other people's programs is a good way to learn how to do something in a programming language. You can look for programs that do the things you want yours to do. Once you find a good example program, look at the program's scripts and see what blocks were used, and in what order. Try to adapt the solution to your project. It might help to look at several programs by different people to see how different people tackle the same problem.
- The Scratch download comes with several completed projects you can use to find programming solutions. To look at these, click on the "File" menu at the top of the screen in Scratch and choose "Open" and then "Examples."
- You can also view and download completed projects made by other Scratch programmers at MIT's Scratch homepage.
- Other programmers can also be a great resource. Try asking friends or family members who have programming experience for tips and advice, or log on to the MIT scratch forums and post a question. Make sure to point out what version of Scratch you are using.
- Important Note: Your personal data is extremely valuable, particularly on the Internet, and can be used against you if someone else gets a hold of it. Keep it protected. Never give your real name, address, phone number, the name of your school, or a picture of yourself to anyone online. Email addresses, user account names, and screen names should not be your real name, the name of your school, or some combination of the two.