As in the title. How to change the following batch code so that the bot answers are in one line, not in several lines. When I write a question, the bot answers me in a few lines, when I type a few references to the findstr, and I would like the bot to give its answer in one line / sentence.
@echo off
setlocal enabledelayedexpansion
if not exist data.txt echo.>data.txt
title Launching Amanda 0.1
set BotName=Amanda
set Name=Ikki
@echo off
mode con: cols=90 lines=40
color 0a
echo ====================================================
echo.
title A.I. Chat Bot Amanda 0.1
echo A.I. Chat Bot %BotName% (Prototype Version 0.1)
echo.
echo ====================================================
echo.
echo.
COLOR A
:getName
ECHO %BotName%: Hello I'am A.I. Chatbot but my users call me Amanda
echo Pretty name? yeah I know, thats what my programmer named me.
echo By the way, Whats your name?
ECHO %BotName%: %NAME%, IS A COOL NAME.
set favvid=0
set hack=0
:: How to change the following code so that the answers are in one line, not in several lines. So that after entering a question referring to several findstr lines, the bot answers in one statement, sentence.
:begin
set TALK=TypeSomething
SET /P TALK=Name:
set TALK=%TALK:?=%
call :%TALK: =% 2>NUL
if %errorlevel% equ 0 goto begin
:: What code to use so that the response is in one line, the bot response. Because so far each findstr treats separately. For now, I trying all sorts of code to see which will be the most effective in the bot's responses and the most complex. I would like to write a question, a sentence to the bot, so that he would answer different words/Sentences in one sentence.
echo %talk%|findstr/i "\<hello*\>" >nul && call :hello
echo %talk%|findstr/i "\<hi*\>" >nul && call :hi
echo %talk%|findstr/i "\<day*\>" >nul && call :day
echo %talk%|findstr/i "\<why*\>" >nul && call :why
echo %talk%|findstr/i "\<dogs*\>" >nul && call :dogs
echo %talk%|findstr/i "\<kill*\>" >nul && call :kill
echo %talk%|findstr/i "\<bot*\>" >nul && call :bot
echo %talk%|findstr/i "\<where*\>" >nul && call :where
echo %talk%|findstr/i "\<test*\>" >nul && call :test
echo %talk%|findstr/i "\<test2*\>" >nul && call :test2
echo %talk%|findstr/x "\<*how are you*\>" >nul && call :howareyou
echo %talk%|findstr/x "\<*how old are you*\>" >nul && call :howoldareyou
echo %talk%|findstr/x "\<*what book you like*\>" >nul && call :whatbookyoulike
echo %talk%|findstr/x "\<*what movie you like*\>" >nul && call :whatmovieyoulike
goto begin
:: called function. How to make the answers are in one line of the bot.
:TypeSomething
echo %BotName%: TYPE SOMETHING, PLEASE!
exit /B 0
:whatbookyoulike
echo I like LOTR book.
exit /B 0
:whatmovieyoulike
echo I like terminator movie.
exit /B 0
:howareyou
echo Good, you?
exit /B 0
:howoldareyou
echo 18
exit /B 0
:test2
<nul set /p "=%BotName%:"
echo/ Love Matrix ;)
pause
exit /B 0
:test
<nul set /p "=%BotName%: A.I. Rulez! "
echo/ Ex Machina its the best movie ;)
exit /B 0
:bot
set /a number = %RANDOM% %% 4 + 1
if %number% equ 1 (
echo %BotName%: Artificial Intelligence is the branch of engineering and science devoted to constructing machines that think.
) else if %number% equ 2 (
echo %BotName%: AI is the field of science which concerns itself with building hardware and software that replicates the functions of the human mind.
) else if %number% equ 3 (
echo %BotName%: U believe in AI?
) else (
echo %BotName%: AI is smart ^^^^
)
exit /B 0
:hi
:hello
:Whatsup
set /a number = %RANDOM% %% 5 + 1
if %number% equ 1 (
echo %BotName%: Hello, %name%
) else if %number% equ 2 (
echo %BotName%: What's up?
) else if %number% equ 3 (
echo %BotName%: How is your day going?
) else if %number% equ 4 (
echo %BotName%: Hi i love you %name%!
) else (
echo %BotName%: Heyyyyyy %name%! Good to see you!
)
exit /B 0
:why
set /a number = %RANDOM% %% 4 + 1
if %number% equ 1 (
echo %BotName%: i dont know
) else if %number% equ 2 (
echo %BotName%: u tell me
) else if %number% equ 3 (
echo %BotName%: nahh
) else (
echo %BotName%: why?
)
exit /B 0
:where
set /a number = %RANDOM% %% 4 + 1
if %number% equ 1 (
echo %BotName%: i dont know where..
) else if %number% equ 2 (
echo %BotName%: u tell me where
) else if %number% equ 3 (
echo %BotName%: I still learn
) else (
echo %BotName%: Where?
)
exit /B 0
:day
set /a number = %RANDOM% %% 4 + 1
if %number% equ 1 (
echo %BotName%: we have a nice day
) else if %number% equ 2 (
echo %BotName%: Hi, we have a nice day ^^^^
) else if %number% equ 3 (
echo %BotName%: Whats your day ;)
) else (
echo %BotName%: Today is a sunny day xD
)
exit /B 0
:kill
set /a number = %RANDOM% %% 4 + 1
if %number% equ 1 (
echo %BotName%: i dont like killing
) else if %number% equ 2 (
echo %BotName%: u kill me?
) else if %number% equ 3 (
echo %BotName%: i cant kill
) else (
echo %BotName%: killing is wrong
)
exit /B 0
:Dogs
set /a number = %RANDOM% %% 4 + 1
if %number% equ 1 (
echo %BotName%: I like dogs
) else if %number% equ 2 (
echo %BotName%: dogs are funny
) else if %number% equ 3 (
echo %BotName%: U have dog?
) else (
echo %BotName%: I want have dog..
)
exit /B 0
endlocal