Usborne 1980s computer books

Anything QL Software or Programming Related.
Post Reply
Derek_Stewart
Font of All Knowledge
Posts: 3932
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Usborne 1980s computer books

Post by Derek_Stewart »

Hi,

Here is a link to Usbourne Web Site, at the bottom of the page is free PDF books of introduction to programming, games listings, adventure games.

https://usborne.com/browse-books/featur ... ing-books/

Not a QL book, but can be easy adapted and is quite an interesting read.

Maybe some of the Adventure games could br written in ACT on the QL.


Regards,

Derek
tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: Usborne 1980s computer books

Post by tcat »

Hi Derek,

Very interesting find, I already have `Islands of Secrets' that came from World of Spectrum pool of books.

Tomas


tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: Usborne 1980s computer books

Post by tcat »

Hi,

I have typed up this simple adventure code from one of the e-books given here. `Write your own adventure programmes', 1980's - Usborne publisher.

As it was targeted at ZX 16K, I have restructured the prog slightly to fit SuperBASIC style of coding. Added `Quit', and changed `Carrying?' to `List' for inventory.

My current ambition is to code a simple game engine, and I was curious how these type of progs work. They all seem to resemble some kind of state machine with command interpreter. I wish to understand better what parts in general make a game engine?
haunted_house.zip
Haunted House code
(4.36 KiB) Downloaded 90 times

Code: Select all

