Home » Archimedes archive » Acorn User » AU 1998-08.adf » Freeware » PD/IntFiction/DavidRPG2/Example

PD/IntFiction/DavidRPG2/Example

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1998-08.adf » Freeware
Filename: PD/IntFiction/DavidRPG2/Example
Read OK:
File size: 093E bytes
Load address: 0000
Exec address: 0000
Duplicates

There is 1 duplicate copy of this file in the archive:

File contents
| Example Game
| David Spence, 1998.
| For DavidRPG2 the adventure interpreter.

name=Example
adventure=To test this
author=David Spence, 1998
version=0.01 (13 Mar 1998)

| Begin Rooms

| all rooms must have name and text1 and can have up to 20 lines of text

variable o = 0
variable jj = 0

room one start {
name:    "Room one"
text:    "This is the first room."
         "It is cold and damp."
east:    goto(two)
north:   goto(three)
objects: bat,box
actions: {
"shout": print("Keep your voice down.\n")
}
}

room onea {
name:    "Special Room"
text:    "This is the secret room."
         "Jump to leave."
east:    {
         change(o,1)
         print("Print you have typed east ")
         print(o)
         print(" times.\n")
         }
north:   set(o,0)
actions: {
"jump": {
print("You leave the room for good?")
goto(one)
}
}
}


room two {
name:    "Room two"
text:    "This is the second room."
west:    goto(one)
north:   goto(three)
}                   

room three {
name:    "Room three"
text:    "This is the third room."
         "It is warm and damp."
         "You feel like you are being watched."
south:   goto(one)
north:   goto(two)
people:  old_man
}                   

| next the objects 
           
| objects need move:, name:, text1:

object box {
move:   no           
| -1 is infinite 
energy: 2
dead:   { 
print("The box is destroyed.\n")
O_move(box,null)
print("You are teleported to a special room\n")
goto(onea)
set(jj,1)
}
name:   "Box"
text:   "It is very large and cannot be moved."
canbe: {
"hit": {
print("The box is crushed.\n")
change(energy,-1)
}
}
}

object bat {
move:   yes          
| -1 is infinite 
energy: -1     
name:   "Bat"
text:   "It is a large baseball bat."
cando: {
 "hit":    {
 print("You hit it with the bat")
 }
}
}

| finally the people

person old_man {
name: "Old Man"
text:  "He is old and looks wise."
move: no
energy: -1
see:    print("The old man says hello\n")
unsee:  print("The old man says goodbye.") 
 canbe: {
  "hit": { 
   print("The Old man is invincible.\n")
  }
 }
talk: {
 "help":{
 print("I am imaginary, I cannot help you.\n") 
 }
}
}

| the player

