Console Functions Help

This is a discussion on Console Functions Help within the Game Programming forums, part of the General Programming Boards category; Ok, this is for people who have played "Dungeon of Moria", search for it on the forum if you don't ...

  1. #1
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644

    Console Functions Help

    Ok, this is for people who have played "Dungeon of Moria", search for it on the forum if you don't know what I'm talking about, but back to the point. I would like to know how exactly he got the frames like he did, and how he go the message selection stuff *if anyone needs clearification on the latter, just ask*. I looked at the source, but I am not currently using MSVC++.

  2. #2
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346
    You can find a description of the window console functions at http://msdn.microsoft.com. I think this is what you are talking about.

    - Sean
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

  3. #3
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    I've already been there, couldn't find anything

  4. #4
    Registered User red_baron's Avatar
    Join Date
    May 2002
    Posts
    274
    i basically made a window making function:
    http://www.cprogramming.com/cboard/s...7&pagenumber=1
    (scroll down a little on the page)

    then i made the message thingy so that it is up to a specific lenght (check out the msg.h file) and then go to my source and check out line 393 which is this:
    Code:
    void printmessage (int last)
    {
        HANDLE hStdout;
        hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
        SetConsoleTextAttribute(hStdout, FOREGROUND_RED);
    
       for(count=0; count<=43; count++)
          message1[count]=message2[count];
       for(count=0; count<=43; count++)   
          message2[count]=message3[count];
       for(count=0; count<=43; count++)
          message3[count]=msg[last][count];
       gotoxy(1,20);
       printf("%s", message1);
       gotoxy(1,21);
       printf("%s", message2);
       gotoxy(1,22);
       printf("%s", message3);
    
       SetConsoleTextAttribute(hStdout, FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN);
    }
    message1/2/3 are all global so that their content isn't cleared when the function is exited, so basically each message is 43 characters long, the 2 first for statements take the mesage below it and take it up one so lets say your screen looks like this:

    dungeon
    of
    moria

    the next time the function is called it prints the stuff like this

    of
    moria
    (new message)

    msg[last][count] is the variable (2 dimensional char array) that has all the messages, when i wanted to print a message i just type something like: printmessage(7); it goes in the function takes up the messages one space up and finds message 7 in msg.h it then takes the content to message3, and then message1/2/3 are all printed on 3 consecutive lines.

    hope that was clear.
    ¿Red Baron?

    "Imagination is more important than knowledge"
    -Albert Einstein (1879-1955)

    Check out my games!

    [code] /* dont forget code tags! */ [/code]

  5. #5
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    most of it was, thank you

  6. #6
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    I have a problem with the game function, I get this: "error before '}' ", and here's the code that it's talking about:
    Code:
    void game ()
    {
       HANDLE hStdout;
       hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
       do{
       SetConsoleTextAttribute (hStdout, 14);
       SetConsoleTextAttribute (hStdout, bluef | greenf | redf);
      } //<- this do loop is the error
    }
    void updateitems()
    {
    *Note, rest of updateitems() code is working and such*

  7. #7
    Registered User C_Coder's Avatar
    Join Date
    Oct 2001
    Posts
    523
    >> this do loop is the error

    Well, a do loop needs a while condition at it's end.
    Code:
    do
    {
    
         // something
    
    }while( you still need to );
    Why do you need to loop just the changing of the colour?
    Last edited by C_Coder; 06-22-2002 at 06:04 PM.
    All spelling mistakes, syntatical errors and stupid comments are intentional.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. exchange functions demo code
    By kryptkat in forum C++ Programming
    Replies: 0
    Last Post: 04-05-2009, 03:06 PM
  2. An array of macro functions?
    By someprogr in forum C Programming
    Replies: 6
    Last Post: 01-28-2009, 07:05 PM
  3. Passing pointers between functions
    By heygirls_uk in forum C Programming
    Replies: 5
    Last Post: 01-09-2004, 06:58 PM
  4. Attaching functions to a class/struct
    By VirtualAce in forum Tech Board
    Replies: 2
    Last Post: 08-04-2003, 11:56 AM
  5. Console Functions
    By unanimous in forum C++ Programming
    Replies: 1
    Last Post: 12-28-2001, 08:09 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21