Results 1 to 2 of 2

Thread: Console Command Parser?

  1. #1

    Thread Starter
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622

    Console Command Parser?

    Some games have a command console eg. Quake 2, CounterStrike, Doom 3, ect that is accessible by hitting the ~ key.

    I would like to implement a command console in one of my applications but would like to get a few different ideas on how to implement it, or examples of current implementations in vb.net/C#.

    The simple way to implement it would be to just have a large Select Case, but this means that i have to define each method and parse the parameters.

    I was thinking about using attributes/reflection to define if the method was useable from the command console and then invoke them using reflection.

    This also leaves me parsing the parameters.

    Any other ideas?
    Last edited by <ABX; Mar 9th, 2005 at 07:38 PM.
    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

  2. #2

    Thread Starter
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622

    Re: Console Command Parser?

    Suggestions/Ideas?

    Dynamic Code has its benifits

    but there is a little too much overhead/power for what i want to do.

    I basicly want to parse single line commands this does not merit creating a new appdomain (this application will be long running and, hopefully, used offen so executing it in the primary/default appdomain is not an option when using dynamic code)

    ---

    This is my current idea on how to implement this:

    1) Create a separate assembly for console accessible commands

    2) Only basic types are accepted (String, Int32, Boolean, Arrays)

    I, as a programmer, would like to have commands like this:

    MyRootNameSpace.Users.Add("String", 123, {"string", "string1"})

    but i wonder if non-programmers would find this to confusing...?
    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width