![]() |
![]() ![]() ![]() ![]() ![]()
|
Author | Topic: What are theses? |
fiton |
![]() What are Variables, Libraries, QDK, Procedures, Text Sections, Collectiables, and Game Codes? |
MaDbRiT |
![]() Fiton asked:
quote: This might take a while - but I'll try to explain them - in some sort of order. game code 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.
text sections You can create your own blocks of text for other purposes if you want, and have them printed when required. Libraries 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 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 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 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 |