Keyboard shortcuts

Press ← or β†’ to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Start Template

The start template is the simplest possible bot - a greeting flow that demonstrates the core interaction pattern of BASIC: greeting users and responding to their input.

Topic: Basic Greeting & Help Flow

This template is perfect for:

  • Learning BASIC fundamentals
  • Simple FAQ bots
  • Quick demos
  • Starting point for more complex bots

The Code

REM Basic greeting and help flow
SET user_name = "Guest"

TALK "Hello, " + user_name + "! How can I help you today?"
HEAR user_input

IF user_input = "help" THEN
    TALK "Sure, I can assist with account info, orders, or support."
ELSE
    TALK "Sorry, I didn't understand. Type 'help' for options."
END IF

Sample Dialogs

These conversations show how the start template works in real-world scenarios.

Dialog 1: User Asks for Help

Dialog 2: Unknown Input

Dialog 3: Personalized Greeting (Enhanced Version)

When you add user detection, the experience improves:

Keywords Used

KeywordPurpose
SETAssign a value to a variable
TALKSend a message to the user
HEARWait for and capture user input
IF/ELSEConditional branching based on input

How It Works

  1. Variable Setup: SET creates a variable to hold the user’s name
  2. Greeting: TALK sends the welcome message
  3. Input Capture: HEAR waits for user response
  4. Response Logic: IF/ELSE determines what to say back

Enhanced Version

Here’s the same template enhanced with LLM for natural understanding:

REM Smart greeting flow with LLM
SET user_name = "Guest"

TALK "Hello, " + user_name + "! How can I help you today?"
HEAR user_input

' Let LLM understand intent
intent = LLM "Classify this user message into one category: help, account, orders, support, other. Message: " + user_input

SWITCH intent
    CASE "help"
        TALK "I can assist with account info, orders, or support."
    CASE "account"
        TALK "Let me pull up your account information..."
    CASE "orders"
        TALK "I'll check on your recent orders..."
    CASE "support"
        TALK "Connecting you with our support team..."
    DEFAULT
        response = LLM "Respond helpfully to: " + user_input
        TALK response
END SWITCH

Customization Ideas

Add User Detection

' Get user info if available
user_name = GET BOT MEMORY "user_" + user_id + "_name"
IF user_name = "" THEN
    TALK "Hi there! What's your name?"
    HEAR user_name
    SET BOT MEMORY "user_" + user_id + "_name", user_name
END IF

TALK "Welcome back, " + user_name + "!"

Add Quick Reply Buttons

ADD SUGGESTION "Account Info"
ADD SUGGESTION "My Orders"
ADD SUGGESTION "Get Support"
TALK "What would you like help with?"
HEAR choice

Add Time-Based Greeting

hour = HOUR(NOW())
IF hour < 12 THEN
    greeting = "Good morning"
ELSE IF hour < 18 THEN
    greeting = "Good afternoon"
ELSE
    greeting = "Good evening"
END IF

TALK greeting + ", " + user_name + "!"