100 REMark game verbs, words, getable objects
110 v=26: w=36: g=18: Init
120 :
130 PRINT#3,"Haunted House"
140 PRINT#3,"-------------"
150 REMark An adventure game based on Usborne book
160 REMark Retyped for the QL, (c)tcat 2020
170 REMark Version v1.00
180 :
190 REPeat MainLoop
200  :
210  REMark Description & feedback
220  PRINT#3,\"Your location"\d$(rm)
230  PRINT#3,"exits:"!r$(rm)
240  FOR i=1 TO g
250   IF l(i)=rm AND f(i)=0 THEN PRINT#3,"You can see '"&o$(i)&"' here"
260  END FOR i
270  PRINT#3,m$: m$="What?"
280  :
290  REMark Input & input analysis
300  INPUT#3,"What will you do now?"!vb$
310  w$='': vb=0: ob=0
320  i=' ' INSTR vb$
330  IF i>0 THEN 
340   IF i+1< LEN(vb$) THEN w$=vb$(i+1 TO)
350   vb$=vb$(1 TO i-1)
360  END IF 
370  FOR i=1 TO v
380   IF vb$==v$(i) THEN vb=i: EXIT i
390  END FOR i
400  FOR i=1 TO w
410   IF w$==o$(i) THEN ob=i: EXIT i
420  END FOR i
430  :
440  REMark Error messages, override conditions
450  IF w$>'' AND ob=0 THEN m$="That's silly"
460  IF vb=0 THEN vb=v+1
470  IF w$='' THEN m$="Need two words"
480  IF vb>v AND ob>0 THEN m$="You can't '"&q$&"'"
490  IF vb>v AND ob=0 THEN m$="You don't make sense"
500  IF vb<v AND ob>0 AND c(ob) THEN m$="You don't have '"&w$&"'"
510  IF f(26)=1 AND rm=13 AND RND(3)<>3 AND vb<>21 THEN m$="Bats attacking!": NEXT MainLoop
520  IF rm=44 AND RND(2)=1 AND f(24)<>1 THEN f(27)=1
530  IF f(0)=1 THEN ll=ll-1
540  IF ll<1 THEN f(0)=0
550  :
560  REMark Branch to subroutines
570  SELect ON vb
580   =1: Help
590   =2: Inventory
600   =3 TO 9: Go_
610   =10,11: Take
620   =12: Open_
630   =13: Examine
640   =14: Read_
650   =15: Say
660   =16: Dig
670   =17: Swing
680   =18: Climb
690   =19: Light
700   =20: Unlight
710   =21: Spray
720   =22: Use
730   =23: Unlock
740   =24: Leave
750   =25: Score
760   =26: IF Quit THEN EXIT MainLoop
770  END SELect 
780  Candle
790  REMark WaitKey
800 END REPeat MainLoop
810 :
820 DEFine PROCedure WaitKey
830  PRINT#3,"Press a key": PAUSE
840 END DEFine WaitKey
850 :
860 DEFine PROCedure Candle
870  IF ll=10 THEN m$="Your candle is waning!"
880  IF ll=1 THEN m$="Your candle is out!"
890 END DEFine Candle
900 :
910 DEFine PROCedure Help
920  PRINT#3,"Words I know:"
930  FOR i=1 TO v: PRINT#3,v$(i)&',';
940  m$='': PRINT#3
950 END DEFine Help
960  :
970 DEFine PROCedure Inventory
980  PRINT#3,"You are carrying:"
990  FOR i=1 TO g
1000   IF c(i)=1 THEN PRINT#3,o$(i)&',';
1010 END FOR i
1020  m$='': PRINT#3
1030 END DEFine Inventory
1040 :
1050 DEFine PROCedure Go_
1060  d=0
1070  SELect ON ob=0: d=vb-3
1080  SELect ON ob=19 TO 24: d=ob-18
1090  IF rm=20 AND d=5 THEN d=1
1100  IF rm=20 AND d=6 THEN d=3
1110  IF rm=22 AND d=6 THEN d=2
1120  IF rm=22 AND d=5 THEN d=3
1130  IF rm=36 AND d=6 THEN d=1
1140  IF rm=36 AND d=5 THEN d=2
1150  IF f(14)=1 THEN m$="CRASH! You fell out of the tree!": f(14)=0: RETurn 
1160  IF f(27)=1 AND rm=52 THEN m$="Ghosts will not let you move": RETurn 
1170  IF rm=45 AND c(1)=1 AND f(34)=0 THEN m$="A magical barrier to the west": RETurn 
1180  IF rm=26 AND f(0)=0 AND (d=1 OR d=4) THEN m$="You need a light": RETurn 
1190  IF rm=54 AND c(15)<>1 THEN m$="You're stuck!": RETurn 
1200  IF c(15)=1 AND NOT(rm=53 OR rm=54 OR rm=55 OR rm=47) THEN m$="You can't carry a boat": RETurn 
1210  IF rm>26 AND rm<30 AND f(0)=0 THEN m$="Too dark to move": RETurn 
1220  f(35)=0
1230  IF 'N' INSTR r$(rm) AND d=1 THEN rm=rm-8: f(35)=1
1240  IF 'S' INSTR r$(rm) AND d=2 THEN rm=rm+8: f(35)=1
1250  IF 'W' INSTR r$(rm) AND d=3 THEN rm=rm-1: f(35)=1
1260  IF 'E' INSTR r$(rm) AND d=4 THEN rm=rm+1: f(35)=1
1270  m$="OK"
1280  IF f(35)=0 THEN m$="Can't go that way!"
1290  IF d<1 THEN m$="Go where?"
1300  IF rm=41 AND f(23)=1 THEN r$(49)="SW": m$="The door slams shut!": f(23)=0
1310 END DEFine Go_
1320 :
1330 DEFine PROCedure Take
1340  IF ob>g THEN m$="I can't get '"&w$&"'": RETurn 
1350  IF l(ob)<>rm THEN m$="It isn't here"
1360  IF f(ob)<>0 THEN m$="What '"&w$&"'?"
1370  IF c(ob)=1 THEN m$="You already have it"
1380  IF ob>0 AND l(ob)=rm AND f(ob)=0 THEN c(ob)=1: l(ob)=65: m$="You have the '"&w$&"'"
1390 END DEFine Take
1400 :
1410 DEFine PROCedure Open_
1420  IF rm=43 AND (ob=28 OR ob=29) THEN f(17)=0: m$="Drawer open"
1430  IF rm=28 AND ob=25 THEN m$="It's locked"
1440  IF rm=38 AND ob=32 THEN m$="That's creepy!": f(2)=0
1450 END DEFine Open_
1460 :
1470 DEFine PROCedure Examine
1480  IF ob=30 THEN f(18)=0: m$="Something here!"
1490  IF ob=31 THEN m$="That's disgusting!"
1500  IF ob=28 OR ob=29 THEN m$="There is a drawer"
1510  IF ob=33 OR ob=5 THEN Read_
1520  IF rm=43 AND ob=35 THEN m$="There is something beyond.."
1530  IF ob=32 THEN Open_
1540 END DEFine Examine
1550 :
1560 DEFine PROCedure Read_
1570  IF rm=42 AND ob=33 THEN m$="They are demonic works"
1580  IF (ob=3 OR ob=36) AND c(3)=1 AND f(34)=0 THEN m$="Use this word with care 'XZANFAR'"
1590  IF c(5)=1 AND ob=5 THEN m$="The script is in an alien tongue"
1600 END DEFine Read_
1610 :
1620 DEFine PROCedure Say
1630  m$="OK '"&w$&"'"
1640  IF c(3)=1 AND ob=34 THEN m$="*MAGIC OCCURS*": IF rm<>45 THEN rm=RND(63)
1650  IF c(3)=1 AND ob=34 AND rm=45 THEN f(34)=1
1660 END DEFine Say
1670 :
1680 DEFine PROCedure Dig
1690  IF c(12)=1 THEN m$="You made a hole"
1700  IF c(12)=1 AND rm=30 THEN m$="Dug the bars out":d$(rm)="Hole in wall": r$(rm)="NSE"
1710 END DEFine Dig
1720 :
1730 DEFine PROCedure Swing
1740  IF c(14)<>1 AND rm=7 THEN m$="This is no time to play games"
1750  IF ob=14 AND c(14)=1 THEN m$="You swung it"
1760  IF ob=13 AND c(13)=1 THEN m$="Whoosh!"
1770  IF ob=13 AND c(13)=1 AND rm=43 THEN r$(rm)="WN":d$(rm)="Study with secret room": m$="You broke the thin wall"
1780 END DEFine Swing
1790 :
1800 DEFine PROCedure Climb
1810  IF ob=14 AND c(14)=1 THEN m$="It isn't attached to anything!"
1820  IF ob=14 AND c(14)<>1 AND rm=7 AND f(14)=0 THEN m$="You see thick forest and cliff south": f(14)=1: RETurn 
1830  IF ob=14 AND c(14)<>1 AND rm=7 AND f(14)=1 THEN m$="Going down!": f(14)=0
1840 END DEFine Climb
1850 :
1860 DEFine PROCedure Light
1870  IF ob=17 AND c(17)=1 AND c(8)=0 THEN m$="It will burn your hands"
1880  IF ob=17 AND c(17)=1 AND c(9)=0 THEN m$="Nothing to light it with"
1890  IF ob=17 AND c(17)=1 AND c(9)=1 AND c(8)=1 THEN m$="It casts a flickering light": f(0)=1
1900 END DEFine Light
1910 :
1920 DEFine PROCedure Unlight
1930  IF f(0)=1 THEN f(0)=0: m$="Extinguished"
1940 END DEFine Unlight
1950 :
1960 DEFine PROCedure Spray
1970  IF ob=26 AND c(16)=1 THEN m$="HISSSS"
1980  IF ob=26 AND c(16)=1 AND f(26)=1 THEN f(26)=0: m$="PFFT! Got them"
1990 END DEFine Spray
2000 :
2010 DEFine PROCedure Use
2020  IF ob=10 AND c(10)=1 AND c(11)=1 THEN m$="Switched on": f(24)=1
2030  IF f(27)=1 AND f(24)=1 THEN m$="WHIZZ- Vacuumed the ghosts up!": f(27)=0
2040 END DEFine Use
2050 :
2060 DEFine PROCedure Unlock
2070  IF rm=43 AND (ob=27 OR ob=28) THEN Open_
2080  IF rm=28 AND ob=25 AND f(25)=0 AND c(18)=1 THEN f(25)=1: r$(rm)="SEW": d$(rm)="Huge open door": m$="The key turns!"
2090 END DEFine Unlock
2100 :
2110 DEFine PROCedure Leave
2120  IF c(ob)=1 THEN c(ob)=0: l(ob)=rm: m$="Done"
2130 END DEFine Leave
2140 :
2150 DEFine PROCedure Score
2160  s=0
2170  FOR i=1 TO g: s=s+c(i)
2180  IF s=17 AND c(15)<>1 AND rm<>57 THEN PRINT#3,"You have everything"\"return to the gate for final score"
2190  IF s=17 AND rm=57 THEN PRINT#3,"Double score for reaching here!": s=2*s
2200  PRINT#3,"Your score="!s: IF s>18 THEN PRINT#3,"Well done! you finished the game": STOP
2210 END DEFine Score
2220 :
2230 DEFine FuNction Quit
2240  INPUT#3,"Really Quit?"!vb$
2250  IF vb$=='y' THEN Score: RETurn 1
2260  m$="OK": RETurn 0
2270 END DEFine Quit
2280 :
2290 DEFine PROCedure Init
2300  OPEN#3,con_: CLS#3
2310  RESTORE 2340
2320  DIM r$(63,4),d$(63,35),o$(w,13),v$(v,9)
2330  DIM c(w),l(g),f(w)
2340  DATA 46,38,35,50,13,18,28,42,10,25,26,4,2,7,47,60,43,32
2350  FOR i=1 TO g: READ l(g)
2360  DATA "Help","List","Go","N","S","W","E","U","D","Get","Take"
2370  DATA "Open","Examine","Read","Say","Dig","Swing","Climb","Light"
2380  DATA "Unlight","Spray","Use","Unlock","Leave","Score","Quit"
2390  FOR i=1 TO v: READ v$(i)
2400  DATA "SE","WE","WE","SWE","WE","WE","SWE","WS"
2410  DATA "NS","SE","WE","NW","SE",'W',"NE","NSW"
2420  DATA "NS","NS","SE","WE","WNUD","SE","WSUD","NS"
2430  DATA 'N',"NS","NSE","WE","WE","NSW","NS","NS"
2440  DATA 'S',"NSE","NSW",'S',"NSUD",'N','N',"NS"
2450  DATA "NE","NW","NE",'W',"NSE","WE",'W',"NS"
2460  DATA "SE","NSW",'E',"WE","NW",'S',"SW","NW"
2470  DATA "NE","NWE","WE","WE","WE","NWE","NWE",'W'
2480  FOR i=0 TO 63: READ r$(i)
2490  DATA "Dark corner","Overgrown garden","By large woodpile"
2500  DATA "Yard by rubish","Weedpatch","Forest","Thick forest"
2510  DATA "Blasted tree","Corner of House","Entrance to kitchen"
2520  DATA "Kitchen & grimy cooker","Scullery door","Room with inches of dust"
2530  DATA "Rear turret room","Clearing by house","Path","Side of House"
2540  DATA "Back of Hallway","Dark alcove","Small dark room"
2550  DATA "Bottom of spiral staircase","Wide passage","Slippery steps"
2560  DATA "Clifftop","Near crumbling wall","Gloomy passage","Pool of light"
2570  DATA "Impressive vaulted hallway","Hall by thick wooden door","Trophy room"
2580  DATA "Cellar with barred window","Cliff path","Cupboard with hanging coat"
2590  DATA "Front Hall","Sitting room","Secret room","Steep marble stairs"
2600  DATA "Dining room","Deep cellar with coffin","Cliff path","Closet"
2610  DATA "Front lobby","Library of evil books","Study with desk & hole in wall"
2620  DATA "Weird cobwebby room","Very cold chamber","Spooky room"
2630  DATA "Cliff path by marsh","Rubble strewn verandah","Front porch"
2640  DATA "Front tower","Sloping corridor","Upper Gallery","Marsh by wall"
2650  DATA "Marsh","Soggy path","By twisted railing","Path through iron gate"
2660  DATA "By railings","Beneath front tower","Debris from crumbling facade"
2670  DATA "Large fallen brickwork","Rotting stone arch","Crumbling clifftop"
2680  FOR i=0 TO 63: READ d$(i)
2690  DATA "Painting","Ring","Magic spells","Goblet","Scroll","Coins"
2700  DATA "Statue","Candlestick","Matches","Vacuum","Batteries","Shovel"
2710  DATA "Axe","Rope","Boat","Aerosol","Candle","Key","North","South"
2720  DATA "West","East","Up","Down","Door","Bats","Ghosts","Drwaer","Desk"
2730  DATA "Coat","Rubbish","Coffin","Books","XZANFAR","Wall","Spells"
2740  FOR i=1 TO w: READ o$(i)
2750  f(18)=1: f(17)=1: f(2)=1: f(26)=1: f(28)=1: f(23)=1: ll=60: rm=57
2760  m$="OK"
2770 END DEFine Init
EDIT change for tabulated output, other errata

