print "Welcome to Tardis" print "Press any key" print "To Continue" dim xxx[1] as char input xxx font "mini_normal_font" dim zz as int dim sd as int dim ky as int dim sc as int dim jb as int dim st as int sd=1 ky=2 sc=3 jb=4 st=5 dim iv[2] as int dim ir as int dim drp[10] as int dim vb[10] as char dim nrg as int dim cmd as int dim dr as int dim eat as int dim tk as int dim nh as int dim sh as int dim et as int dim wt as int dim inventory as int dr=1 eat=2 tk=3 nh=5 sh=6 et=7 wt=8 inventory=9 dim ou as int dim co as int dim ad as int dim va as int dim cl as int dim e1 as int dim e2 as int dim so as int ou=0 co=1 ad=2 va=3 cl=4 e1=5 e2=6 so=7 function parse ( zz as int) as int parse=0 if vb[0]=101 and vb[1]=97 and vb[2]=116 and vb[3]=0 then parse=eat elseif vb[0]=116 and vb[1]=97 and vb[2]=107 and vb[3]=101 and vb[4]=0 then parse=tk elseif vb[0]=100 and vb[1]=114 and vb[2]=111 and vb[3]=112 and vb[4]=0 then parse=dr elseif vb[0]=105 then parse=inventory elseif vb[0]=104 then parse=0'help elseif vb[0]=110 then parse=nh elseif vb[0]=115 then parse=sh elseif vb[0]=101 then parse=et elseif vb[0]=119 then parse=wt end if end function sub descObject(obj as int) if (obj = 1) then print "sonic screwdriver" elseif (obj = 2) then print "golden key" elseif (obj = 3) then print "very long scarf" elseif (obj = 4) then print "delicious jelly babies" elseif (obj = 5) then print "shining star" else print "nothing" end if end sub sub showinventory(zz as int) print "In your left hand" descObject(iv[0]) print "In your right hand" descObject(iv[1]) end sub sub drItem(zz as int) if drp[ir]=0 then drp[ir]=iv[0] iv[0]=iv[1] iv[1]=0 print "You dropped" descObject(drp[ir]) else print "Cant drop object here" end if end sub sub tkItem(zz as int) if drp[ir]<>0 then if iv[1]=0 then if iv[0]=0 then iv[0]=drp[ir] drp[ir]=0 print "Took . . ." descObject(iv[0]) elseif iv[1]=0 then iv[1]=drp[ir] drp[ir]=0 print "Took . . ." descObject(iv[1]) else print "Your hands are full" end if end if else print "There is nothing to take" end if end sub sub die(zz as int) print "you faint on the spot" print "The light on" print "top of the police box" print "flashes and the TARDIS" print "disappears from view" print "The End." beep 4 while 1 wend end sub sub eatFood(zz as int) if iv[0]=jb then iv[0] = iv[1] iv[1] = 0 nrg = nrg + 100 elseif iv[1]=jb then iv[1]=0 nrg = nrg + 100 else print "You have no food" end if end sub function command(zz as int) as int dim x as int x=0 while x=0 nrg = nrg - 1 if nrg <= 0 then die(zz) end if print "Energy ", nrg input "command ", vb x=parse(zz) if x=0 then print "huh?" elseif x=dr then drItem(zz) elseif x=tk then tkItem(zz) elseif x=inventory then showinventory(zz) elseif x=eat then eatFood(zz) end if wend command = x end function function our(zz as int) as int print "outside the TARDIS," print "a big blue police box" print "doors e" print "I see" descObject(drp[ir]) while cmd=0 cmd = command(zz) if cmd=et then our=co exit function else print "nope" cmd=0 end if wend end function function cor(zz as int) as int print "inside the TARDIS " print "control room - larger" print "inside than outside" print "doors e & w" print "I see" descObject(drp[ir]) while cmd=0 cmd = command(zz) if cmd=wt then if drp[ir]=ky then cor = -1 ' game's over exit function else print "The door is locked" cmd=0 end if elseif cmd=et then cor = ad else cmd=0 end if wend end function function adr(zz as int) as int print "inside Adric's room." print "Adric is the doctor's" print "companion" print "doors n, e, s, & w" print "I see" descObject(drp[ir]) while cmd=0 cmd = command(zz) if cmd=nh then adr=cl elseif cmd=et then adr=e1 elseif cmd=sh then adr=va elseif cmd=wt then adr=co elseif drp[ir]=st then drp[ir]=ky print "POOF" adr=ad else cmd=0 end if wend end function function var(zz as int) as int print "a large room with" print "vaulted ceilings. There" print "is a peg on the wall." print "doors n, e, s" print "I see" descObject(drp[ir]) while cmd=0 cmd = command(zz) if cmd=nh then var=ad elseif cmd=et then var=e2 elseif cmd=sh then var=so elseif drp[ir]=sc then print "PING" drp[ir]=st var=va else cmd=0 end if wend end function function clr(zz as int) as int print "a huge cloister bell" print "is here in this room" print "doors s" print "I see" descObject(drp[ir]) while cmd=0 cmd = command(zz) if cmd=sh then clr=ad else print "BONG" cmd=0 end if wend end function function e1r(zz as int) as int print "there's an echo in here" print "there's an echo in here" print "doors n, e, s, & w" print "I see" descObject(drp[ir]) while cmd=0 cmd = command(zz) if cmd=nh or cmd=wt then e1r=e1 elseif cmd=sh or cmd=et then e1r=e2 else print vb print vb cmd=0 end if wend end function function e2r(zz as int) as int print "there's an echo in here" print "there's an echo in here" print "doors n, e, s, & w" print "I see" descObject(drp[ir]) while cmd=0 cmd = command(zz) if cmd=sh or cmd=wt or cmd=et then e2r=e2 elseif cmd=nh then e2r=ad else print vb print vb cmd=0 end if wend end function function sdr(zz as int) as int print "this is an empty room." print "doors n" print "I see" descObject(drp[ir]) while cmd=0 cmd = command(zz) if cmd=nh then sdr=e1 elseif cmd=et then sdr=ad else print "hmm..." cmd=0 end if wend end function sub top(zz as int) ir=0 while ir <> -1 cmd=0 if ir=ou then ir=our(zz) elseif ir=co then ir=cor(zz) elseif ir=ad then ir=adr(zz) elseif ir=va then ir=var(zz) elseif ir=cl then ir=clr(zz) elseif ir=e1 then ir=e1r(zz) elseif ir=e2 then ir=e2r(zz) elseif ir=so then ir=sdr(zz) end if wend cls if iv[0]=sd or iv[1]=sd then cls beep 7 print "Congratulations" print "The Doctor is here to" print "shake your hand. He" print "thanks you for his" print "Sonic Screwdriver" wait 50 print "He pokes his head" print "out. With a gleam in " print "his eye he asks . . ." print "Care to go for a ride?" print "The End." beep 6 else cls beep 4 print "The Doctor is very " print "disappointed in you." print "You forgot the Sonic" print "Screwdriver." wait 50 print "The Doctor sulks into" print "the TARDIS and it" print "disappears" print "The End." beep 4 end if while 1 wend end sub nrg=26 drp[cl]=sc drp[e1]=jb drp[so]=sd top(zz)