What It Does
Autouija is an automatic Ouija board.1 When you input your query, Autoija’s planchette moves around the board to spell out the answer. Instead of inputting a query you may type “goodbye” to end the session. Like Oraskul, Autouija‘s responses include all those of a Magic 8-Ball, plus a few surprises. Autouija has a button that allows you to play the melody from “Tubular Bells” (a nod to The Exorcist, which features a Oujia board).
How It Works
Most of Autouija‘s work is done by the
Planchette sprite, which uses several lists:
cList— the capital letters A–Z, a space character, and the numbers 1–0
pList— all of Autouija‘s response phrases, e.g., “IT IS CERTAIN,” “VERY DOUBTFUL,” &c.
partings— all the phrases a player may type to indicate her desire to end the session (“bye,” “goodbye,” “exit,” “quit,” &c.)
xList— the x (horizontal) positions of the letters and numbers on the board
yList— the y (vertical) positions of the letters and numbers
When you input your query, Autouija first checks to see if the word or phrase (called a string in computer parlance) you typed is contained within the
partings list; if it is, then Autouija broadcasts the
sayBye message which activates a script to make the planchette glide to position x:-77, y:-95 and then to x:83, y: -95, so covering the GOODBYE text on the board. Otherwise, Autouija generates a random number between 1 and 12 (stored in the variable
- If the number is between 1 and 7, Autouija responds with one of the phrases in
- If the number is 8 or 9, Autouija responds YES;
- If the number is 10 or 11, Autouia responds NO;
- If the number is 12, Autouija responds GOODBYE (effectively, it hangs up on you).
To spell out a string from
pList, Autouija first randomly selects which string to spell out, then it loops through the string from beginning to end one character at a time, looks up the character in
cList to get its item number (i.e., index value), then looks up the
yList values corresponding to that item number. E.g., to spell out “YOU MAY RELAY ON IT,” Autouija…
- Finds the first character in the string, ‘Y’.
- Looks through every item in
cListuntil it finds ‘Y’, and then it remembers the item number for ‘Y’: 25.
- Looks up the values for item number 25 in
yList25, and sends the planchette to that pair of coordinates.
- Repeats the above steps for the next character (‘O’) in the string, &c., until the entire string has been spelled out.
Autouija keeps track of the last character used (
previousChar) and compares it to the current character (
currentChar) so that if a string has two or more of the same character in sequence (e.g., the ‘BETTER’ in “BETTER NOT TELL YOU NOW” has two T’s together), the planchette spins around in a circle to indicate the same letter.
…causes the planchette to tilt slightly left or right as it glides from one side of the board to the other, making the movement appear more natural than if the planchette were always oriented straight up and down as it moved.
Music sprite uses Scratch’s music blocks to play the melody from “Tubular Bells” (alternatively, I could have imported an audio file of the song and played that).
Make It Better
- You can modify the contents of
pListto make Autouija spell out whatever you like. Just make sure to avoid punctuation (you can use lower or uppercase letters; Scratch sees ‘a’ and ‘A’ as the same thing when making a Boolean comparison of them: (
a) = (
A) is true).
- Use a board of your own design.
- As the planchette tilts or spins, its light glare and shadow move with it in an unnatural way. How could you make the glare and shadow appear more natural? Hint: create separate sprites for each, and have them move relative to the planchette’s position, with the shadow changing also relative to the planchette’s orientation.
- The button to toggle the music on/off is located in a bad place: it is blocked from being clicked when the “What is your query?” input box is showing. Where else could you place the button, or what are some other ways you could turn the music on or off?
Ouija Board image from here, and modified by me.
“Tubular Bells” melody by Mike Oldfield; MIDI files here.