My Local Guide: AI Assistant

Objective

Create a Scratch project that acts as a simple AI assistant. It asks the user where they want to go and provides directions or information using questions and answers.

Algorithm

  1. Start.
  2. Display a welcome message.
  3. Ask the visitor where they want to go.
  4. Store the answer in a variable called Place.
  5. Check the user’s answer.
  6. If the answer is School, provide school directions.
  7. Else if the answer is Hospital, provide hospital directions.
  8. Else if the answer is Railway Station, provide directions.
  9. Else if the answer is Market, provide directions.
  10. Otherwise, display “Sorry, I don’t know that place.”
  11. Ask if the user needs more help.
  12. If Yes, repeat.
  13. Otherwise, say “Have a nice day!”
  14. Stop.

Variables

  • Place
  • Help

Scratch Blocks

when green flag clicked

say "Hello! I am your Local AI Assistant." for 2 seconds

forever

ask "Where would you like to go? (School/Hospital/Market/Railway Station)" and wait

set [Place v] to (answer)

if <(Place) = "School"> then
    say "Go straight for 500 metres and turn left." for 4 seconds

else
if <(Place) = "Hospital"> then
    say "Turn right and walk for 300 metres." for 4 seconds

else
if <(Place) = "Market"> then
    say "Walk straight for 200 metres." for 4 seconds

else
if <(Place) = "Railway Station"> then
    say "Take the first left and continue for 1 km." for 4 seconds

else
    say "Sorry, I don't know that place." for 3 seconds
end
end
end
end

ask "Do you need more help? (Yes/No)" and wait

if <(answer) = "No"> then
    say "Thank you! Have a nice day." for 3 seconds
    stop all
end

Scratch Blocks Used

You can design a simple AI assistant in Scratch by using the following blocks.

Open Scratch or Tinkercad

When Green Flag Clicked, Looks, Say, Sensing, Ask and Wait, Answer, VariablesSet, VariableControl, Forever, If-Else, Stop All, Operators= (Equals)


Suggested Sprites

  • πŸ€– Robot (AI Assistant)
  • 🧍 Visitor
  • 🏫 School
  • πŸ₯ Hospital
  • πŸš‰ Railway Station
  • πŸ›οΈ Market

Suggested Backdrops

  • Local City Map
  • Town Road
  • Market Area
  • School Campus

Extensions (AI-like Features)

You can make the assistant smarter by:

  • Speaking the directions using the Text-to-Speech extension.
  • Asking for the user’s preferred language (English/Hindi).
  • Giving information about nearby places like parks, banks, bus stops, or restaurants.
  • Showing a simple map by switching backdrops based on the selected destination.
  • Playing a short welcome sound when the project starts.

with Text-to-Speech

Step 1: Add the Text-to-Speech

Extension

  1. Open Scratch.
  2. Click Extensions (bottom-left corner).
  3. Select Text-to-Speech.
  4. New blocks will appear in the purple extension category.

Step 2: Set the Voice
when green flag clicked

set voice to [ALTO v]
set language to [English (en) v]

You can also choose voices such as:

  • ALTO
  • TENOR
  • SQUEAK
  • GIANT
  • KITTEN

Step 3: Welcome Message
when green flag clicked

say "Welcome! I am your AI Local Guide." for 2 seconds

speak "Welcome! I am your AI Local Guide."

Step 4: Speak Directions
School
if <(Place) = "School"> then

say "Go straight for 500 metres and turn left." for 4 seconds

speak "Go straight for five hundred metres and turn left."

Hospital
if <(Place) = "Hospital"> then

say "Turn right and walk for 300 metres."

speak "Turn right and walk for three hundred metres."

Railway Station
if <(Place) = "Railway Station"> then

say "Walk for one kilometre."

speak "Walk for one kilometre."

Market
if <(Place) = "Market"> then

say "Walk straight for 200 metres."

speak "Walk straight for two hundred metres."

Unknown Place
else

say "Sorry, I don't know that place."

speak "Sorry, I don't know that place."

Complete AI Assistant Flow

when green flag clicked

set voice to [ALTO v]
set language to [English (en) v]

speak "Hello! Welcome to our locality."

ask "Where would you like to go?" and wait

set [Place v] to (answer)

if <(Place) = "School"> then
    speak "Go straight for five hundred metres and turn left."

else if <(Place) = "Hospital"> then
    speak "Turn right and walk for three hundred metres."

else if <(Place) = "Market"> then
    speak "Walk straight for two hundred metres."

else if <(Place) = "Railway Station"> then
    speak "Take the first left and continue for one kilometre."

else
    speak "Sorry, I don't know that place."
end

Ideas to Make It More Like an AI Assistant

  • 🌍 Ask the user to choose a language (English or Hindi) and switch the spoken language.
  • πŸ—ΊοΈ Change the backdrop to show a simple map of the selected destination.
  • 🎀 Add a microphone button using the Speech-to-Text extension (available in supported versions of Scratch) so users can speak their destination.
  • πŸ”Š Play a welcome sound before speaking.
  • 😊 Add animated expressions (happy, thinking, pointing) to the robot sprite while it talks.
  • πŸ“ Include more destinations such as the bank, bus stop, post office, park, pharmacy, and police station.

Leave a Comment

Your email address will not be published. Required fields are marked *