Clan x86

Technical (Development, Security, etc.) => General Programming => Topic started by: abc on December 10, 2007, 10:04:34 PM

Title: In DIRE need of help (C#, Same project as the last)
Post by: abc on December 10, 2007, 10:04:34 PM
my final is do tomorrow, and for some reason my variables aren't following through, or setting to what they're suppose to, when I try to set the line, to a new line it doesn't change, what's going on?  :'(


using System;
using System.Collections.Generic;
using System.Text;
using Fluent.Toc;
using System.IO;
using System.Threading;

namespace FyreBot
{
    class TriviaManager : ConnectionManager
    {
        Program prg = new Program();
        public StreamReader Reader = new StreamReader("trivia.txt");
        //public StreamWriter HighScores = new StreamWriter("highscores.txt");
       
        private string message = null;
        private string from = null;
        private TocClient toc;
       
        public TocClient Toc
        {
            get { return toc; }
            set { toc = value; }
        }
       
        public string Msg
        {
            get { return message; }
            set { message = value; }
        }

        public string From
        {
            get { return from; }
            set { from = value; }
        }






        public string question = null;
        public string real_answer = null;
        public string user_answer = null;
        public string line = null;
        public static char[] Delimeter = { '*' };
       

        public TriviaManager()
        {
            Console.WriteLine(Msg);
        }

        public void Start()
        {
            user_answer = Msg.ToLower();
            line = Reader.ReadLine();
            string[] Parsed = line.Split(Delimeter); // Parsed[0] = Question .... Parsed[1] = Answer
            question = Parsed[0]; // Question = Parsed[0] (The question)
            real_answer = Parsed[1];
            Console.WriteLine("Trivia Manager: Started!");
            Console.WriteLine(question);
        }

        public void Validate()
        {
            user_answer = Msg.ToLower();
            line = Reader.ReadLine(); // Question*Answer
            string[] Parsed = line.Split(Delimeter); // Parsed[0] = Question .... Parsed[1] = Answer
            question = Parsed[0]; // Question = Parsed[0] (The question)
            real_answer = Parsed[1];

         
            if (user_answer == Parsed[1])
            {
                Console.WriteLine("Correct answer!");
                goto test;
               
            }
            else if (user_answer != Parsed[1])
            {
                Console.WriteLine("Incorrect answer!");
            }
        test:
            line = Reader.ReadLine();
            Parsed = line.Split(Delimeter);
            question = Parsed[0];
           
            Console.WriteLine(question);
 









            /*


            int i =0;
            string[] buffer = File.ReadAllLines("trivia.txt");
            char[] del = { '*' };
            string[] Parsed = buffer[i].Split(del);
            for (i = 0; Questions.ReadLine() != null; i++)
            {
            }
            do
            {

                Console.WriteLine(Parsed[i]);
            }
            while (true);

            */
           
               
         
        }

        public void Stop()
        {
            Console.WriteLine("Trivia Manager: Trivia now deactivated!");
            // stop trivia
        }
     }
}
   



EDIT: Nevermind.
Title: Re: In DIRE need of help (C#, Same project as the last)
Post by: MyndFyre on December 13, 2007, 12:00:03 AM
Why is your bot called FyreBot?
Title: Re: In DIRE need of help (C#, Same project as the last)
Post by: Blaze on December 13, 2007, 10:06:15 AM
Quote from: MyndFyre on December 13, 2007, 12:00:03 AM
Why is your bot called FyreBot?

Because Firebot was already taken!  :P

Also, he idolizes you.
Title: Re: In DIRE need of help (C#, Same project as the last)
Post by: MyndFyre on December 13, 2007, 12:37:30 PM
Quote from: Blaze on December 13, 2007, 10:06:15 AM
Quote from: MyndFyre on December 13, 2007, 12:00:03 AM
Why is your bot called FyreBot?

Because Firebot was already taken!  :P

Also, he idolizes you.

Imagine this in the melody of "America, Fuck Yeah":

"MyndFyre, fuck yeah"
Title: Re: In DIRE need of help (C#, Same project as the last)
Post by: iago on December 13, 2007, 03:05:07 PM
Quote from: MyndFyre on December 13, 2007, 12:37:30 PM
Quote from: Blaze on December 13, 2007, 10:06:15 AM
Quote from: MyndFyre on December 13, 2007, 12:00:03 AM
Why is your bot called FyreBot?

Because Firebot was already taken!  :P

Also, he idolizes you.

Imagine this in the melody of "America, Fuck Yeah":

"MyndFyre, fuck yeah"

I'm not sure how you pronounce "MyndFyre", but it sure doesn't have 4 syllables (like "America") when I do it, so it sounds completely wrong.
Title: Re: In DIRE need of help (C#, Same project as the last)
Post by: Sidoh on December 13, 2007, 03:15:28 PM
Here's the song: http://youtube.com/watch?v=RFkFvTwcoj0

It would sound a bit weird, but it would easily work.

I think my favorite part is

"Democrats!"
"Fuck yeah!"
"Republicans!"
"...... yeah..."
Title: Re: In DIRE need of help (C#, Same project as the last)
Post by: rabbit on December 13, 2007, 04:13:40 PM
Quote from: Sidoh on December 13, 2007, 03:15:28 PM
Here's the song: http://youtube.com/watch?v=RFkFvTwcoj0

It would sound a bit weird, but it would easily work.

I think my favorite part is

"Democrats!"
"Fuck yeah!"
"Republicans!"
"...... yeah..."
I like the longer version of that part:
"Democrats!"
"Fuck yeah!"
"Republicans!"
"...... yeah!?..."
"Sportsmanship!"
"..."
"Books!"
"..."
Title: Re: In DIRE need of help (C#, Same project as the last)
Post by: abc on December 13, 2007, 09:27:01 PM
Quote from: MyndFyre on December 13, 2007, 12:00:03 AM
Why is your bot called FyreBot?

I idolize you.







....No, In a serious note though, I just liked the looks of it I guess? :)
Title: Re: In DIRE need of help (C#, Same project as the last)
Post by: Hell-Lord on December 14, 2007, 02:22:28 AM
My bots called MyndBot  ;D
Title: Re: In DIRE need of help (C#, Same project as the last)
Post by: Camel on December 14, 2007, 02:24:33 AM
Quote from: rabbit on December 13, 2007, 04:13:40 PM
Quote from: Sidoh on December 13, 2007, 03:15:28 PM
Here's the song: http://youtube.com/watch?v=RFkFvTwcoj0

It would sound a bit weird, but it would easily work.

I think my favorite part is

"Democrats!"
"Fuck yeah!"
"Republicans!"
"...... yeah..."
I like the longer version of that part:
"Democrats!"
"Fuck yeah!"
"Republicans!"
"...... yeah!?..."
"Sportsmanship!"
"..."
"Books!"
"..."

Bed bath and beyond!