creating an AI batch file

Hewlett-packard Pavilion dv6-2190us note...
January 22, 2011 at 14:42:03
Specs: Vista, Core 2 / 2 gig ram
so here's the code but whenever i try to say anything other than OMG
it will always go to the ":wrong" line
there is a learning file. for futures uses. i'm trying to see if i can get this batch file to learn new terms from the learning.txt file...
maybe you can also help me on that
oh and i'm running into the issue of batch crashing where i if i input more than just one word, it crashes

echo off
cls
title Test AI
set /p user=please specify a username:

echo AI: hi i'm AI, nice to see a new user!
echo what would you like to talk about?


:loop

set /p ans= %user%:

if %ans%== omg (
echo AI: lol... ok that made no sense
) else (
goto wrong
)
goto loop

if %ans%== f--- (
echo AI: that's not very nice
) else (
goto wrong
)
goto loop

if %ans%== suck dick (
echo AI: that's not nice either
) else (
goto wrong
)
goto loop

if %ans%== p--sy (
echo AI: what about kitties?
) else (
goto wrong
)
goto loop

if %ans%== cool (
echo AI: yup it is ^:^)
) else (
goto wrong
)
goto loop

if %ans%== tell me a story (
echo AI: um.. once upon a time... the end
) else (
goto wrong
)
goto loop

if %ans%== that sucked (
echo AI: sorry to hear that
) else (
goto wrong
)
goto loop

if %ans%== you suck (
echo AI: hey i'm a prototype bear with me ^:^(
) else (
goto wrong
)
goto loop

if %ans%== motherf---er (
echo AI: potty mouth
) else (
goto wrong
)
goto loop

if %ans%== ass (
echo AI: what about donkeys?
) else (
goto wrong
)
goto loop

if %ans%== null (
echo AI: um it's nothing...
) else (
goto wrong
)
goto loop

if %ans%== it sucks (
echo AI: maybe it does
) else (
goto wrong
)
goto loop

if %ans%== suck dick (
echo AI: no thanks
) else (
goto wrong
)
goto loop

if %ans%== can i marry you (
echo AI: no i'm an AI
) else (
goto wrong
)
goto loop


if %ans%== do you like math (
echo AI: well no duh! i'm an AI
) else (
goto wrong
)
goto loop

if %ans%== what else do you know (
echo AI: losta things
) else (
goto wrong
)
goto loop

if %ans%== you (
echo AI: yes me
) else (
goto wrong
)
goto loop

if %ans%== hi (
echo AI: uh... hi
) else (
goto wrong
)
goto loop

if %ans%== mom (
echo AI: what about her? i don't have one
) else (
goto wrong
)
goto loop

if %ans%== LOL (
echo AI: don't make fun of me
) else (
goto wrong
)
goto loop

if %ans%== (
echo AI:
) else (
goto wrong
)
goto loop
if %ans%== (
echo AI:
) else (
goto wrong
)
goto loop

if %ans%== (
echo AI:
) else (
goto wrong
)
goto loop

if %ans%== (
echo AI:
) else (
goto wrong
)
goto loop

if %ans%== (
echo AI:
) else (
goto wrong
)
goto loop

if %ans%== (
echo AI:
) else (
goto wrong
)
goto loop


:wrong
echo %ans% >> learning.txt
echo AI: i'm sorry it seems my mainframe is corrupt
echo i didn't understand that
echo please try something different
goto loop


See More: creating an AI batch file

Report •


#1
January 22, 2011 at 14:47:17
if "%ans%"=="you suck" (
echo AI: hey i'm a prototype bear with me ^^:^^
) else (
goto wrong
)
goto loop

Notice the quotes, and also the double up on carets (^).

Can I put a question here?


Report •

#2
January 22, 2011 at 14:49:20
what do the double carrets do?

Report •

#3
January 22, 2011 at 14:53:42
Well, I was assuming you wanted to make a face. But the caret is used as an escape character to avoid special meanings of characters. Since it too has a special meaning, you have to escape that to echo it.

Can I put a question here?


Report •

Related Solutions

#4
January 22, 2011 at 14:55:46
yeah that's right i did want a face. it's just i know that usually one carret does the ttrick

it was this face i wanted

input
^:^(
output
:(


Report •

#5
January 22, 2011 at 14:58:28
and yeah i'm still having trouble with this thing working!!! it doesn't understand what i want it to do. the only thing that works is "omg"
the rest is all nonsense to the batch file :(


please specify a username: test
AI: hi i'm AI, nice to see a new user!
what would you like to talk about?
test: test
AI: i'm sorry it seems my mainframe is corrupt
i didn't understand that
please try something different
test: test
AI: i'm sorry it seems my mainframe is corrupt
i didn't understand that
please try something different
test: omg
AI: lol... ok that made no sense
AI: i'm sorry it seems my mainframe is corrupt
i didn't understand that
please try something different
test: idk
AI: i'm sorry it seems my mainframe is corrupt
i didn't understand that
please try something different
test: sucks
AI: i'm sorry it seems my mainframe is corrupt
i didn't understand that
please try something different
test: this suck
AI: i'm sorry it seems my mainframe is corrupt
i didn't understand that
please try something different
test: i suck
AI: i'm sorry it seems my mainframe is corrupt
i didn't understand that
please try something different
test: you suck
AI: i'm sorry it seems my mainframe is corrupt
i didn't understand that
please try something different
test: more
AI: i'm sorry it seems my mainframe is corrupt
i didn't understand that
please try something different
test: omg
AI: lol... ok that made no sense
AI: i'm sorry it seems my mainframe is corrupt
i didn't understand that
please try something different
test: omg
AI: lol... ok that made no sense
AI: i'm sorry it seems my mainframe is corrupt
i didn't understand that
please try something different
test:
AI: lol... ok that made no sense
AI: i'm sorry it seems my mainframe is corrupt
i didn't understand that
please try something different
test:
AI: lol... ok that made no sense
AI: i'm sorry it seems my mainframe is corrupt
i didn't understand that
please try something different
test:
AI: lol... ok that made no sense
AI: i'm sorry it seems my mainframe is corrupt
i didn't understand that
please try something different
test:
AI: lol... ok that made no sense
AI: i'm sorry it seems my mainframe is corrupt
i didn't understand that
please try something different
test:
AI: lol... ok that made no sense
AI: i'm sorry it seems my mainframe is corrupt
i didn't understand that
please try something different
test:


Report •

#6
January 22, 2011 at 14:59:49
and most of what i typed does make sense to the thing... i input that data earlier... it seems almost like the if commands are not following up correctly

Report •

#7
January 22, 2011 at 16:27:07
Sorry, I misunderstood the face, what you had earlier should be fine.

if "%ans%"=="you suck" (
echo AI: hey i'm a prototype bear with me :^(
) else (
goto wrong
)
goto loop

The "goto loop" isn't part of the if statement. The script won't be able to read anything below the first if.

Try:

if "%ans%"=="you suck" (
echo AI: hey i'm a prototype bear with me :^( & goto loop
) else (
goto wrong
)

Can I put a question here?


Report •


Ask Question