small basic chat bot

TextWindow.WriteLine("Text Bot Made By Yasin")
TextWindow.WriteLine("Battery:100%")

TextWindow.WriteLine("Hi i am a text bot What's your name?")

name = TextWindow.Read()

TextWindow.WriteLine("Hi "+name+" Nice To Meet You!")
TextWindow.WriteLine("Battery:90%")
TextWindow.WriteLine("How's Your Day Going Fine/Notfine?/Not Sure?")
day = TextWindow.Read()

if day = "fine" then
    TextWindow.WriteLine("OK :)")
    
    ElseIf day = "not fine" Then
        TextWindow.WriteLine("OK :(")
        Program.End()

Else
  
            TextWindow.WriteLine("OK? :\")
    EndIf
TextWindow.WriteLine("Battery:75%")
    TextWindow.WriteLine("Anyway What Should You Call Me?")

    botname = TextWindow.Read()
    TextWindow.WriteLine(botname+"? Yeah Sure Ill Remember That")

    if clock.hour = 10 Then
        TextWindow.WriteLine("Oh? Sir Its Night Time you should go and sleep bye!")
        Program.End()
        EndIf
        
        TextWindow.WriteLine("What Should You Tell Next ?")
        TextWindow.Write("I Like You :) , i hate you, ____?")

        next = TextWindow.Read()
TextWindow.WriteLine("Battery:55%")
        if next = "i hate you" Then
            TextWindow.WriteLine("Ok :(")
            Program.End()

            ElseIf next = "I Like You :)" Then
                TextWindow.WriteLine("Thank You")

            else
                TextWindow.WriteLine("Ok :\")
        endif

        TextWindow.WriteLine("Anyways Do You Want To End This Conversation____?")
        TextWindow.WriteLine("Yes")
        TextWindow.WriteLine("or")
        TextWindow.WriteLine("NO")

        conversation = TextWindow.Read()
TextWindow.WriteLine("Battery:44%")

        If conversation = "Yes" Then
            TextWindow.WriteLine("Ok Bye :(")
            Program.End()
        Elseif conversation = "NO" Then
                TextWindow.WriteLine("Ok :)")
        EndIf
        TextWindow.WriteLine("Battery:10%")
        TextWindow.WriteLine("Notification !")
        TextWindow.WriteLine("Friend:Hi Are You Coming to hangout Yes,no")

        msg = TextWindow.Read()
        If msg = "Yes" Then
            TextWindow.WriteLine("Friend:OK See You On 4'o clock Bye :0)")
        elseif msg = "no" then
            TextWindow.WriteLine("Well? Ok Bye :|")
            Program.End()
        EndIf


        TextWindow.WriteLine("Hi "+botname+" Here The Battery Is Low Plug It In The charger or it will switch off :)")

        TextWindow.WriteLine("Yes,no")

        switch = TextWindow.Read()

        If switch ="Yes"  Then
            TextWindow.WriteLine("Ok Bye :)")
            TextWindow.BackgroundColor = "green"
            Program.End()
        Elseif switch = "no" Then

            TextWindow.WriteLine("Power OFF")
            TextWindow.BackgroundColor = "red"

            TextWindow.WriteLine("Battery: 100%")
            Program.End()
        Endif

Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source