3 Replies Latest reply on Apr 22, 2008 11:19 AM by Reify32207

    Next project

      Ok, so I finished my first director project since 1999 or so. It was a "Who wants to be a Millionaire" style quiz game to review my class before a test. Because of how rusty I am (and also because I was never a very elegant programmer anyway), I was forced to do a bunch of things the hard way. For instance, I wanted to have several different sets of questions available, so I literally scripted out 4 different games. In all, my simple little black and white quiz game, with no graphics, video, or audio, took up almost 3 MB. I am sure that there has to be a better way.

      What I would like to do next, would be to make a smaller, more elegant version, that reads from an external text file or database to populate the questions and answers, so that I do not need to completely redo everything for each new unit. I would ideally have a set of 40-50 questions, each with 4 possible answers, the correct answer, and a difficulty rating. The game would need to be able to randomly draw questions from the pool (keeping in mind the escalating difficulty).

      I have been following the thread on FileIO, and I have been able to read a text file into a field (per the instructions from deansdirectortutorial.com), but I have not been able to figure out how to use that to populate my questions and answers. Everytime I tried mucking about with line...of... I either got an error message, or nothing happened.

      If anyone has any guidance, advice, commentary, or even good jokes, I would appreciate it.

      Thank you
        • 1. Re: Next project
          Level 7
          > If anyone has any guidance, advice, commentary, or even good jokes, I
          > would
          > appreciate it.

          Oddly enough, I've actually done exactly what you're describing on my last
          job. Not sure what advice I can give or anything, since I don't know what
          level of skill you're starting with. Kind of hard to answer a non-specific
          question like that anyhow. At any rate, it's entirely possible - one
          warning in advance, though, don't use commas for separators in your text
          file. I know that's the default itemDelimiter, but it's possible somebody
          might want commas in the questions, and it's a real pain to change how
          everything works afterwards. (I spent days just going through the thousands
          of questions replacing all the commas - except the ones in the questions -
          with something else.) My preference since then is to use the | character -
          nobody uses that for anything.

          • 2. Re: Next project
            Level 7
            Reading text files is OK for some things, but I would suggest you think
            about using a database to store your quiz data
            (question/answer/rating/etc). Using a database is generally more
            efficient. Plus it is great learning experience.

            There is a fantastic free (and open source) database called SQLite.
            While it is certainly not as power as something like Oracle, it is quite
            sufficient for many tasks, including your game. I think is an excellent
            way to get started learning how to work with databases. Using this, you
            could build a Director program that has all of the code for the game,
            but no data. That way you could make as many game sets as you wanted,
            without ever having to republish your movie.

            You can learn about SQLite on the website http://www.sqlite.org/ but all
            you really need to do is download Valentin Schmidt's free SQLite Xtra.
            You can get the Xtra as well as Director sample files which demonstrate
            how to use it.

            Here is a zip file which contains everything you need to get started
            (the xtra and a demo movie)


            I also recommend getting the SQLite Browser, which provides a easy,
            graphical interface for opening and editing a SQLite database.


            Learning SQL is easy (easier than Director if you ask me). Here is a
            great website that has a SQL tutorial (in addition to many others).


            As far as the size of your movie (3 MB) that is as expected. Try this,
            make a very simple Director projector that does not, maybe just loops on
            an empty frame. I bet you will find that is isn't much smaller.
            • 3. Re: Next project
              Reify32207 Level 1
              Thanks to both of you. I figured that a database would probably be the way to go ultimately, I just have rarely used them. No time like the present though....

              I will keep an eye out for the delimiter issue as well. I can see that being a pain in the neck.