C (not ++)

Actually, C++ code is fine too, but C is preferred.

  1. How do I declare an array of functions? I’m making a MUD (single-player), and I want to be able to call up functions like a map called 016 by the consequence of a command. e.g:

if I type “east” and my current position is map 015, I go to map 015+1, map 016. The only problem is, as far as I know, you cannot declare a function as an array (or call up functions with mathematic operators involved). Any laternate solutions to making maps would be appreciated.

  1. How would I set up a timer to do something to a variable every x seconds? This question is probably much more easier to solve, but I have no ideas as to what the syntax or the header files required to this is :stuck_out_tongue:

The practical application of this would be to regenerate, say, 1 hp to your current hp every 5 seconds. Or, a monster attacks you for 5 damage every 2 seconds while in battle.

  1. Is there actually an easy way to link C programs so that it is, in fact, a multi-user dungeon? I expect the answer to this will be no :stuck_out_tongue:

You can make a type which is a pointer to a function like this:
typedef void(*voidfunc)(void);

that would declare voidfunc to be a type which is a pointer to a function that takes no arguments and returns nothing.

or it could take arguments and return stuff, maybe like
typedef int(*somefunc)(float);

to make a type which is a pointer to a function that takes a float and returns an int.

Instead of using functions, you could use structs that hold data about each room.

If you’re using the standard high level console stuff, then every time you wait for user input your program will block (stop running) until the user has entered something. So, uh, that might not let you do what you have in mind? You could track how much time has elapsed using timeGetTime(), which is some windows function that returns the time in milliseconds (since the computer was turned on or something).

To have it actually be real time interactive, you won’t be able to use the high level console stuff.

no. Try using google to search for information on making MUDs…there’re probably free engines out there, and guides to program them…