(Redirected from How to Make a Bot)

Document stub.png This article or section may not have content matching Scratch Wiki editing standards. Please improve it according to Scratch Wiki:Guidelines and Scratch Wiki:Editing Conventions. (March 2025)
Reason: informal language
DocumentInQuestion.png It has been suggested that this page's contents be merged with the page Creating a Chat Bot. You can discuss this on the page's talk page. (March 2025)
Wikipedia-logo.svg For more information, see Internet bot on Wikipedia.

A bot is a robot that was made by people.

An AI bot (also known as Artificial Intelligence or simply AI) usually works in sites, apps, and in the real life.

In sites or apps, they can generate sentences, videos, music, images, and answers. In real life, AI can be a clone of someone, talk to someone, give advice, and can even do homework. Robots that work on websites are called web robots. These bots usually make designs, advertisements, images, etc.

Note Note: It is theoretically possible but not viable to make AI chatbots in scratch. However, an AI chatbot can be simulated by joining strings to create sentences.

Talking Robot

One may use any of the sprites to see the result, but it will be better to use a robot. Both of these will output the username when the spacebar is pressed.

Method 1

When green flag clicked
               forever               
               if <key (space v) pressed?> then
               ask [What's your name?] and wait 
               say (join [Nice name, ] (answer)

Method 2

When [space v] key pressed               
               ask [What's your name?] and wait 
               say (join [Nice name, ] (answer)

Moving Robot

An example of a draw of a bot.

Method 1

When green flag clicked
               set [x v] to (0)
               set [y v] to (0)
               go to x: (0) y: (0)
               forever
               change [x v] by (pick random (-1) to (1) 
               change [y v] by (pick random (-1) to (1)
When green flag clicked
               forever
               change x by (x)
               change y by (y)

This will make the bot move around.

When green flag clicked
               forever
               if <touching (edge v)?> then
               set [x v] to (0)
               set [y v] to (0)

This will make the bot stop when it touches the edge of the stage.

When green flag clicked
               forever
turn left (pick random (0) to ([abs v] of ((x)*(y))))degrees
turn right (pick random (0) to ([abs v] of (((x)*(y))-(x))))degrees

This will make the bot turn around.

Method 2

When green flag clicked
               forever
               move (pick random (1) to (10)) steps

This will make the bot move in the direction it is facing.

When green flag clicked
               forever
               point towards (mouse pointer v)

This will make it follow the mouse pointer.

Note Note: This bot will only follow your mouse pointer. If you want to make a bot that can walk itself, see Method 1.

Example Projects

Note Note: These are other AIs that do not follow this tutorial.
Cookies help us deliver our services. By using our services, you agree to our use of cookies.