home *** CD-ROM | disk | FTP | other *** search
/ APDL Soft Rock Games / APDL_SOFTROCK.iso / trellis / _trellis / gameprog / _runimage (.txt) < prev    next >
Encoding:
RISC OS BBC BASIC V Source  |  1999-04-24  |  23.4 KB  |  1,081 lines

  1.  *******************************************************
  2.  *         Trellis: The Adventure Interpreter          *
  3.  *(c)copyright 1991-8 Soft Rock Software/Vince M. Hudd *
  4.  *              Game/Interpreter Program               *
  5.  *******************************************************
  6. _Error
  7.  SGrfx% 80000,WSpace% 80000,BGrfx% 170000
  8. TimeReg%=
  9. RegTime%=
  10. TextOnly%=
  11. _TextOnly
  12. _SRSTitle
  13. _LoadFiles
  14. _Wait(500)
  15. _AdvTitle
  16. _WaitForKey
  17. _NewGame
  18. _ReadScript
  19.  Command$ 
  20.  "STOP":
  21.                    QUIT         - Leave program
  22.  "LET" : 
  23. _Store:
  24.             LET          - alter store contents
  25.  ":" : 
  26.                          :            - define label
  27.  "GOTO" : 
  28. _Jump:
  29.             GO           - jump to label
  30.  "CLS" : 
  31. _Cls:
  32.               CLS          - clear screen
  33.  F   
  34.  "LOOK" : 
  35. _Look:
  36.             LOOK         - describe location
  37. !G   
  38.  "INPUT" : 
  39. _Input:
  40.           INPUT        - get player command
  41. "K   
  42.  "COMMAND" : 
  43. _Command:
  44.       COMMAND      - execute player command
  45. #L   
  46.  "RESTART" : 
  47.                    RESTART      - prompt to play again
  48. $H   
  49.  "QUIT"    : 
  50. _Quit:
  51.          QUIT         - prompt to exit game
  52. %>   
  53.  "IF" : 
  54.                 IF           - condition
  55. &>   
  56.  "ELSE" : 
  57. _Else:
  58.             ELSE         - condition
  59. 'E   
  60.  "ENDIF" : 
  61. _EndIf:
  62.           ENDIF        - end of condition
  63. (?   
  64.  "GET" : 
  65. _Get:
  66.               GET          - get object
  67. )@   
  68.  "DROP" : 
  69. _Drop:
  70.             DROP         - drop object
  71. *D   
  72.  "PRINT" : 
  73. _Print:
  74.           PRINT        - print statement
  75. +H   
  76.  "REM" : 
  77.                        REM          - remark statement
  78. ,B   
  79.  "" : 
  80.                           REM          - blank line
  81. -I   
  82.  "SPACE" : 
  83. _Space:
  84.           SPACE        - press <space> prompt
  85. .>   
  86.  "INV" : 
  87. _Inventory:
  88.         INV          - inventory
  89. /G   
  90.  "EXAMINE" : 
  91. _Examine:
  92.       EXAMINE      - describe an object
  93. 0T   
  94. _Report("Undefined Command in script file: "+Command$+" "+
  95. (Command$)))
  96.  Command$="RESTART"
  97.  Command$="RESTART"
  98. _Output(
  99. 13+"Do you want to play again?"+
  100. _Output("Press Y for yes or N for no."+
  101.    A$=
  102.  A$="N" 
  103.  A$="n" 
  104.  A$="Y" 
  105.  A$="y"
  106. _Output(A$+
  107.  A$="N" 
  108.  A$="n" 
  109. _Error
  110. '"Error ";
  111. ;" at line ";
  112. '"This error should be reported to the supplier of the game you were playing. The"'"writer of that game should check then pass details back to Soft Rock Software"'"with a copy of the game, in order that the problem may be tracked down."
  113. _SRSTitle
  114. G$ Sz%=
  115. _SizeOf("Trellis:SRSLogo")
  116. _Load("<Trellis$Path>SRSLogo",SGrfx%,Sz%,0)
  117. _Expand(Sz%)
  118. _SprPlot("SRSLogo",23,400)
  119. _AdvTitle
  120.  !BGrfx%=170000
  121. "OS_SpriteOp",265,BGrfx%
  122. "OS_SpriteOp",266,BGrfx%,"<Obey$Dir>.TitleScn"
  123. _SprPlot("TitleScn",0,0)
  124. _SizeOf(File$)
  125.  F%,Sz%
  126. (File$)
  127.  Sz%=
  128. _Load(Name$,Address%,Size%,E_Ref%)
  129. "OS_File",16,Name$,Address%,0
  130.  E_Ref%<>0 
  131. "SRSLib_Memory",8,Address%,Address%+Size%,E_Ref%
  132. _Expand(Size%)
  133. "Squash_Decompress",4,WSpace%,SGrfx%,Size%,BGrfx%,170000
  134. _SprPlot(Name$,x%,y%)
  135. "OS_SpriteOp",290,BGrfx%,Name$,x%,y%,0
  136. _Wait(Time%)
  137.  *FX15,1
  138.  Tm%=
  139. -Tm%)>=Time% 
  140. (-99)
  141.  *FX15,1
  142. _WaitForKey
  143.  *FX15,1
  144.  *FX15,1
  145. _LoadFiles
  146.  F%,Z%
  147. |  F%=
  148. ("<TreGame$Path>Sizes")
  149. #F%,O_Size%,R_Size%,S_Size%,W_Size%,L_Size%,El_Size%,Ef_Size%,E_Data%
  150.  L_Size%=L_Size%/5
  151.  El_Size%=El_Size%/5
  152.  Ef_Size%=Ef_Size%/5
  153.  Objects% O_Size%,Rooms% R_Size%,Script% S_Size%,Words% W_Size%
  154.  Label%(L_Size%),Else%(El_Size%),Endif%(Ef_Size%)
  155. _Load("<TreGame$Path>Objects",Objects%,O_Size%,E_Data%)
  156. ) O_Start%=
  157. _StartOf(Objects%,O_Size%)
  158. _Load("<TreGame$Path>Rooms",Rooms%,R_Size%,E_Data%)
  159. ' R_Start%=
  160. _StartOf(Rooms%,R_Size%)
  161. _Load("<TreGame$Path>Script",Script%,S_Size%,E_Data%)
  162. ( S_Start%=
  163. _StartOf(Script%,S_Size%)
  164. _Load("<TreGame$Path>Words",Words%,W_Size%,E_Data%)
  165. ' W_Start%=
  166. _StartOf(Words%,W_Size%)
  167.  L_Size%>0 
  168. "  F%=
  169. ("<TreGame$Path>Labels")
  170.  Z%=1 
  171.  L_Size%
  172. #F%,Label%(Z%)
  173.  El_Size%>0 
  174. !  F%=
  175. ("<TreGame$Path>ELSEs")
  176.  Z%=1 
  177.  El_Size%
  178. #F%,Else%(Z%)
  179.  Ef_Size%>0 
  180. "  F%=
  181. ("<TreGame$Path>ENDIFs")
  182.  Z%=1 
  183.  Ef_Size%
  184. #F%,Endif%(Z%)
  185.  O_Numb%=
  186. ($O_Start%)
  187. % O_Start%=O_Start%+
  188. ($O_Start%)+1
  189.  R_Numb%=
  190. ($R_Start%)
  191. % R_Start%=R_Start%+
  192. ($R_Start%)+1
  193.  W_Numb%=
  194. ($W_Start%)
  195. % W_Start%=W_Start%+
  196. ($W_Start%)+1
  197.  Object$(O_Numb%),List$(O_Numb%),Location%(O_Numb%),Weight%(O_Numb%),Examine$(O_Numb%)
  198.  Room$(R_Numb%),Light%(R_Numb%),North%(R_Numb%),East%(R_Numb%),South%(R_Numb%),West%(R_Numb%)
  199.  Up%(R_Numb%),Down%(R_Numb%),Grfx$(R_Numb%),Word$(W_Numb%),Used_Word%(W_Numb%)
  200.  Used_Command%(13),Store%(100)
  201. _StartOf(Data%,Limit%)
  202.  A$,Pointer%
  203.  Pointer%=Data%
  204.  Limit%=Limit%+Data%
  205.   A$=$Pointer%
  206.   Pointer%=Pointer%+
  207. (A$)+1
  208.  A$=""
  209. =Pointer%
  210. _NewGame
  211. 24,0;512;1280;1024;
  212.  0,512
  213. 28,0,31,79,16
  214.  Number%=0 
  215.   Store%(Number%)=0
  216.  Pos_O%=O_Start%
  217.  Number%=1 
  218.  O_Numb%
  219. ,  Text$=$Pos_O%:Pos_O%=Pos_O%+
  220. (Text$)+1
  221. C  Text$=$Pos_O%:Pos_O%=Pos_O%+
  222. (Text$)+1:Object$(Number%)=Text$
  223. A  Text$=$Pos_O%:Pos_O%=Pos_O%+
  224. (Text$)+1:List$(Number%)=Text$
  225. H  Text$=$Pos_O%:Pos_O%=Pos_O%+
  226. (Text$)+1:Location%(Number%)=
  227. (Text$)
  228. F  Text$=$Pos_O%:Pos_O%=Pos_O%+
  229. (Text$)+1:Weight%(Number%)=
  230. (Text$)
  231. D  Text$=$Pos_O%:Pos_O%=Pos_O%+
  232. (Text$)+1:Examine$(Number%)=Text$
  233.  Pos_W%=W_Start%
  234.  Number%=1 
  235.  W_Numb%
  236. A  Text$=$Pos_W%:Pos_W%=Pos_W%+
  237. (Text$)+1:Word$(Number%)=Text$
  238.   Used_Word%(Number%)=
  239.  Pos_R%=R_Start%
  240.  Number%=1 
  241.  R_Numb%
  242. ,  Text$=$Pos_R%:Pos_R%=Pos_R%+
  243. (Text$)+1
  244. A  Text$=$Pos_R%:Pos_R%=Pos_R%+
  245. (Text$)+1:Room$(Number%)=Text$
  246. A  Text$=$Pos_R%:Pos_R%=Pos_R%+
  247. (Text$)+1:Grfx$(Number%)=Text$
  248. ,  Text$=$Pos_R%:Pos_R%=Pos_R%+
  249. (Text$)+1
  250.   Light%(Number%)=
  251. :  North%(Number%)=0:East%(Number%)=0:South%(Number%)=0
  252. 6  West%(Number%)=0:Up%(Number%)=0:Down%(Number%)=0
  253. Text$,"L")>0 
  254.  Light%(Number%)=
  255.   Posn%=
  256. Text$,"N")
  257.  Posn%>0 
  258.  North%(Number%)=
  259. Text$,
  260. (Text$)-Posn%))
  261.   Posn%=
  262. Text$,"E")
  263.  Posn%>0 
  264.  East%(Number%)=
  265. Text$,
  266. (Text$)-Posn%))
  267.   Posn%=
  268. Text$,"S")
  269.  Posn%>0 
  270.  South%(Number%)=
  271. Text$,
  272. (Text$)-Posn%))
  273.   Posn%=
  274. Text$,"W")
  275.  Posn%>0 
  276.  West%(Number%)=
  277. Text$,
  278. (Text$)-Posn%))
  279.   Posn%=
  280. Text$,"U")
  281.  Posn%>0 
  282.  Up%(Number%)=
  283. Text$,
  284. (Text$)-Posn%))
  285.   Posn%=
  286. Text$,"D")
  287.  Posn%>0 
  288.  Down%(Number%)=
  289. Text$,
  290. (Text$)-Posn%))
  291.  Store%(3)=1
  292.  Pos_S%=S_Start%
  293.  ConditionStat%=0
  294.  Command2$=""
  295.  Moved%=
  296. _ReadScript
  297.  Command2$="" 
  298.     Line$=$Pos_S%
  299.      Pos_S%=Pos_S%+
  300. (Line$)+1
  301.     Line$=
  302. _Strip(Line$)
  303.  Line$<>""
  304.    Line$=Command2$
  305.    Command2$=""
  306.   Line$=
  307. _Strip(Line$)
  308.   Command$=""
  309.   Param$=""
  310.   Length%=
  311. (Line$)
  312.    Fspace%=
  313. Line$," ")
  314.  Fspace%=0 
  315.     Command$=Line$
  316.     Param$=""
  317. Line$,1)=":" 
  318.      Command$=":"
  319.      Param$=
  320. Line$,2)
  321.         
  322. "    Command$=
  323. Line$,Fspace%-1)
  324.      Param$=
  325. Line$,Fspace%+1)
  326.  Command$="END" 
  327.  Command$="ENDIF"
  328.  (Command$<>"REM") 
  329.  (Command$<>":") 
  330.  (Pos_S%>Script%+S_Size%)
  331.  Pos_S%>Script%+S_Size% 
  332. _Report("Reached end of script file.")
  333.  Param$<>"" 
  334.  Param$=
  335. _Strip(Param$)
  336. _Strip(Text$)
  337.  Length%
  338. Text$,1)=" "
  339.   Length%=
  340. (Text$)
  341.   Text$=
  342. Text$,Length%-1)
  343. Text$,1)=" "
  344.   Length%=
  345. (Text$)
  346.   Text$=
  347. Text$,Length%-1)
  348. =Text$
  349. _Store
  350.  Equal%=
  351. Param$,"=")
  352.  Equal%=0 
  353. _Report("Bad LET command - missing '='")
  354.  Par1$=
  355. Param$,Equal%-1)
  356. @$ Par2$=
  357. Param$,
  358. (Param$)-Equal%)
  359. Par1$,3) 
  360.  "Roo": 
  361. _letroom
  362.  "Lig": 
  363. _letlight
  364.  "Nor": 
  365. _letnorth
  366.  "Eas": 
  367. _leteast
  368.  "Sou": 
  369. _letsouth
  370.  "Wes": 
  371. _letwest
  372.  "Up%": 
  373. _letup
  374.  "Dow": 
  375. _letdown
  376.  "Obj": 
  377. _letobject
  378.  "Lis": 
  379. _letlist
  380.  "Exa": 
  381. _letexamine
  382.  "Wei": 
  383. _letweight
  384.  "Loc": 
  385. _letlocation
  386.  "Sto": 
  387. _letstore
  388. _Report("Invalid LET command.")
  389. _letroom
  390. Par1$=
  391. Par1$,6)
  392. Room$(
  393. (Par1$))=
  394. (Par2$)
  395. _letlight
  396. Par1$=
  397. Par1$,7)
  398. Light%(
  399. (Par1$))=
  400. (Par2$)
  401. _letnorth
  402. Par1$=
  403. Par1$,7)
  404. North%(
  405. (Par1$))=
  406. (Par2$)
  407. _letsouth
  408. Par1$=
  409. Par1$,7)
  410. South%(
  411. (Par1$))=
  412. (Par2$)
  413. _leteast
  414. Par1$=
  415. Par1$,6)
  416. East%(
  417. (Par1$))=
  418. (Par2$)
  419. _letwest
  420. Par1$=
  421. Par1$,6)
  422. West%(
  423. (Par1$))=
  424. (Par2$)
  425. _letup
  426. Par1$=
  427. Par1$,4)
  428. (Par1$))=
  429. (Par2$)
  430. _letdown
  431. Par1$=
  432. Par1$,6)
  433. Down%(
  434. (Par1$))=
  435. (Par2$)
  436. _letobject
  437. Par1$=
  438. Par1$,8)
  439. Object$(
  440. (Par1$))=
  441. (Par2$)
  442. _letlist
  443. Par1$=
  444. Par1$,6)
  445. List$(
  446. (Par1$))=
  447. (Par2$)
  448. _letexamine
  449. Par1$=
  450. Par1$,9)
  451. Examine$(
  452. (Par1$))=
  453. (Par2$)
  454. _letweight
  455. Par1$=
  456. Par1$,8)
  457. Weight%(
  458. (Par1$))=
  459. (Par2$)
  460. _letlocation
  461. Par1$=
  462. Par1$,10)
  463.  Location%(
  464. (Par1$))=
  465. (Par2$)
  466. _letstore
  467. Par1$=
  468. Par1$,7)
  469. Store%(
  470. (Par1$))=
  471. (Par2$)
  472. _Jump
  473.  Label$=Param$
  474.  Pos_S%=
  475. _FindLabel(Label$)
  476. O ConditionStat%=0:
  477.  - ensure the software doesn't think it's in a condition
  478.  TextOnly% 
  479.  28,1,30,78,1
  480. 24,0;512;1280;1024;
  481.  0,512
  482. 28,0,31,79,16
  483. _Look
  484.  Light%(Store%(3)) 
  485.  Store%(0)=1 
  486.  PROC_Cls
  487. _Render(Grfx$(Store%(3)))
  488. _Output(Room$(Store%(3)))
  489.   Text$="
  490. You can see "
  491.  Number%=1 
  492.  O_Numb%
  493.  Location%(Number%)=Store%(3) 
  494. "    Text$=Text$+List$(Number%)
  495.     Text$=Text$+", "
  496.  Text$<>"
  497. You can see " 
  498. #   Text$=
  499. Text$,
  500. (Text$)-2)+"."
  501. _Output(Text$)
  502.   Text$="
  503. Exits lead "
  504.  North%(Store%(3))>0 
  505.  Text$=Text$+"North, "
  506.  East%(Store%(3))>0 
  507.  Text$=Text$+"East, "
  508.  South%(Store%(3))>0 
  509.  Text$=Text$+"South, "
  510.  West%(Store%(3))>0 
  511.  Text$=Text$+"West, "
  512.  Up%(Store%(3))>0 
  513.  Text$=Text$+"Up, "
  514.  Down%(Store%(3))>0 
  515.  Text$=Text$+"Down, "
  516.  Text$<>"
  517. Exits lead " 
  518. #   Text$=
  519. Text$,
  520. (Text$)-2)+"."
  521. _Output(Text$)
  522. _Output("It is too dark to see anything here.")
  523. _Output(Text$)
  524. Text$,1)=" " 
  525. Text$,1)="
  526. Text$,1)=" " 
  527. Text$,1)="
  528. "OS_PrettyPrint",Text$
  529.  TimeReg% 
  530.   time%=
  531. -RegTime%
  532. "OS_PrettyPrint","( "+
  533. (time%)+" )"+
  534. _Input
  535.  Moved%=
  536.  Text$=""
  537. "What Now? > ";
  538. ""Text$
  539.  Text$<>""
  540.  RegTime%=
  541.  Input$=""
  542.  Pos%=1 
  543. (Text$)
  544.   Letter$=
  545. Text$,Pos%,1)
  546.  Letter$>="a" 
  547.  Letter$<="z" 
  548.    Letter$=
  549. (Letter$)-32)
  550.   Input$=Input$+Letter$
  551.  Number%=1 
  552.  W_Numb%
  553. 2  Used_Word%(Number%)=
  554. _CIfEnt(Word$(Number%))
  555. G  Used_Command%(1)=
  556. _CIfEnt("GET,TAKE,GRAB,LIFT,PICK,STEAL,PINCH,")
  557. G  Used_Command%(2)=
  558. _CIfEnt("DROP,LEAVE,ABANDON,THROW,CHUCK,GIVE,")
  559. )  Used_Command%(3)=
  560. _CIfEnt("NORTH,")
  561. (  Used_Command%(4)=
  562. _CIfEnt("EAST,")
  563. )  Used_Command%(5)=
  564. _CIfEnt("SOUTH,")
  565. (  Used_Command%(6)=
  566. _CIfEnt("WEST,")
  567. &  Used_Command%(7)=
  568. _CIfEnt("UP,")
  569. (  Used_Command%(8)=
  570. _CIfEnt("DOWN,")
  571. '  Used_Command%(9)=
  572. _CIfEnt("INV,")
  573. A  Used_Command%(10)=
  574. _CIfEnt("EXAMINE,STUDY,CHECK,DESCRIBE,")
  575. 0  Used_Command%(11)=
  576. _CIfEnt("LOOK,SEARCH,")
  577. C  Used_Command%(12)=
  578. _CIfEnt("QUIT,END,FINISH,TERMINATE,STOP,")
  579. 5  Used_Command%(13)=
  580. _CIfEnt("HELP,SUPPORT,AID,")
  581. _CIfEnt(Words$)
  582.  Result%=
  583. Words$,1)<>"," 
  584.  Word$=Word$+","
  585.   Com%=
  586. Words$,",")
  587.   Word$=
  588. Words$,Com%-1)
  589.   Word$=
  590. _Strip(Word$)
  591.   Words$=
  592. Words$,Com%+1)
  593. Input$,Word$)>0 
  594.  Result%=
  595. (Words$)=0
  596. =Result%
  597. _Quit
  598. _Output(
  599. 13+"Are you sure you wish to quit this game?"+
  600. _Output("Press Y for yes or N  for no."+
  601.   A$=
  602.  A$="Y" 
  603.  A$="y" 
  604.  A$="N" 
  605.  A$="n"
  606. _Output(A$+
  607.  A$="Y" 
  608.  A$="y" 
  609.  Command$="RESTART" 
  610.  Command$=""
  611. _Print
  612.  Length%=
  613. (Param$)
  614.  Length%>0
  615.   A$=
  616. Param$,1)
  617.  E   
  618.  """":
  619. _PText:
  620.                 "  - print text between quotes
  621. !@   
  622.  "[":
  623. _PStore:
  624.                 #  - print store contents
  625. "=   
  626.  "'":
  627. _PCr:
  628.                    CHAR - print character
  629. #.   
  630. _Report("Unrecognised PRINT format")
  631.   Length%=
  632. (Param$)
  633. _PText
  634.  Param$=
  635. Param$,Length%-1)
  636.  Length%=Length%-1
  637.  Pos%=
  638. Param$,"""")
  639.  Pos%=0 
  640. _Report("Incorrect format of PRINT statement.")
  641.  Text$=
  642. Param$,Pos%-1)
  643. _Output(Text$)
  644. 6! Param$=
  645. Param$,Length%-Pos%)
  646.  Param$=
  647. _Strip(Param$)
  648. _PStore
  649. >  Param$=
  650. Param$,
  651. (Param$)-1)
  652.  Param$=
  653. _Strip(Param$)
  654.  Length%=
  655. (Param$)
  656.  Length%=0 
  657. _Report("Incorrect format of PRINT statement.")
  658.  F_End%=
  659. Param$,"]")
  660.  F_End%<=1 
  661. _Report("Incorrect format of PRINT statement.")
  662.  Form$=
  663. Param$,F_End%-1)
  664. I% Param$=
  665. Param$,
  666. (Param$)-F_End%)
  667. _Output(
  668. (Form$)))
  669.  Param$=
  670. _Strip(Param$)
  671.  Length%=
  672. (Param$)
  673.  Param$=
  674. Param$,Length%-1)
  675.  Param$=
  676. _Strip(Param$)
  677.  Length%=
  678. (Param$)
  679. _Output(
  680. (13))
  681. _Space
  682. _Print
  683.  *FX15,1
  684. _PGet
  685.  obj%=1 
  686.  O_Numb%
  687.   Param$=Object$(obj%)
  688.   Pl%=
  689. (Param$)
  690.  key%=1 
  691.  W_Numb%
  692. k6   
  693. Word$(key%),Pl%)=Param$ 
  694.  Used_Word%(key%) 
  695. l&    
  696.  Location%(obj%)<>Store%(3) 
  697. m.     
  698. _Output("You don't see that."+
  699. (13))
  700. n        
  701. o0     
  702.  (Store%(2)+Weight%(obj%))>Store%(1) 
  703. p,      
  704. _Output("It is too heavy."+
  705. (13))
  706.      
  707. r!      
  708. _Output("Okay."+
  709. (13))
  710. s+      Store%(2)=Store%(2)+Weight%(obj%)
  711.       Location%(obj%)=0
  712.      
  713. v        
  714.  ObjectNumber%=0
  715.  A%=1 
  716.  O_Numb%
  717.  Object$(A%)=Param$ 
  718.  ObjectNumber%=A%
  719.  ObjectNumber%=0 
  720. _Output("You can't."+
  721.  Location%(ObjectNumber%)<>Store%(3) 
  722. _Output("I don't see that here."+
  723.  Weight%(ObjectNumber%)+Store%(2)>Store%(1) 
  724. (    
  725. _Output("It is too heavy."+
  726. _Output("Okay."+
  727. "    Location%(ObjectNumber%)=0
  728. 2    Store%(2)=Weight%(ObjectNumber%)+Store%(2)
  729. _PDrop
  730.  obj%=1 
  731.  O_Numb%
  732.   Param$=Object$(obj%)
  733.   Pl%=
  734. (Param$)
  735.  key%=1 
  736.  W_Numb%
  737. Word$(key%),Pl%)=Param$ 
  738.  Used_Word%(key%) 
  739.  Location%(obj%)<>0 
  740. /     
  741. _Output("You don't have that."+
  742. (13))
  743.         
  744.       
  745. _Output("Okay."+
  746. (13))
  747. *     Store%(2)=Store%(2)-Weight%(obj%)
  748. "     Location%(obj%)=Store%(3)
  749.         
  750. _Drop
  751.  ObjectNumber%=0
  752.  A%=1 
  753.  O_Numb%
  754.  Object$(A%)=Param$ 
  755.  ObjectNumber%=A%
  756.  ObjectNumber%=0 
  757.  Location%(ObjectNumber%)<>0 
  758. _Output("You don't have that."+
  759. (  Location%(ObjectNumber%)=Store%(3)
  760. 0  Store%(2)=Store%(2)-Weight%(ObjectNumber%)
  761. _Output("Okay."+
  762. _Inventory
  763.  Text$="You have "
  764.  Number%=1 
  765.  O_Numb%
  766.  Location%(Number%)=0 
  767. !   Text$=Text$+List$(Number%)
  768.    Text$=Text$+", "
  769.  Text$<>"You have " 
  770. "  Text$=
  771. Text$,
  772. (Text$)-2)+"."
  773. _Output(Text$+
  774. _Output("You have nothing."+
  775.  Param$=
  776. _Strip(Param$)
  777.  ThenPos=
  778. Param$,"THEN")
  779.  ThenPos=0 
  780. _Report("Missing THEN.")
  781.  ParamLength=
  782. (Param$)
  783.  ThenPos=ParamLength-3 
  784.   Param$=
  785. Param$,ThenPos-1)
  786. _BlockIf
  787. "  Command2$=
  788. Param$,ThenPos+4)
  789.   Param$=
  790. Param$,ThenPos-1)
  791. _SLineIf
  792. _SLineIf
  793.  Param$=
  794. _Strip(Param$)
  795.  Length%=
  796. (Param$)
  797.  Length%=0 
  798. _Report("IF without condition.")
  799.  Result%=
  800. (Param$)
  801.  Result% 
  802.   Command2$=""
  803. _BlockIf
  804.  ConditionStat%>0 
  805. _Report("Attempt to nest condition.")
  806.  Param$=
  807. _Strip(Param$)
  808.  Length%=
  809. (Param$)
  810.  Length%=0 
  811. _Report("IF without condition.")
  812.  Result%=
  813. (Param$)
  814.  Result% 
  815.   ConditionStat%=1
  816. &  Pos_S%=
  817. _FindElseOrEndif(Pos_S%)
  818. _Else
  819.  ConditionStat%=0 
  820. _Report("ELSE without IF.")
  821.  ConditionStat%=2 
  822. _Report("Two ELSE commands in IF block.")
  823.  Pos_S%=
  824. _FindEndif(Pos_S%)
  825. _EndIf
  826.  ConditionStat%=0 
  827. _Report("END IF without IF.")
  828.  ConditionStat%=0
  829. _Report(Text$)
  830. ''Text$''
  831. _Command
  832.  Moved%=
  833.  Done%=
  834.  Done% 
  835.  Used_Command%(1)=
  836. _PGet
  837.    Done%=
  838.  Done% 
  839.  Used_Command%(2) 
  840. _PDrop
  841.    Done%=
  842.  Done% 
  843.  Used_Command%(3) 
  844. _Travel("N")
  845.    Done%=
  846.  Done% 
  847.  Used_Command%(5)=
  848. _Travel("S")
  849.    Done%=
  850.  Done% 
  851.  Used_Command%(4) 
  852. _Travel("E")
  853.    Done%=
  854.  Done% 
  855.  Used_Command%(6) 
  856. _Travel("W")
  857.    Done%=
  858.  Done% 
  859.  Used_Command%(7) 
  860. _Travel("U")
  861.    Done%=
  862.  Done% 
  863.  Used_Command%(8) 
  864. _Travel("D")
  865.    Done%=
  866.  Done% 
  867.  Used_Command%(9) 
  868. _Inventory
  869.    Done%=
  870.  Done% 
  871.  Used_Command%(10) 
  872. _PExamine
  873.    Done%=
  874.  Done% 
  875.  Used_Command%(11) 
  876. _Look:
  877. _Output(
  878.    Done%=
  879.  Done% 
  880. _Output("I don't understand."+
  881. _PExamine
  882.  obj%=1 
  883.  O_Numb%
  884.   Param$=Object$(obj%)
  885.   Pl%=
  886. (Param$)
  887.  key%=1 
  888.  W_Numb%
  889. f6   
  890. Word$(key%),Pl%)=Param$ 
  891.  Used_Word%(key%) 
  892. g;    
  893.  Location%(obj%)<>0 
  894.  Location%(obj%)<>Store%(3) 
  895. h.     
  896. _Output("You don't see that."+
  897. (13))
  898. i        
  899. j'     
  900. _Output(Examine$(obj%)+
  901. (13))
  902. k        
  903. _Examine
  904.  ObjectNumber%=0
  905.  A%=1 
  906.  O_Numb%
  907.  Object$(A%)=Param$ 
  908.  ObjectNumber%=A%
  909.  ObjectNumber%=0 
  910.  (Location%(ObjectNumber%)<>0 
  911.  Location%(ObjectNumber%)<>Store%(3)) 
  912. _Output("You don't see that."+
  913. _Output(Examine$(ObjectNumber%)+
  914. _Travel(Direction$)
  915.  Direction$ 
  916.  "N":NewLoc%=North%(Store%(3))
  917.  "E":NewLoc%=East%(Store%(3))
  918.  "S":NewLoc%=South%(Store%(3))
  919.  "W":NewLoc%=West%(Store%(3))
  920.  "U":NewLoc%=Up%(Store%(3))
  921.  "D":NewLoc%=Down%(Store%(3))
  922.  NewLoc%=0 
  923. _Output("You can't."+
  924.   Store%(3)=NewLoc%
  925.   Moved%=
  926. _Output("Okay."+
  927. _Old_FindLabel(Label$)
  928. "SRSLib_Text",3,S_Start%,Script%+S_Size%,
  929. 13+":"+Label$ 
  930.  Position%
  931.  Position%=(Script%+S_Size%) 
  932.  Position%=0 
  933. _Report("Label not found: "+Label$)
  934. =Position%+
  935. ($Position%)+1
  936. _FindLabel(Label$)
  937.  lab%,goto%
  938.  goto%=0
  939.  lab%=1 
  940.  L_Size%
  941.  $(Script%+Label%(lab%))=":"+Label$ 
  942.  goto%=Script%+Label%(lab%)
  943.  goto%=0 
  944. =goto%
  945. _FindElseOrEndif(Position%)
  946.  endif%,else%,lab%
  947.  else%=0
  948.  endif%=0
  949.  El_Size%>0 
  950.  lab%=1 
  951.  El_Size%
  952.  Else%(lab%)+Script%>Position% 
  953.  else%=0 
  954.  else%=Script%+Else%(lab%)
  955.  Ef_Size%>0 
  956.  lab%=1 
  957.  Ef_Size%
  958.  Endif%(lab%)+Script%>Position% 
  959.  endif%=0 
  960.  endif%=Script%+Endif%(lab%)
  961.  endif%=0 
  962. _Report("IF without ENDIF")
  963.  Position%=endif%+2
  964.  ConditionStat%=0
  965.  else%>0 
  966.  else%<endif% 
  967.   Position%=else%+2
  968.   ConditionStat%=2
  969.  Line$=$Position%
  970. # Position%=Position%+
  971. (Line$)+1
  972. =Position%
  973. _Old_FindElseOrEndif(Position%)
  974.  Endif%,Else%
  975. "SRSLib_Text",3,Position%,Script%+S_Size%,
  976. 13+"ELSE" 
  977.  Else%
  978. "SRSLib_Text",3,Position%,Script%+S_Size%,
  979. 13+"END IF" 
  980.  Endif%
  981.  Endif%=0 
  982.  Endif%=(Script%+S_Size%) 
  983. _Report("IF without ENDIF")
  984.  Position%=Endif%+1
  985.  ConditionStat%=0
  986.  Else%>0 
  987.  Else%<Endif% 
  988.   Position%=Else%+1
  989.   ConditionStat%=2
  990.  Line$=$Position%
  991. # Position%=Position%+
  992. (Line$)+1
  993. =Position%
  994. _FindEndif(Position%)
  995.  endif%,lab%
  996.  endif%=0
  997.  lab%=1 
  998.  Ef_Size%
  999.  Endif%(lab%)+Script%>Position% 
  1000.  endif%=0 
  1001.  endif%=Script%+Endif%(lab%)
  1002.  endif%=0 
  1003. _Report("IF ... ELSE without ENDIF")
  1004.  Position%=endif%+1
  1005.  ConditionStat%=0
  1006.  Line$=$Position%
  1007. # Position%=Position%+
  1008. (Line$)+1
  1009. =Position%
  1010. _Old_FindEndif(Position%)
  1011.  Endif%,End_if%
  1012. "SRSLib_Text",3,Position%,Script%+S_Size%,
  1013. 13+"END IF" 
  1014.  Endif%
  1015.  Endif%=0 
  1016.  Endif%=(Script%+S_Size%) 
  1017. _Report("IF..ELSE without ENDIF")
  1018.  Position%=Endif%+1
  1019.  Line$=$Position%
  1020.   Position%=Endif%+
  1021. (Line$)+1
  1022.  ConditionStat%=0
  1023. =Position%
  1024. _Render(File$)
  1025.  Size%
  1026.  TextOnly% 
  1027. ,  Size%=
  1028. _SizeOf("<TreGrfx$Path>"+File$)
  1029. _Load("<TreGrfx$Path>"+File$,SGrfx%,Size%,0)
  1030. _Expand(Size%)
  1031. _SprPlot(File$,32,32)
  1032. _TextOnly
  1033. "OS_File",17,"<Obey$Dir>.Graphics" 
  1034.  T%<>2 
  1035. Said(Word_To_Check$)
  1036.  This function is provided for use of people writing games in TScript.
  1037.  It returns either TRUE or FALSE, depending on wether or not the word
  1038.  supplied as a parameter was entered by the player.
  1039.  It's main purpose is to negate the need to refer to words as numbers
  1040.  using the arrays 'Used_Word%(x)' and 'Used_Command%(x)' where x is
  1041.  the word number. Instead, the actual word can be used instead, eg:-
  1042.       IF FNSaid("FIGHT") AND FNSaid("BEAST") THEN
  1043.  could be used instead of something like:-
  1044.       IF Used_Word%(14) AND Used_Word%(29) THEN
  1045.  which is a lot less clear.
  1046.  Note: the word given as a parameter should be a keyword (ie. the first
  1047.        word on a line in the Words file) if any word on that line is to
  1048.        be checked for. If it is not such a keyword it will be checked
  1049.        for explicitly; Trellis will scan the player's input line to see
  1050.        if the word given was actually entered - ie. no alternatives.
  1051.  Number%, WordNumber%, Comma_Pos%, Keyword$
  1052. Number%=0
  1053.  Word_To_Check$ 
  1054.  "GET":Number%=1
  1055.  "DROP":Number%=2
  1056.  "NORTH":Number%=3
  1057.  "EAST":Number%=4
  1058.  "SOUTH":Number%=5
  1059.  "WEST":Number%=6
  1060.  "UP":Number%=7
  1061.  "DOWN":Number%=8
  1062.  "INV":Number%=9
  1063.  "EXAMINE":Number%=10
  1064.  "LOOK":Number%=11
  1065.  "QUIT":Number%=12
  1066.  "HELP":Number%=13
  1067.  Number%>0 
  1068.  =Used_Command%(Number%)
  1069.  WordNumber%=1 
  1070.  W_Numb%
  1071. ( Comma_Pos%=
  1072. Word$(WordNumber%),",")
  1073. / Keyword$=
  1074. Word$(WordNumber%),Comma_Pos%-1)
  1075.  Word_To_Check$=Keyword$ 
  1076.  Number%=WordNumber%
  1077.  Number%>0 
  1078.  =Used_Word%(Number%)
  1079. Input$,Word_To_Check$)>0 
  1080.  *** end of function!!!!
  1081.