
So far DRIFT is a ship you can walk round. This section makes it a game: two puzzles, and a way to win. The bridge door needs power; the power needs the cell from the locker, fitted in the reactor; the console needs a code, and the code is on the data pad. Solve them in order, and the engines fire.
A puzzle is really the program remembering something. "Has the locker been opened?" "Is the power on?" Each is a variable that starts at 0 and becomes 1 when the player does the thing - a flag.
LOCK% is the locker. POWER% has been there since S21, keeping the bridge door shut; now something can set it. OVER% becomes 1 when the right code is typed, and that ends the game loop.
Objects change too. Opening the locker puts the power cell, which was nowhere (-1), into the corridor (2). Fitting it in the reactor sends it back to nowhere: it has been used.
OPEN LOCKER works only on the locker, in the corridor, and only once.READ PAD needs the pad in your hands or in the room. It holds the captain's last log, and the code.USE CELL (or PUT CELL) works only in engineering, and only if you are carrying it. It turns the power on.USE CONSOLE, on the bridge, asks for the code with an ordinary INPUT, in the middle of the game.Each procedure checks everything that could be wrong first, and says what, as PROCGET did. The part that does the work is the last few lines.
LOAD "ADV6". Add these lines, replacing 1060:
120 IF OVER%=1 THEN PRINT "THE ENGINES ROAR INTO LIFE!"
1060 R%=1:POWER%=0:LOCK%=0:OVER%=0
1960 IF VN%=10 THEN PROCOPEN(FNOBJ(N$)):ENDPROC
1970 IF VN%=11 THEN PROCREAD(FNOBJ(N$)):ENDPROC
1980 IF VN%=12 THEN PROCUSE(FNOBJ(N$)):ENDPROC
2500 DEF PROCOPEN(I%)
2510 IF I%<>4 OR R%<>2 THEN PRINT "YOU CAN'T OPEN THAT.":ENDPROC
2520 IF LOCK% THEN PRINT "IT IS ALREADY OPEN.":ENDPROC
2530 LOCK%=1:L%(2)=2
2540 PRINT "THE LOCKER SWINGS OPEN."
2550 PROCITEMS
2560 ENDPROC
2600 DEF PROCREAD(I%)
2610 IF I%<>1 THEN PRINT "YOU CAN'T READ THAT.":ENDPROC
2620 IF L%(1)<>0 AND L%(1)<>R% THEN PRINT "YOU CAN'T SEE THAT HERE.":ENDPROC
2630 PROCWRAP("THE CAPTAIN'S LAST LOG: 'MAIN POWER FAILED. ALL CREW TO THE PODS. NAVIGATION CODE 4712.'")
2640 ENDPROC
2700 DEF PROCUSE(I%)
2710 IF I%=2 THEN PROCCELL:ENDPROC
2720 IF I%=3 THEN PROCCONSOLE:ENDPROC
2730 PRINT "NOTHING HAPPENS."
2740 ENDPROC
2800 DEF PROCCELL
2810 IF L%(2)<>0 THEN PRINT "YOU AREN'T CARRYING A CELL.":ENDPROC
2820 IF R%<>3 THEN PRINT "THERE IS NOWHERE TO PUT IT.":ENDPROC
2830 L%(2)=-1:POWER%=1
2840 PROCWRAP("THE CELL CLICKS INTO THE REACTOR. LIGHTS FLICKER ON ALL OVER THE SHIP, AND SOMEWHERE A DOOR HISSES OPEN.")
2860 ENDPROC
2900 DEF PROCCONSOLE
2910 IF R%<>4 THEN PRINT "YOU CAN'T SEE THAT HERE.":ENDPROC
2920 INPUT "ENTER THE CODE",K$
2930 IF K$="4712" THEN OVER%=1:ENDPROC
2940 PRINT "ACCESS DENIED."
2950 ENDPROC
Starting from
LOAD "ADV6" from S25. When it works, SAVE "ADV7".
What you should see
The game can be won. One way through: E, OPEN LOCKER, GET CELL, E, USE CELL, W, W, GET PAD, READ PAD, E, N, USE CONSOLE. The end of it:
WHAT NOW? READ PAD
THE CAPTAIN'S LAST LOG: 'MAIN POWER
FAILED. ALL CREW TO THE PODS.
NAVIGATION CODE 4712.'
WHAT NOW? E
CORRIDOR
...
WHAT NOW? N
BRIDGE
THE BRIDGE. STARS WHEEL SLOWLY PAST THE
WINDOW. THE NAVIGATION CONSOLE IS LIT,
WAITING FOR A CODE.
EXITS: SOUTH
WHAT NOW? USE CONSOLE
ENTER THE CODE? 1111
ACCESS DENIED.
WHAT NOW? USE CONSOLE
ENTER THE CODE? 4712
THE ENGINES ROAR INTO LIFE!
>

OPEN LOCKER twice, OPEN PAD, and USE CELL before and after you have picked the cell up. Which message does each get, and which line gives it?READ PAD in the corridor when the pad is still in the cryo bay. Then go and read it there.1066 instead of 4712. What does 4712 get now?26.1 Change the code to one of your own - and remember the log has to match.
26.2 For testing, make the game start on the bridge with the power on, without changing anything but line 1060.
Worked solutions are in Appendix II.
| Symptom | Cause |
|---|---|
OPEN, READ or USE is I DON'T UNDERSTAND. | Lines 1960-1980 are missing. |
The bridge door stays shut after USE CELL | You were not in engineering, or not carrying the cell - read what it said. |
ACCESS DENIED. with the right code | The code is compared exactly, character for character, with line 2930. Check both. |
Puzzles are flags: LOCK% and POWER% start at 0 and are set by what the player does. Objects move by changing their place. USE CONSOLE asks with INPUT in mid-game, and the right answer sets OVER%. Save it as ADV7.
S27, Running Out Of Air - a clock, and a way to lose.