Entries in PictureScript (1)

Tuesday
Aug092011

Tutorial - Making a Coloring Book App

[Update: 6/10/14 - I just found this article today, that explains much more elegantly the why of PictureScript. Learnable Programming]

This video shows how simple notation can create a non-trivial application using PictureScript.  There are some notes about the script below the video.  Please take our survey after watching the video. Click here to take the Survey and/or register for a free Demo App.

Download the Coloring Book Script (source code here).

Music is from www.danosongs.com

Can't view the video?  Try http://goo.gl/YTMJm .

The editor you see in the movie is an in-house tool for testing PictureScript, eventually many of its features will be released in an editor called PictureScribe. The four windows shown include a sandbox for testing the PictureScript messages, a PictureScript Dictionary, a Message Editor, and a Tutorial Message viewer.

In this tutorial I have already typed in all the messages into the editor.  By checking the "Menu" box the list of messages act like a menu.  I simply click on a line and the message on that line is sent and you see the results in the sandbox window. If the "tutorial" checkbox is checked, the operation is slowed and the message is "Typed" into the tutorial window to let you view the message and digest it before the message is actually sent.  Of course the messages can be run together as a script by clicking on the "Do" button. 

Parts of the video get pretty repetitious, but since this is probably most people's first introduction into PictureScript, I figured that with each repetition, "make the next one blue", "make the next one green"... it would give people a chance to absorb the concept better. So, for much of the exercise, each setting for each item was messaged separately.

This tutorial also introduces the idea that you aren't limited to selecting the individual items in order.  You can use terms like "the fifth one" and "the last one".  In other cases you could also select several items.  "the last three" or "the first two" or "the middle four" for example.

Referring to groups of items can significantly cut down on the number of messages required.

Here are some alternative messages that would have made the script much simpler.

make 8 squares  // same as in the video

move them near the bottom // same as in the video

Make them red, white, blue, green, yellow, orange, purple, and black  // replaces 8 messages

Make their touchScript "make the paint my color"  // replaces 8 individual messages