CODING ★ 9. LOCATIONS, OBJECTS AND EVENTS IN AKS ★

Writing Adventure Games on the Amstrad - 00 - ContentsWriting Adventure Games on the Amstrad - 09 - Locations, objects and events in AKS
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

An AKS scenario is based around the structures of Locations, Objects and Events, as these govern which actions take place where, which objects can be manipulated and so on. In this chapter we will take a look at how the Actions and Triggers we have already considered fit into the Location and Object structures.

The ordering of different data types is important in AKS, as the memory map in chapter 6 shows, and thus we will deal with these differing data types in the order they will appear in an AKS scenario.

LOCATIONS

Locations must be declared in an AKS database in ascending order of location number. Location zero is the special global location, as we have already mentioned in the previous chapter while looking at Triggers. Each location has a very similar header, which might look like this:

L, 15
D, *, In the dark woods.
C, N, *, 16 C, S, *, 18

This declares location 15, with a description of “In the dark woods”, which has no condition attached. The location is connected to location 16 to the north, and location 18 to the S. There are no conditions attached to the player moving to either of these two locations. There can be as many descriptions (each with an associated condition) as you wish, which enables us to simulate darkness, or to abbreviate the description if the player has already visited this location. We simply include these facts in the relevant condition; see the next chapter for a detailed description of the conditions available in AKS, and their use.

The above location declaration is very basic, as it does not include any triggers, these are simply added in before or after the connection information. An example location might be:

L, 15
D, *, In the dark woods.
C, N, *, 16
C, S, *, 18
T, climb tree, go tree, *
A, PR, you cannot climb trees.
T, plant acorn, plant, bury, * C7 A, PR, the planted acorn grows into an oak tree
A, ZO, 7 A, ZI, 8

This adds triggers which will detect attempts to climb trees, and plant acorns!

OBJECTS

Objects must be declared in numerical order, any out of sequence objects being reported by the AKS system when you attempt to execute the adventure. In the same way that location 0 is special, so is object 0, as it represents the player! This does mean that object 0 can be manipulated in the same way as other objects — so you can move the player around, but, the declaration for the player will normally only include an initial starting location and nothing else.

There are a number of elements to an object declaration, and we will look at each of these in turn. The best method is to consider the following example, and we can then look at what each element stands for:

O, 4
D, *, A small rusty lamp.
P, 19
N, rusty lamp, torch, *
S, GE, *
S, DR, *
S, EX, *

This declares object number 4. The first line of the declaration gives the object a description, which will be printed out with no conditions attached. The “P, 19" says that the lamp's initial position at the start of the adventure will be location 19. We need to let the player refer to the lamp by different names in his command input, so we declare a set of names using the "N” command, which allows you to attach a condition to the player using that name.

Finally, the “S” construct lets us set the suitability of the object to be used with certain of the inbuilt AKS actions. In our example above, our lamp is suitable for GEtting, DRopping and Examining; there is no limit to the actions which can be performed on an object (except com-monsense of course!).

EVENTS

An event is acted upon whenever the counter associated with it reaches a value of zero, after it has been activated by another part of the database. This is where the Initialise Counter action comes in, as we can set the counter to a number of turns, after which the event associated with that counter will come into action.

An example event might be declared as follows:

E, 0
A, PR, You have run out of time ...
A, SC
A, QU

This declares event 0 (which is not special in the way location and object 0 are) and lists a number of actions to be performed. In the case of our example, when the event is triggered, a message "You have run out of time ..." is printed, the player's score displayed and then the game ended. This could be used if the player had a maximum number of moves to complete some action, or even the whole game, in. If he fails to do so, event 0 comes into action.

★ YEAR: 1985
★ AUTHORS: Mike Lewis & Simon Price

Page précédente : Writing Adventure Games on the Amstrad - 08 - Triggers in AKS
Je participe au site:

» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.7-desktop/c
Page créée en 619 millisecondes et consultée 763 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.