In previous posts I warned readers that I was learning on the fly, in this part you'll see evidence of that. As often happens when coding, especially when learning coding, there's a lot of little glitches on the way to getting the code right. Some of those glitches might be simply getting the structure wrong or maybe not knowing how the language in question is structured in the first place.
Other glitches might be the fact that tyoping errors creep in or that when calling remote files to use their contents, it's not the same as having the contents in the same file, though technically it should be right? Just to say it, all these glitches are good. Learning by mistakes is accepted as the winning way these days, so get on with making those mistakes. Fail often and early remember!
At this stage of the project we've got the full set of files to use agreed, they 7 files that have been settled on are:
Here's what I think each should contain:
The main control file, with the flow of the game here. It will call all other files and allow us access to the Classes and Methods they contain.
A library of all the Classes in the game. Some of these will be Hero, NPC, Mob, BackPack, etc. Anything that we want several instance of essentially the same thing and/or we want to have unique attributes.
Similar to the Class_lib, but for Subs and Functions. Maybe we could have them all together but I feel that will mix up what the files do and the design is meant to keep it easy to maintain.
This file will be a collection of strings or arrays full of text. Some will need a dynamic reference to the Hero name which will be part of the Hero generator.
# First things first... calling other files
As the plan is to have similar stuff, such as functions, classes, text, hero generation, etc. in dedicated files for ease of maintenance, we need to think how to call other files. That will allow our game to idea work. I've written the code for this before, re-factored from various forums and sites, however I got a bit stuck at the end though.. mystery revealed in the next video (simple issue too!)
In part 4 I'll pin down the error and get the Proof of Concept file-linking working, we can then really get moving building out elements of the game!
Links for items mentioned in the video:
Functions, Subroutines, and How to Call Them From Other Scripts
File System Object
Open Text File