★ APPLICATIONS ★ GRAPHICS ADVENTURE CREATOR: PROGRAMMING TUTORIAL 3 ★ |
Gac - Programming Tutorial Part 3 (Amstrad Action) |
This month we look at the 'guts'of the adventure - the conditions. Conditions are used for puzzles and programming the adventure how to react to different situations and player input... There are three types of conditions: local, high priority and low priority. GAC processes in the following order:
All the GAC conditions are: VERB n Has VERB n been typed? (n is a number in the verb list) VERB 7 will give a TRUE answer if verb number 7 was typed, otherwise it will give FALSE. NOUN n Has NOUN n been typed? (similar to VERB) ADVE n Has ADVErb n been typed? (similar to VERB) HERE n Is object n HERE in the same room/location as the player? For example, if you are in room 3 and object 1 is there then HERE 1 will respond TRUE. CARR n Is object n being CARRied? AVAI n Is object n AVAIIable for use? (i.e. HERE or being CARRied) x IN n Is object n IN room x? If object 1 is in room 3, then 1 IN 3 will be TRUE. WEIG n Give the WEIGht of object n. SET? n Is marker n SET? (If you're not sure what markers are then look in AA77.) RES? n Is marker n RESet? (Markers 0-2 have special values defined below: Mkr 0, if set, means that a room has been described since it was last reset. Mkr 1, if set, means you are in a light room. Otherwise you are in a dark room. Mkr 2, if set, means you have a lamp or some other source of light. If markers 1 and 2 are both reset, then the program will refuse to describe rooms, coming up with the "It's dark" message instead, since you are in a dark room without any light. Mkr 3, if set, disables the scoring mechanism when you exit from the game. CTR n Gives you the value of CounTeR n. (For more details on counters see AA77.) x EQU? n Is x EQUal to the value of counter n? TURN Gives the number of TURNs since the start of the game. ROOM Gives you the room number of the ROOM you are currently in. AT n Gives a TRUE answer if you are AT room number n. condition AND condition Will give a TRUE answer if both of the conditions give TRUE answers, e.g. VERB 1 AND NOUN 2 will be TRUE only if verb 1 and noun 2 are both typed, condition OR condition Will give TRUE if either conditions are TRUE, or both, condition XOR condition Will give TRUE if one of the conditions is TRUE and the other is FALSE. NOT condition Will give a TRUE answer if the condition was FALSE, and vice versa. So NOT VERB 1 will be TRUE if VERB lis FALSE, x < y Gives TRUE if number x is less than number y. x > y Gives TRUE if number x is more than number y. x = y Gives TRUE if x is equal to y. RAND x Gives a RANDom number between 0 and (x-1). So RAND 10 might give any number at random in the range 0 to 9. VBNO Gets the number of the verb in this command. NO1 Gets the number of the first noun in this command. NO2 Gets the number of the second noun in this command. NO1 and NO2 are used to check word order, and to GET and DROP objects without having to have a condition for each one. All the GAC Actions are: LOOK Describe the room you are in at the moment. DESC n DESCribe room number n. PICT Turns the PICTure display on. TEXT Turns the picture display off, giving a TEXT only adventure. GET n GET object number n. If it isn't here, or you've already got it, or ifs too heavy, then the appropriate message is printed. DROP n DROP object number n. If you haven't got it, then the appropriate message is printed out. x SWAP y Exchange objects x and y. OBJ n Describe OBJect number n. LIST n LIST all objects in room number n. LIST WITH LISTS all the objects carried WITH you. x TO n Move object number x TO y. To destroy an object move it to room 0. SET n SET marker n. RESE n RESEt marker n. x CSET n Set x to be value of counter number n. INCR n INCRease counter n by one. The maximum is 255. DECR n DECRease counter n by one. The minimum is 0. Trying to increase past 255 or decrease past 0 is ignored. GOTO n GO TO room n and describe the new room. CONN n This checks through the CONNection table for a connection from the current room using verb n. If one is found, this gives the room number of the room you would move to if you took the connection, If not, then it gives zero. As an example, if you were in room 3 in the bank adventure, CONN 4 would give 4 because in the connections from room 3, verb 4 (W) would take you to room 4. STRE n Set the maximum weight you can carry to n. STRE is short for strength. BRIN n BRINgs object n here (if it exists). FIND n FIND object n and move to it (if it exists). This does not acknowledge any restrictions (such as connections), so it could be useful in a magic spell or summoning. SAVE SAVEs the current game position to tape or disk. LOAD LOADs the current game position from tape or disk. WAIT WAITs for a new command. OKAY Prints "Okay' and awaits a new command. EXIT Stops the game. The player is NOT asked, so j this is for use when the player gets killed or wins. QUIT The player is asked if s/he wants to continue, and if they type "N*, for "No" when asked if they are ! sure, the game continues, else the game is abandoned. MESS n Prints MESSage number n. PRIN n PRINt number n. LF Prints a Linefeed. Everything from here is printed on a new line. WITH Is equal to the room number of where things are put when you are carrying them. HOLD n HOLDs up the game for n fiftieths of a second. For example to freeze the game for 10 seconds use HOLD 500. x + y Returns the value of x added to y. x - y Returns the value of x minus y. In all the above, n, x and y need not be simple numbers. They can be complex expressions (like 2+2 instead of 4 or other words such as CTR 1 or NOD, but expressions should be enclosed in brackets, e.g. IF ( VERB 3 ) GET 1 OKAY END will become: IF ( VERB ( 3 ) ) GET (1) OKAY END GAC Programming Clinic If you have any questions on the use of GAC or specific GAC-related problems and queries then jot them down and send them to the Balg's GAC Programming Clinic at the usual AA address.
|