Welcome!

Join our community of MMORPG enthusiasts and private server developers! By registering, you'll gain access to in-depth discussions on source codes, binaries, and the latest developments in MMORPG server files. Collaborate with like-minded individuals, explore tutorials, and share insights on building and optimizing private servers. Join us today and unlock the full potential of MMORPG server development!

Join Today!

Advanced Command List

Status
Not open for further replies.
Newbie Spellweaver
Joined
Dec 24, 2011
Messages
16
Reaction score
1
Hello, today I release my advanced command list, which is great to manage commands from a configuration file. I didn't made the configuration loader + adder, but I made the rest.

First, add this:

Code:
static Dictionary<string, string> Commands = new Dictionary<string, string>();

Second, add some values. Insert into the first string the name of the command the user must type. Insert into the second string the name of the method/void to invoke.

Third, make a new void (with parameter 'string Input') and add:
Code:
            if (Commands.ContainsKey(Input))
            {
                Type mType = typeof(Programma);
                string Method = Commands[Input];
                mType.GetMethod(Method).Invoke(null, null);
            }
            else
            {
                Console.WriteLine("Sorry, the command {0} isn't found in the dictionary.", Input);
            }

Fourth, in your main bootup add this: (Program.cs Main void)
Code:
            while (true)
            {
                NAME OF YOUR METHOD(Console.ReadLine());
            }

It works :)
I'll make the configuration adder in a few minutes and will release it.
 
Now look if someone says ":)" they get an error saying "Sorry, the command ) isn't found in the dictionary."
 
Status
Not open for further replies.
Back