player {
name: "A. N. Explorer"
text: "Your not a very interesting person."
energy: -1
cando: {
"unjump": {
if(jj = "1") {
if(c_room <> "Special Room") {
goto(onea)
print("Well Done. You are moved back to the secret room.")
}
}
}
}
}
00000000  7c 20 45 78 61 6d 70 6c  65 20 47 61 6d 65 0a 7c  || Example Game.||
00000010  20 44 61 76 69 64 20 53  70 65 6e 63 65 2c 20 31  | David Spence, 1|
00000020  39 39 38 2e 0a 7c 20 46  6f 72 20 44 61 76 69 64  |998..| For David|
00000030  52 50 47 32 20 74 68 65  20 61 64 76 65 6e 74 75  |RPG2 the adventu|
00000040  72 65 20 69 6e 74 65 72  70 72 65 74 65 72 2e 0a  |re interpreter..|
00000050  0a 6e 61 6d 65 3d 45 78  61 6d 70 6c 65 0a 61 64  |.name=Example.ad|
00000060  76 65 6e 74 75 72 65 3d  54 6f 20 74 65 73 74 20  |venture=To test |
00000070  74 68 69 73 0a 61 75 74  68 6f 72 3d 44 61 76 69  |this.author=Davi|
00000080  64 20 53 70 65 6e 63 65  2c 20 31 39 39 38 0a 76  |d Spence, 1998.v|
00000090  65 72 73 69 6f 6e 3d 30  2e 30 31 20 28 31 33 20  |ersion=0.01 (13 |
000000a0  4d 61 72 20 31 39 39 38  29 0a 0a 7c 20 42 65 67  |Mar 1998)..| Beg|
000000b0  69 6e 20 52 6f 6f 6d 73  0a 0a 7c 20 61 6c 6c 20  |in Rooms..| all |
000000c0  72 6f 6f 6d 73 20 6d 75  73 74 20 68 61 76 65 20  |rooms must have |
000000d0  6e 61 6d 65 20 61 6e 64  20 74 65 78 74 31 20 61  |name and text1 a|
000000e0  6e 64 20 63 61 6e 20 68  61 76 65 20 75 70 20 74  |nd can have up t|
000000f0  6f 20 32 30 20 6c 69 6e  65 73 20 6f 66 20 74 65  |o 20 lines of te|
00000100  78 74 0a 0a 76 61 72 69  61 62 6c 65 20 6f 20 3d  |xt..variable o =|
00000110  20 30 0a 76 61 72 69 61  62 6c 65 20 6a 6a 20 3d  | 0.variable jj =|
00000120  20 30 0a 0a 72 6f 6f 6d  20 6f 6e 65 20 73 74 61  | 0..room one sta|
00000130  72 74 20 7b 0a 6e 61 6d  65 3a 20 20 20 20 22 52  |rt {.name:    "R|
00000140  6f 6f 6d 20 6f 6e 65 22  0a 74 65 78 74 3a 20 20  |oom one".text:  |
00000150  20 20 22 54 68 69 73 20  69 73 20 74 68 65 20 66  |  "This is the f|
00000160  69 72 73 74 20 72 6f 6f  6d 2e 22 0a 20 20 20 20  |irst room.".    |
00000170  20 20 20 20 20 22 49 74  20 69 73 20 63 6f 6c 64  |     "It is cold|
00000180  20 61 6e 64 20 64 61 6d  70 2e 22 0a 65 61 73 74  | and damp.".east|
00000190  3a 20 20 20 20 67 6f 74  6f 28 74 77 6f 29 0a 6e  |:    goto(two).n|
000001a0  6f 72 74 68 3a 20 20 20  67 6f 74 6f 28 74 68 72  |orth:   goto(thr|
000001b0  65 65 29 0a 6f 62 6a 65  63 74 73 3a 20 62 61 74  |ee).objects: bat|
000001c0  2c 62 6f 78 0a 61 63 74  69 6f 6e 73 3a 20 7b 0a  |,box.actions: {.|
000001d0  22 73 68 6f 75 74 22 3a  20 70 72 69 6e 74 28 22  |"shout": print("|
000001e0  4b 65 65 70 20 79 6f 75  72 20 76 6f 69 63 65 20  |Keep your voice |
000001f0  64 6f 77 6e 2e 5c 6e 22  29 0a 7d 0a 7d 0a 0a 72  |down.\n").}.}..r|
00000200  6f 6f 6d 20 6f 6e 65 61  20 7b 0a 6e 61 6d 65 3a  |oom onea {.name:|
00000210  20 20 20 20 22 53 70 65  63 69 61 6c 20 52 6f 6f  |    "Special Roo|
00000220  6d 22 0a 74 65 78 74 3a  20 20 20 20 22 54 68 69  |m".text:    "Thi|
00000230  73 20 69 73 20 74 68 65  20 73 65 63 72 65 74 20  |s is the secret |
00000240  72 6f 6f 6d 2e 22 0a 20  20 20 20 20 20 20 20 20  |room.".         |
00000250  22 4a 75 6d 70 20 74 6f  20 6c 65 61 76 65 2e 22  |"Jump to leave."|
00000260  0a 65 61 73 74 3a 20 20  20 20 7b 0a 20 20 20 20  |.east:    {.    |
00000270  20 20 20 20 20 63 68 61  6e 67 65 28 6f 2c 31 29  |     change(o,1)|
00000280  0a 20 20 20 20 20 20 20  20 20 70 72 69 6e 74 28  |.         print(|
00000290  22 50 72 69 6e 74 20 79  6f 75 20 68 61 76 65 20  |"Print you have |
000002a0  74 79 70 65 64 20 65 61  73 74 20 22 29 0a 20 20  |typed east ").  |
000002b0  20 20 20 20 20 20 20 70  72 69 6e 74 28 6f 29 0a  |       print(o).|
000002c0  20 20 20 20 20 20 20 20  20 70 72 69 6e 74 28 22  |         print("|
000002d0  20 74 69 6d 65 73 2e 5c  6e 22 29 0a 20 20 20 20  | times.\n").    |
000002e0  20 20 20 20 20 7d 0a 6e  6f 72 74 68 3a 20 20 20  |     }.north:   |
000002f0  73 65 74 28 6f 2c 30 29  0a 61 63 74 69 6f 6e 73  |set(o,0).actions|
00000300  3a 20 7b 0a 22 6a 75 6d  70 22 3a 20 7b 0a 70 72  |: {."jump": {.pr|
00000310  69 6e 74 28 22 59 6f 75  20 6c 65 61 76 65 20 74  |int("You leave t|
00000320  68 65 20 72 6f 6f 6d 20  66 6f 72 20 67 6f 6f 64  |he room for good|
00000330  3f 22 29 0a 67 6f 74 6f  28 6f 6e 65 29 0a 7d 0a  |?").goto(one).}.|
00000340  7d 0a 7d 0a 0a 0a 72 6f  6f 6d 20 74 77 6f 20 7b  |}.}...room two {|
00000350  0a 6e 61 6d 65 3a 20 20  20 20 22 52 6f 6f 6d 20  |.name:    "Room |
00000360  74 77 6f 22 0a 74 65 78  74 3a 20 20 20 20 22 54  |two".text:    "T|
00000370  68 69 73 20 69 73 20 74  68 65 20 73 65 63 6f 6e  |his is the secon|
00000380  64 20 72 6f 6f 6d 2e 22  0a 77 65 73 74 3a 20 20  |d room.".west:  |
00000390  20 20 67 6f 74 6f 28 6f  6e 65 29 0a 6e 6f 72 74  |  goto(one).nort|
000003a0  68 3a 20 20 20 67 6f 74  6f 28 74 68 72 65 65 29  |h:   goto(three)|
000003b0  0a 7d 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.}              |
000003c0  20 20 20 20 20 0a 0a 72  6f 6f 6d 20 74 68 72 65  |     ..room thre|
000003d0  65 20 7b 0a 6e 61 6d 65  3a 20 20 20 20 22 52 6f  |e {.name:    "Ro|
000003e0  6f 6d 20 74 68 72 65 65  22 0a 74 65 78 74 3a 20  |om three".text: |
000003f0  20 20 20 22 54 68 69 73  20 69 73 20 74 68 65 20  |   "This is the |
00000400  74 68 69 72 64 20 72 6f  6f 6d 2e 22 0a 20 20 20  |third room.".   |
00000410  20 20 20 20 20 20 22 49  74 20 69 73 20 77 61 72  |      "It is war|
00000420  6d 20 61 6e 64 20 64 61  6d 70 2e 22 0a 20 20 20  |m and damp.".   |
00000430  20 20 20 20 20 20 22 59  6f 75 20 66 65 65 6c 20  |      "You feel |
00000440  6c 69 6b 65 20 79 6f 75  20 61 72 65 20 62 65 69  |like you are bei|
00000450  6e 67 20 77 61 74 63 68  65 64 2e 22 0a 73 6f 75  |ng watched.".sou|
00000460  74 68 3a 20 20 20 67 6f  74 6f 28 6f 6e 65 29 0a  |th:   goto(one).|
00000470  6e 6f 72 74 68 3a 20 20  20 67 6f 74 6f 28 74 77  |north:   goto(tw|
00000480  6f 29 0a 70 65 6f 70 6c  65 3a 20 20 6f 6c 64 5f  |o).people:  old_|
00000490  6d 61 6e 0a 7d 20 20 20  20 20 20 20 20 20 20 20  |man.}           |
000004a0  20 20 20 20 20 20 20 20  0a 0a 7c 20 6e 65 78 74  |        ..| next|
000004b0  20 74 68 65 20 6f 62 6a  65 63 74 73 20 0a 20 20  | the objects .  |
000004c0  20 20 20 20 20 20 20 20  20 0a 7c 20 6f 62 6a 65  |         .| obje|
000004d0  63 74 73 20 6e 65 65 64  20 6d 6f 76 65 3a 2c 20  |cts need move:, |
000004e0  6e 61 6d 65 3a 2c 20 74  65 78 74 31 3a 0a 0a 6f  |name:, text1:..o|
000004f0  62 6a 65 63 74 20 62 6f  78 20 7b 0a 6d 6f 76 65  |bject box {.move|
00000500  3a 20 20 20 6e 6f 20 20  20 20 20 20 20 20 20 20  |:   no          |
00000510  20 0a 7c 20 2d 31 20 69  73 20 69 6e 66 69 6e 69  | .| -1 is infini|
00000520  74 65 20 0a 65 6e 65 72  67 79 3a 20 32 0a 64 65  |te .energy: 2.de|
00000530  61 64 3a 20 20 20 7b 20  0a 70 72 69 6e 74 28 22  |ad:   { .print("|
00000540  54 68 65 20 62 6f 78 20  69 73 20 64 65 73 74 72  |The box is destr|
00000550  6f 79 65 64 2e 5c 6e 22  29 0a 4f 5f 6d 6f 76 65  |oyed.\n").O_move|
00000560  28 62 6f 78 2c 6e 75 6c  6c 29 0a 70 72 69 6e 74  |(box,null).print|
00000570  28 22 59 6f 75 20 61 72  65 20 74 65 6c 65 70 6f  |("You are telepo|
00000580  72 74 65 64 20 74 6f 20  61 20 73 70 65 63 69 61  |rted to a specia|
00000590  6c 20 72 6f 6f 6d 5c 6e  22 29 0a 67 6f 74 6f 28  |l room\n").goto(|
000005a0  6f 6e 65 61 29 0a 73 65  74 28 6a 6a 2c 31 29 0a  |onea).set(jj,1).|
000005b0  7d 0a 6e 61 6d 65 3a 20  20 20 22 42 6f 78 22 0a  |}.name:   "Box".|
000005c0  74 65 78 74 3a 20 20 20  22 49 74 20 69 73 20 76  |text:   "It is v|
000005d0  65 72 79 20 6c 61 72 67  65 20 61 6e 64 20 63 61  |ery large and ca|
000005e0  6e 6e 6f 74 20 62 65 20  6d 6f 76 65 64 2e 22 0a  |nnot be moved.".|
000005f0  63 61 6e 62 65 3a 20 7b  0a 22 68 69 74 22 3a 20  |canbe: {."hit": |
00000600  7b 0a 70 72 69 6e 74 28  22 54 68 65 20 62 6f 78  |{.print("The box|
00000610  20 69 73 20 63 72 75 73  68 65 64 2e 5c 6e 22 29  | is crushed.\n")|
00000620  0a 63 68 61 6e 67 65 28  65 6e 65 72 67 79 2c 2d  |.change(energy,-|
00000630  31 29 0a 7d 0a 7d 0a 7d  0a 0a 6f 62 6a 65 63 74  |1).}.}.}..object|
00000640  20 62 61 74 20 7b 0a 6d  6f 76 65 3a 20 20 20 79  | bat {.move:   y|
00000650  65 73 20 20 20 20 20 20  20 20 20 20 0a 7c 20 2d  |es          .| -|
00000660  31 20 69 73 20 69 6e 66  69 6e 69 74 65 20 0a 65  |1 is infinite .e|
00000670  6e 65 72 67 79 3a 20 2d  31 20 20 20 20 20 0a 6e  |nergy: -1     .n|
00000680  61 6d 65 3a 20 20 20 22  42 61 74 22 0a 74 65 78  |ame:   "Bat".tex|
00000690  74 3a 20 20 20 22 49 74  20 69 73 20 61 20 6c 61  |t:   "It is a la|
000006a0  72 67 65 20 62 61 73 65  62 61 6c 6c 20 62 61 74  |rge baseball bat|
000006b0  2e 22 0a 63 61 6e 64 6f  3a 20 7b 0a 20 22 68 69  |.".cando: {. "hi|
000006c0  74 22 3a 20 20 20 20 7b  0a 20 70 72 69 6e 74 28  |t":    {. print(|
000006d0  22 59 6f 75 20 68 69 74  20 69 74 20 77 69 74 68  |"You hit it with|
000006e0  20 74 68 65 20 62 61 74  22 29 0a 20 7d 0a 7d 0a  | the bat"). }.}.|
000006f0  7d 0a 0a 7c 20 66 69 6e  61 6c 6c 79 20 74 68 65  |}..| finally the|
00000700  20 70 65 6f 70 6c 65 0a  0a 70 65 72 73 6f 6e 20  | people..person |
00000710  6f 6c 64 5f 6d 61 6e 20  7b 0a 6e 61 6d 65 3a 20  |old_man {.name: |
00000720  22 4f 6c 64 20 4d 61 6e  22 0a 74 65 78 74 3a 20  |"Old Man".text: |
00000730  20 22 48 65 20 69 73 20  6f 6c 64 20 61 6e 64 20  | "He is old and |
00000740  6c 6f 6f 6b 73 20 77 69  73 65 2e 22 0a 6d 6f 76  |looks wise.".mov|
00000750  65 3a 20 6e 6f 0a 65 6e  65 72 67 79 3a 20 2d 31  |e: no.energy: -1|
00000760  0a 73 65 65 3a 20 20 20  20 70 72 69 6e 74 28 22  |.see:    print("|
00000770  54 68 65 20 6f 6c 64 20  6d 61 6e 20 73 61 79 73  |The old man says|
00000780  20 68 65 6c 6c 6f 5c 6e  22 29 0a 75 6e 73 65 65  | hello\n").unsee|
00000790  3a 20 20 70 72 69 6e 74  28 22 54 68 65 20 6f 6c  |:  print("The ol|
000007a0  64 20 6d 61 6e 20 73 61  79 73 20 67 6f 6f 64 62  |d man says goodb|
000007b0  79 65 2e 22 29 20 0a 20  63 61 6e 62 65 3a 20 7b  |ye.") . canbe: {|
000007c0  0a 20 20 22 68 69 74 22  3a 20 7b 20 0a 20 20 20  |.  "hit": { .   |
000007d0  70 72 69 6e 74 28 22 54  68 65 20 4f 6c 64 20 6d  |print("The Old m|
000007e0  61 6e 20 69 73 20 69 6e  76 69 6e 63 69 62 6c 65  |an is invincible|
000007f0  2e 5c 6e 22 29 0a 20 20  7d 0a 20 7d 0a 74 61 6c  |.\n").  }. }.tal|
00000800  6b 3a 20 7b 0a 20 22 68  65 6c 70 22 3a 7b 0a 20  |k: {. "help":{. |
00000810  70 72 69 6e 74 28 22 49  20 61 6d 20 69 6d 61 67  |print("I am imag|
00000820  69 6e 61 72 79 2c 20 49  20 63 61 6e 6e 6f 74 20  |inary, I cannot |
00000830  68 65 6c 70 20 79 6f 75  2e 5c 6e 22 29 20 0a 20  |help you.\n") . |
00000840  7d 0a 7d 0a 7d 0a 0a 7c  20 74 68 65 20 70 6c 61  |}.}.}..| the pla|
00000850  79 65 72 0a 0a 70 6c 61  79 65 72 20 7b 0a 6e 61  |yer..player {.na|
00000860  6d 65 3a 20 22 41 2e 20  4e 2e 20 45 78 70 6c 6f  |me: "A. N. Explo|
00000870  72 65 72 22 0a 74 65 78  74 3a 20 22 59 6f 75 72  |rer".text: "Your|
00000880  20 6e 6f 74 20 61 20 76  65 72 79 20 69 6e 74 65  | not a very inte|
00000890  72 65 73 74 69 6e 67 20  70 65 72 73 6f 6e 2e 22  |resting person."|
000008a0  0a 65 6e 65 72 67 79 3a  20 2d 31 0a 63 61 6e 64  |.energy: -1.cand|
000008b0  6f 3a 20 7b 0a 22 75 6e  6a 75 6d 70 22 3a 20 7b  |o: {."unjump": {|
000008c0  0a 69 66 28 6a 6a 20 3d  20 22 31 22 29 20 7b 0a  |.if(jj = "1") {.|
000008d0  69 66 28 63 5f 72 6f 6f  6d 20 3c 3e 20 22 53 70  |if(c_room <> "Sp|
000008e0  65 63 69 61 6c 20 52 6f  6f 6d 22 29 20 7b 0a 67  |ecial Room") {.g|
000008f0  6f 74 6f 28 6f 6e 65 61  29 0a 70 72 69 6e 74 28  |oto(onea).print(|
00000900  22 57 65 6c 6c 20 44 6f  6e 65 2e 20 59 6f 75 20  |"Well Done. You |
00000910  61 72 65 20 6d 6f 76 65  64 20 62 61 63 6b 20 74  |are moved back t|
00000920  6f 20 74 68 65 20 73 65  63 72 65 74 20 72 6f 6f  |o the secret roo|
00000930  6d 2e 22 29 0a 7d 0a 7d  0a 7d 0a 7d 0a 7d        |m.").}.}.}.}.}|
0000093e