System: WinXP Pro SP2
Compiler: FPC
Libraries: -


Basically I want my experimental (for learning purposes) simple console text adventure's code that's in one file to be spread over more files, like some kind of modularity. (It's more for ease of reading, though I think it's fairly readable with the use of a search in my text editor, but even then it's useful to know.)

As the straightforward hobbyist, I usually (from what I've learned anyway) start my main() and put my non-existent procedures/functions into it, like so....
[pascal]///--->
begin
do_inits;
tell_story01;

choose_class;
ask_showclass;

tell_story02;
idle_state;
ask_usepotion_firsttime;

tell_story03;
idle_state;

tell_story04;
end.
///<---
[/pascal]

Then I declare the functions above the main(), and some of them are called by others. For instance, do_inits() has...

[pascal]
procedure do_inits; begin
init_classvalues;
welcome_screen;
verify_userdata;
set_textspeed; //goto main()
end;
[/pascal]

Now, I got a whole bunch of procedures declared and described all above my main(), so you can imagine my source file is kinda big.

By looking at the code snippets above, can you give me an example (optionally based on them of course) of how to apply modularity over separate files?

I *THINK* I could somehow take out code here and there and put it into a separate file and in the main file use uses and the name of the file, but I'm not so sure on it. I just want to do it the right away and avoid disappointments :)