Axe Software Forums
  Quest Developer Forum
  What are theses?


Author Topic:   What are theses?
fiton posted 29-07-2001 00:37 GMT     
What are Variables, Libraries, QDK, Procedures, Text Sections, Collectiables, and Game Codes?
MaDbRiT posted 29-07-2001 08:13 GMT          
Fiton asked:

quote:
What are Variables, Libraries, QDK, Procedures, Text Sections, Collectiables, and Game Codes?

This might take a while - but I'll try to explain them - in some sort of order.

game code
All Quest games are really just a specially formatted list of typed instructions that the Quest program reads through and presents to us as a playable game. We have to get the formatting (a.k.a. syntax) just right or Quest won't be able to make sense of the list - or will misunderstand and give the wrong effect.

When it goes wrong like that we call it a 'bug' by the way!

This list of instructions is called 'code' or a 'program' (sometimes even 'program code') and as it is for a Quest game often you'll see it called 'game code' on this forum.


Q.D.K.
Is simply the shorthand way we choose to write 'Quest Development Kit' - it's basically the name of the game creator program that comes with Quest. Q.D.K. provides an easy Windows-driven way to produce the game code mentioned above as an alternative to just sitting down and typing it.

text sections
Quest games have three blocks of text that must exist in every game, they are the intro that is printed as the game starts, the text printed if the player wins and the text printed if the player loses. These can be altered about to suit your purpose but all three MUST exist - these are the text blocks or 'text sections' you'll see mentioned here.

You can create your own blocks of text for other purposes if you want, and have them printed when required.

Libraries
Some of us (O.K. me at present) have written code for Quest that might be useful to others in their games. If the 'code' for this is formatted as a so called 'library' then anyone else can use it by just including the library of code into their game.

For instance if you wanted to add the ability to drop things, put things in boxes, and have characters in your game carry stuff about - you could write all the code needed yourself or 'go to the library of prewritten code' (see where the name comes from?) and just include my standard.lib library and use all of its features with the minimum of effort.

procedures
Sometimes you might want to have something happen in your game - say pressing the wrong button on a wall mounted console setting off a chain of explosions.

Now if you have these wall mounted consoles in several rooms - it would be a real drag to have to repeatedly write the same code that's needed to make the explosions in EVERY room with a console in every one of the rooms.

What you do is write all the code that you need to happen when the wrong button is pressed into a procedure block. Each room that has the buttons can then use the same code by calling the procedure as we refer to it. It's really just a useful way to save us from writing the same code over and over again.

The idea is if you need to use some code in more than one place, write it in a procedure and re-use it to save yourself some work!

The next logical step from a procedure is to make the code into a library - then it can be used in game after game after game...

Variables
During a game we need Quest to store things and use them again later. Sometimes it's a word - sometimes a number. An example, suppose you want a character in the game to ask the player's name and age - then repeat that information to a Policeman later.

At the time of writing the game you have no idea what the player will type in, so you have to provide a bit of computer memory to store that response for later. You do this using a variable or two in this case.

There are two basic types of variable, those that deal with words and those that deal with numbers. For words like a player's name we use a string variable ( a word is a load of letters strung together - so it's a 'string' - get it? ) while numbers are stored in numeric variables.

The idea is when the player types in his name, we create a string variable to store it, we have to give the variable a name so 'playersname' would be logical for that. We also create a numeric variable to hold his age and maybe call that 'playersage'.

Whatever responses the player typed are now stored away in the computers memory, until we read them back by using the name of the variable. For instance having %playersage% shown on the screen in a game will actually print the number the player gave when asked his age, while #playersname# will show his name.

These are called variables, because you can actually vary their content. Say your game runs over five years on a space station - you could add 1 year to the playersage variable on every birthday!

Collectables
Are obsolete now - and replaced with the better named 'Status Variables'. A collectable was just a regular numeric type variable that by default was shown in the Quest 'status' window.

PHEW!!!

I've not tries to explain HOW these things work - just what they all are. I hope that helps. My tutorial for Quest 2.x goes into more detail on this and shows how to use these things in a real game.

I'm also working on a Q3 Tutorial and a QDK tutorial - I'll post here when they are ready.

Al