
A ship needs things in it: things to find, to carry, and to use. DRIFT has four. Two you can pick up - a data pad and a power cell - and two are part of the ship - the navigation console and a wall locker. This section writes down what they are and where they are, and lets the player see them.
Each object has four facts, kept in four arrays, all numbered alike:
| Array | Holds | For the pad |
|---|---|---|
O$() | the word the player types | PAD |
OD$() | how the game names it | A DATA PAD |
L%() | where it is | 1 - the cryo bay |
F%() | whether it is fixed in place | 0 - no |
L%() is the clever one. A room number means the object is in that room. Two other numbers mean something else, and the next sections use them: 0 means the player is carrying it, and -1 means it is nowhere yet - the power cell is shut in the locker, and will not be anywhere until the locker is opened.
Console and locker are fixed (F% is 1). The room descriptions already mention them, so the game does not list them again.
PROCITEMS goes through the objects and prints each one that is in this room and not fixed. PROCLOOK calls it after the exits.
LOAD "ADV3". Add:
1040 DIM O$(4),OD$(4),L%(4),F%(4):RESTORE 3200:FOR I%=1 TO 4:READ O$(I%),OD$(I%),L%(I%),F%(I%):NEXT
1140 PROCITEMS
1400 DEF PROCITEMS
1410 LOCAL I%
1420 FOR I%=1 TO 4
1430 IF L%(I%)=R% AND F%(I%)=0 THEN PRINT "YOU CAN SEE ";OD$(I%);"."
1440 NEXT
1450 ENDPROC
3200 DATA PAD,A DATA PAD,1,0
3210 DATA CELL,A POWER CELL,-1,0
3220 DATA CONSOLE,THE CONSOLE,4,1
3230 DATA LOCKER,THE LOCKER,2,1
Starting from
LOAD "ADV3" from S22. When it works, SAVE "ADV4".
What you should see
The cryo bay now ends with YOU CAN SEE A DATA PAD., and it is still there when you come back:
CRYO BAY
YOU WAKE IN THE CRYO BAY. YOUR SLEEP
POD STANDS OPEN. THE OTHER PODS ARE
EMPTY AND DARK.
EXITS: EAST
YOU CAN SEE A DATA PAD.
WHAT NOW?

DATA CELL,A POWER CELL,1,0. What do you see in the cryo bay now?DATA PAD,A DATA PAD,1,1. Where has the pad gone?QUIT, and type at the >: FOR I%=1 TO 4:PRINT O$(I%);" ";L%(I%);" ";F%(I%):NEXT. Read the table: where is everything?23.1 Make the game start with the power cell lying in the corridor instead of shut in the locker.
23.2 What would L%(1)=0 mean, if the program set it? Try it at the > after a QUIT, then type PROCITEMS. Is the pad still in the room?
Worked solutions are in Appendix II.
| Symptom | Cause |
|---|---|
Out of DATA at line 1040 | An object's DATA line has too few items. It needs four. |
| An object you placed does not show | It is fixed (F% 1), or in another room. |
Four arrays describe the objects: the word, the name, where it is, and whether it is fixed. A room number places it; 0 will mean carried and -1 nowhere yet. PROCITEMS lists what can be seen. Save it as ADV4.
S24, Taking And Dropping - picking things up.