Gaming Masters' Programming Thread

Discussion in 'General Chat' started by shadiku, 7 Nov 2009.

  1. shadiku nyoro~n

    Gaming Masters' Programming Thread

    I'm disappointed that there's no programming thread in this forum.

    I know half of GM know fuck all about programming but maybe this thread will encourage you to learn a programming language or you could just tell us how awesome our programs are.

    I'll post my first venture with C#. Consolas IRC bot.

    [​IMG]

    Here you can see the modular system including the response files which look like this because I'm not good enough to implement a scripting language yet.

    • hello.txt
      Code:
      Hello to you too, {nickname}.
    • time.txt
      Code:
      The time is {hours}:{minutes}.
    • topic.txt
      Code:
      The channel topic is '{topic}'.

    After all that is parsed into a Hashtable full of responses we connect to Freenode IRC and join #consolas.

    The bot automatically grabs the topic and then listens for commands. When it receives one, it runs a foreach through the Hashtable of responses and checks for one that matches the command. If it matches, It'll replace the tags like {nickname} with the nick of the person who executed the query and then outputs the message to the channel.

    Source code for OnChannelMessage Event Handler.
    Code:
    static void IRC_OnChannelMessage(Data ircdata)
    {
        string Command = ircdata.MessageEx[0];
        string Nick = ircdata.Nick;
    
        if (Command.StartsWith("!"))
        {
            Command = Command.Substring(1, Command.Length - 1);
    
    		Consolas.Program.WriteLine("Recieved command '" + Command + "'.", ConsoleColor.DarkGreen);
    
    		foreach (DictionaryEntry Entry in StaticResponses)
    		{
    			if (Entry.Key.ToString().ToLower() == Command.ToLower()) {
    				string ParsedString = Entry.Value.ToString();
    
    				ParsedString = ParsedString.Replace("{nickname}", Nick);
    				ParsedString = ParsedString.Replace("{hours}", Consolas.Program.GetTime()["Hour"].ToString());
    				ParsedString = ParsedString.Replace("{minutes}", Consolas.Program.GetTime()["Minute"].ToString());
    				ParsedString = ParsedString.Replace("{seconds}", Consolas.Program.GetTime()["Second"].ToString());
    				ParsedString = ParsedString.Replace("{topic}", Consolas.Program.Topic);
    
    				Consolas.Program.MessageChannel(ircdata.Channel, ParsedString);
    			}
    		}
    
    		/* need a dispenser here */
        }
        else
        {
            Consolas.Program.WriteLine("<" + ircdata.Nick + "> " + ircdata.Message, ConsoleColor.White);
        }
    }
    Keep in mind, I'm only a beginner.

    Some more screenshots..

    [​IMG]

    [​IMG]

    ..and over to you!
     
    Last edited by a moderator: 28 Dec 2016
  2. Re: Gaming Masters' Programming Thread

    IRC bots are fun :>

    Currently I am using my almost non-existant C++ skills to create a .NET wrapper for MiniFMod (incredibly light xm player)

    EDIT: Fuck that time to take advantage of this guy's 9000x easier to use version (inb4 bagno making a Delphi-related comment)
     
  3. shadiku nyoro~n

    Re: Gaming Masters' Programming Thread

    Oh hey, awesome. I love XMs/MODs. Good luck with that.
     
  4. Spykodemon Disabled account

    Re: Gaming Masters' Programming Thread

    I am not logic enough to program alot D:

    Probably because I use the right hemisphere of my brain more deeply than I should. :awesome:
     
  5. shadiku nyoro~n

    Re: Gaming Masters' Programming Thread

    Had this on my mind for a while but I finally wanted to get my head around the JSON library.

    [​IMG]
    [​IMG]

    Program for Reag's website.

    Works on x86 and x64. Requires .NET Framework 2.0

    (Download)
     
  6. Spykodemon Disabled account

    Re: Gaming Masters' Programming Thread

    Reag... . _ .
     
  7. Reag My name is an anagram for a reason

    Re: Gaming Masters' Programming Thread

    [​IMG]

    Ahem.
     
  8. Knud Phat beats only

    Re: Gaming Masters' Programming Thread

    And what's the actual useful function? O.o
     
  9. Reag My name is an anagram for a reason

    Re: Gaming Masters' Programming Thread

    None at all, it was simply a learning tool I'd guess.
     
  10. shadiku nyoro~n

    Re: Gaming Masters' Programming Thread

    Yeah. It's as useless as Hello world.
     
  11. Spykodemon Disabled account

    Re: Gaming Masters' Programming Thread


    Hahaha, it takes 3 seconds to complete a query.
     
  12. shadiku nyoro~n

    Re: Gaming Masters' Programming Thread

    Funny, doesn't even take me a second. I'm sure you're smart enough to know that query completion time is all about internet speed.

    [​IMG]
     
  13. Reag My name is an anagram for a reason

    Re: Gaming Masters' Programming Thread

    [​IMG]
     
  14. shadiku nyoro~n

    Re: Gaming Masters' Programming Thread

    I think it's time to stop feeding the troll.
     
  15. Re: Gaming Masters' Programming Thread

    Your new avatar almost fooled me there. Almost.
     
  16. shadiku nyoro~n

    Re: Gaming Masters' Programming Thread

    Hehe. :D
     
  17. Re: Gaming Masters' Programming Thread

    Learn Prolog and Haskell Programming Languages, then help me with my uni assignments :(
     
  18. Re: Gaming Masters' Programming Thread

    But they're weird languages that no one uses :(


    What are your assignments like?
     
  19. Spykodemon Disabled account

    Re: Gaming Masters' Programming Thread

    [video]http://www.youtube.com/watch?v=acCjVLBDjEQ[/video]

    On request of the big guy.
     
  20. Re: Gaming Masters' Programming Thread

    +9000

    @Spyfag:
    How about original video?
    [video]http://www.youtube.com/watch?v=tcTSjoDb8_o[/video]

    Oh sorry, it's title isn't as immature as it should be. My fault.
     

Users Viewing Thread (Users: 0, Guests: 0)

Users found this page by searching for:

  1. need a dispenser here

    ,
  2. c# irc bot

    ,
  3. masters programming code

    ,
  4. c keygen minifmod,
  5. irc bot output,
  6. irc output c#,
  7. dispenser here