Code: Select all

930  FOR i=1 TO v: PRINT#3,v$(i),
1000   IF c(i)=1 THEN PRINT#3,o$(i),
2200  PRINT#3,"Your score:"!s: IF s>18 THEN PRINT#3,"Well done! you finished the game": STOP
2205  m$=''
2350  FOR i=1 TO g: READ l(i)
2720  DATA "West","East","Up","Down","Door","Bats","Ghosts","Drawer","Desk"
500  IF vb<v AND ob>0 AND c(ob)=0 THEN m$="You don't have '"&w$&"'"
480  IF vb>v AND ob>0 THEN m$="You can't '"&vb$&"'"
510  IF f(26)=1 AND rm=13 AND RND(2)<>2 AND vb<>21 THEN m$="Bats attacking!": NEXT MainLoop
520  IF rm=44 AND RND(1)=1 AND f(24)<>1 THEN f(27)=1
Last edited by tcat on Thu Jan 23, 2020 11:29 am, edited 5 times in total.


User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: Usborne 1980s computer books

Post by dilwyn »

As a starting point, have a look at David Denham's port of Tim Hartnell's Adventure Shell on my site at http://www.dilwyn.me.uk/games/adventures/index.html

Provides a skeleton system for producing simple text adventures with a simple noun/verb interpreter.

Nowhere near as advanced as what you are looking for perhaps, but a fairly simple first step for writing simple text adventures in BASIC.

There's even a simple "QL Forum" text adventure example game to try out.


tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: Usborne 1980s computer books

Post by tcat »

Thanks Dilwyn for pointing this out, it helps.

Meanwhile I have walked the whole game through, and possibly fixed all my typos, and some parts that would normally go to the book errata (went to EDIT box above). Good exercise though, I now have a better idea how simple adventure works.

Hey, I realised that was a childrens' book, is this a sign of me getting an old fool loosing some faculties?

It might be an idea to change `vacuum' to `hoover'..

Tom


Post Reply