1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

How to get my ai to work

Discussion in 'DOS/Other' started by darkmoon3009, Jan 5, 2013.

Thread Status:
Not open for further replies.
  1. darkmoon3009

    darkmoon3009 Thread Starter

    Joined:
    Jan 5, 2013
    Messages:
    1
    Code:
    @echo off
    
    :Main
    set /p  Input=
    
    :wrong
    echo Im sorry i have not been programmed to reply to those words.
    echo If you think that what you said should be involved in the main
    echo program then please email me at "[email protected]"
    pause
    
    
    
    if "%Input%"=="Hello"
    (
    echo Hello there. 
    goto Main
    )
    else
    (
    goto wrong
    )
    goto loop
    pause
    
    I am trying to make it so if the player said "Hello" then it will run the code but also if they type "Hello robot" then it would still run it because they said hello. However i dont know how to allow spaces or how to make the AI check if they included the word. If the user uses two words then it will choose the first word used.

    Thanks for help
     
  2. foxidrive

    foxidrive Banned

    Joined:
    Oct 20, 2012
    Messages:
    793
    Maybe this will give you some ideas:

    Code:
    @echo off
    
    :Main
    echo.
    set "input="
    set /p "Input=Say something interesting: "
    
    
    echo "%input%"|findstr  /i /c:"hello" >nul
    if not errorlevel 1 (echo Hello there. & goto :Main)
    echo "%input%"|findstr  /i /c:"why?" >nul
    if not errorlevel 1 (echo Why not? & goto :Main)
    echo "%input%"|findstr  /i /c:"swearword" >nul
    if not errorlevel 1 (echo Oh Please!  I'm not that kind of AI! & goto :Main)
    
    
    :wrong
    if not defined input goto :main
    echo Im sorry i have not been programmed to reply to those words.
    echo If you think that what you said should be involved in the main
    echo program then please email me at "[email protected]"
    pause
    goto :main
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1083837

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice