All pastes #205535 Raw Edit

staulkor

public text v1 · immutable
#205535 ·published 2006-10-16 21:50 UTC
rendered paste body
//Class Variables
private long timeStart, timeStop;

//Timer stuff
else if (e.Data.Message.StartsWith("!math"))
            {
                Random r = new Random();
                int a = r.Next(1, 100), b = r.Next(1, 100), c = r.Next(1, 100);
                string message1 = "Math Bot! Get ready to add!";
                irc.SendMessage(SendType.Message, e.Data.Channel, message1);
                OutputLine("<" + sIRCBot.Properties.Settings.Default.botnick + "> " + message1 + "\r\n");
                Thread.Sleep(1000);
                irc.SendMessage(SendType.Message, e.Data.Channel, "3...");
                OutputLine("<" + sIRCBot.Properties.Settings.Default.botnick + "> 3...\r\n");
                Thread.Sleep(1000);
                irc.SendMessage(SendType.Message, e.Data.Channel, "2...");
                OutputLine("<" + sIRCBot.Properties.Settings.Default.botnick + "> 2...\r\n");
                Thread.Sleep(1000);
                irc.SendMessage(SendType.Message, e.Data.Channel, "1...");
                OutputLine("<" + sIRCBot.Properties.Settings.Default.botnick + "> 1...\r\n");
                Thread.Sleep(1000);
                irc.SendMessage(SendType.Message, e.Data.Channel, "Go!");
                OutputLine("<" + sIRCBot.Properties.Settings.Default.botnick + "> Go!\r\n");
                string message2 = a + " + " + b + " + " + c + " = ?";
                irc.SendMessage(SendType.Message, e.Data.Channel, message2);
                timeStart = DateTime.Now.Millisecond;
                OutputLine("<" + sIRCBot.Properties.Settings.Default.botnick + "> " + message2 + "\r\n");
                sum = a + b + c;
                mathGame = true;
            }

        void irc_OnChannelMessage(object sender, IrcEventArgs e)
        {
            MessageBox.Show(Convert.ToString(timeStart) + " - " + Convert.ToString(timeStop));
            OutputLine("<");
            OutputLine(e.Data.Nick);
            OutputLine("> ");
            OutputLine(e.Data.Message);
            OutputLine(Environment.NewLine);

            while (mathGame == true)
            {
                if (e.Data.Message.Contains(sum.ToString()))
                {
                    timeStop = DateTime.Now.Millisecond;
                    DateTime.Now.
                    long total = timeStop - timeStart;
                    timeStop = 0;
                    timeStart = 0;
                    irc.SendMessage(SendType.Message, e.Data.Channel, e.Data.Nick + " is the winner! It took you " + total + " milliseconds.");
                    OutputLine("<" + sIRCBot.Properties.Settings.Default.botnick + "> Congrats " + e.Data.Nick
                        + "! You are the winner! It took you " + total + " milliseconds.\r\n");
                    mathGame = false;
                }
            }
        }