A Simple (ish) Course In..... STAC Programming ================================================== With Colin "Bronco" Campbell (c) 1991 etc A) All you ever wanted to know about ROOM but were afraid to ask ------------------------------------------------------------- Counter 10 contains the location (i.e. room number) of Mr Thick Git. Message 500 is "Mr Thick Git is very stupid and a total numbbrain." Low: 1) IF VERB "EXAMINE" AND NOUN "GIT" AND COUNTER 10 = ROOM THEN MESSAGE 500 WAIT This means (in plain English): "If I try to EXAMINE Mr Thick GIT and he is in this room then tell me about him" The instruction ROOM returns the present room where YOU are in. Therefore, IF COUNTER 10 = ROOM THEN .... will only be true if the value in COUNTER 10 (i.e. the room that Mr Git is in) is the same as the value returned by ROOM. If they are equal then it means that the value in COUNTER 10 is the same number as this room that you're in is. You cannot directly change ROOM (i.e. let ROOM = 22 will not work) and you shouldn't need to anyway. You would only use the RANDOM command when you wish to give a random chance of Mr Git doing something. This would be used in conjunction with a test to see whether you were in the same location as Mr Git. If you wanted to make Mr Git go to room 3 then you simply use 3 SETCOUNTER 10. This sets COUNTER 10 to the value of 3. B) The Use of Double Brackets -------------------------- Single, double and triple (wow!) brackets are used to make the condition work (it will not if there are not the correct number of brackets) by splitting up various parts into separate modules that are tested apart from one another. IF ( ( VERB "LISTEN" ) OR ( VERB "WATCH" AND NOUN "SCREEN" ) ) AND SET? 15 THEN MESSAGE 1509 WAIT This accepts the following inputs: Listen Watch Screen The next example is more complicated: IF ( ( VERB "ENTER" AND ( NOUN "HOLE" OR NOUN "GRATING" ) ) OR ( VERB "ENTER" ) ) AND SET? 16 THEN MESSAGE 1112 WAIT That accepts the following inputs: Enter Enter Hole Enter Grating The next example is even more complicated: IF ( ( ( VERB "EXAMINE" OR VERB "PULL" OR VERB "PRESS" OR VERB "HIT" ) AND NOUN "JOYSTICK" ) OR ( VERB "PLAY" AND ( NOUN "MACHINE" OR NOUN "JOYSTICK" OR NOUN "GAME" ) ) ) AND RESET? 25 THEN SET 25 14 TO WITH MESSAGE 1194 WAIT This accepts the following inputs: Examine joystick Pull Joystick Press Joystick Hit Joystick Play Machine Play Joystick Play Game Basically, brackets just do away with loads of conditions that would clutter up the tables unnecessarily. C) Markers and Desert Island Disks ------------------------------- All good adventure programmers always note down which flags they have used, list the messages briefly next to the message numbers, list nouns, verbs and adverbs etc., draw a neat map of the game with different coloured pens and write down loads of good ideas for their adventures on a ring-wobble pad. Bad adventure writers do the opposite. Draw your own conclusions, my friend. D) I want a nifty message fader for my title screen. What can I do? ---------------------------------------------------------------- Quite by accident, here is a nifty screen fader that I had prepared earlier: Special Condition 100 1 \ Colin's nifty screen fader - (c) 1990 Creative Insanity 2 \ to use: first use the command 7 colour 0. You then print 3 \ up the message to the screen then call special condition 4 \ 100 and wait. This nifty routine clears the screen and 5 \ resets the colours after use! 6 7 0 setcntr 100 8 repeat 9 7 colour ( 111 * counter 100 ) 10 pause 2 11 inc 100 12 until counter 100 = 7 13 pause 50 14 repeat 15 7 colour ( 111 * counter 100 ) 16 dec 100 17 pause 2 18 until counter 100 = 0 19 split split 20 7 colour 666 21 return E) I like this article. Where does the author live? ------------------------------------------------ The author is said to live at 21 Aldbury Mews, Edmonton, London N9 9JD.