SCEN - the scenario compiler. A scenario is composed of records that define objects, locations and items are two examples of objects in the game. A typical location record might be: l 76 ; Location 76, the passage outside your cabin %"in the passage outside your cabin" [The ground here is rather messy, it shows signs of the heavy traffic that is usually passing back and forth] , sd42 us15 nx44 wp73 en76 c10 . The l line starts a location record, and is followed by the number of the location. A '%' line is needed to contain a description, this will be printed every time you are at the location. This can be up to 250 characters. The description should be enclosed in '"'s, and can extend over multiple lines. As an alternative, if you wish two locations to have the same description, then enter the description for the first of the locations defined, and in the subsequent ones, enter the number of the location whose description you want to copy, so: l 77 % 76 ..... would make location 77 have the same description as location 76. Note that this will only work if location 76 has already been defined: forward references don't work. A '[' or '{' field can contain a longer description. If it is started with a '[', it should be terminated with a ']', and if started with a '{', end with a '}'. This can be up to 4090 characters in length. If '[' and ']' are used, the description will be printed the first time the player arrives at the location, and whenever the look command is issued. If '{' and '}' are use, the long description will only be given in response to a look command. A ',' specifies that this location is dark. Item 1 is special: it is considered the "lamp" item. If the player has item 1 in his inventory, then the commands 'on' and 'off' will activate it. If the lamp is on, in the players inventory or at the same location as the player, then the player will be able to see. n s e w u d fields specify the six directions. Following the direction should be a second letter to say what sort of route exists. p is a passage, d is a door, s is stairs, and x is a way that exists without being described. After the route description is the number of the location at the other end of the route. If no field is entered for a given direction, movement that way will generate a 'You can't go that way' message. As an expansion of this, route code 'n' is a blocked way. This must be followed by a string number, and when the player tries to go that way, his passage is blocked, and the string is printed. Note that this string is taken from the standard string table (like item descriptions etc.) it is only location descriptions that have a separate table. So: sd42 ; door south to location 42 us15 ; stairs up to 15 nx44 ; way north to 15, with no description wp73 ; passage west to 73 en76 ; no way east, but print string 76 when he tries it ; and no way down at all. A 'c' field will specify a score for reaching the location, the first time the player reaches this location, he gets that many points. Finally, the location record must be terminated by a '.' Location numbers run from 1 to 199, and certain locations have special properties. Location 1 is where the player will start. Locations 2 through 10 are 'hide rooms', the hide capability of items will cause them not to show in these rooms. Locations 5 through 15 are 'safe rooms', if a guard is following you it won't go into one of these rooms, but will re-appear when you exit. Also note that in effect records (described below) locations can be used for various purposes, but only locations 1 through 99 can be used here. Item records: i 15 %"A diamond ring" x73 'diamond 'ring h a c 5 l 2 w 15 . is a typical item. The first line consists of an 'i' and the item number. The '%' line is the item's description, this can either be a string (as shown) or a string number. Note that unlike the descriptions of locations, these numbers are actual string numbers, as defined in the string table The 'x' line is optional, and gives a string to be printed when the object is examined. Again this can be defined in line, or given by number. The 'word lines define two words by which this object can be referred, these are used when the object is examined, taken or dropped. The 'h' specifies that when this is at one of the "hide" locations (2 - 10) it does not normally show in the list of items seen. However, a search command will always show it. The 'a' specifies that a 'take all' should not include this object. The 'c' gives a score that is gained the first time this is picked up. The 'l' is the starting location of the object. Note that this can be a standard location (1 - 199), and there are also three special cases: -1 is in the players inventory, -2 is "out of the game", i.e. at no accessible place, and -3 is a synonym for wherever the player is. The 'w' is the weight of the object: this simply limits what the player can pick up, he has a maximum carrying capacity of 100. There are a maximum of 59 items, but only items 1 through 44 can ever appear in the players inventory, and these are the only ones that show up on the ground, and can be taken. 45 through 59 are reserved as a "holding place" for items that are to be copied, this is covered in the effects section. a Mr. Spock There is an option for an assistant in this game, if the assistant becomes enabled, then he/she/it will follow you around. The 'a' record provides the description of the assistant. The description should be no more than 39 characters. g 8 10 12 There is a Klingon guard here! There is also an option for random guard encounters: the 'g' record will define how these work. Firstly there are three numbers: the number of guards, the probability of one appearing, the action taken when one is present. So in this case, a maximum of 8 guards would appear during the game, on each move (when they are enabled) there would be a 10% chance of one appearing, and when there is one present, effect 12 would be activated once per turn. The remaining text is printed when there is one present, and should be limited to 59 characters. x 300 The 'x' record simply shows the maximum score that can be attained, for use in response to the sc command. m 10 20 30 'm' records allow effects to be attached to moving between locations. Whenever the player moves, the locations he's moving from and to are compared to all 'm' records, and the associated effect is done for any that match. So using the above example, movement from location 10 to location 20 would cause effect 30 to be activated. The from and to locations may be entered as -1, which corresponds to any location, so: m -1 15 76 would activate effect 76 any time the player arrived at location 15. Note that a 'wait' command is considered a move from the current location to itself, so that if a wait command were done at location 15, the above 'm' record would match. As a special case: m -1 -1 42 will activate for any move or wait command, since both the from and to locations are -1. p 'verb 'noun 54 'p' records define action phrases: when the command 'verb noun' is entered, action 54 would be executed. This can also be a single imperative: p 'wave 13 would activate effect 13 in response to the command 'wave' It should be noted that only the first four letters of words are considered important, further ones are ignored, so: tarpit and tarpaulin would be considered the same word: tarp Effect records are the game's way of doing things. An effect record starts with a line: f 23 that defines this as effect 23, and ends with a single '.' on a line. Between these can be an arbitrary number of 'if / then' lines, that test conditions, and perform actions if a set of conditions matches. f 17 if ( conditions ) then ( actions ) if ( other conditions ) then ( other actions ) else then ( last actions ) . The above shows a typical effect record. The first set of conditions are tested, if they are true, then the first set of actions are performed, and then processing stops (with one exception, noted below). If the conditions fail, then the next set of conditions are tried, if they are true then their actions are done. The else is optional, and equates to an 'if ( true )' and will act as a catch-all if none of the other conditions match. In any set of conditions, the whole set is considered true only if all the individual conditions evaluate true. The tests that can be done are: vx=n Tests if variable x is equal to n vx#n ................... is not equal to n vxn ................... is greater than n x should be a letter: there are 26 variables, 'a' through 'z'. n should be a number between 0 and 100, variables are limited to these values. ln@m Tests if item n is at location m ln!m Tests if item n is not at location m In these, n should be an item number, from 1 to 59, and m should be a location number in the range 1 to 99. There is one special case for the item: item -1 refers to the player, so: l-1@15 tests if the player is at location 15. Three special cases exist for the location: -1 refers to the players inventory, -2 is the "out of the game" location, and -3 is a synonym for the same place as the player. So l23!-1 tests if item 23 is not in the players inventory, and l42@-3 tests if item 42 is visible on the ground wherever the player is. a- Tests if the assistant is not with the player a+ Tests if the assistant is with the player g- Tests if there is no guard nearby g+ Tests if there is a guard nearby rn Tests if a random number from 0 to 99 is less than n - this is handy for selecting from several random options. To provide some examples: if g+ r80 ; this would test if there was a guard nearby, and an 80% ; chance succeeded if l-1@5 l15@-1 ; this would check if the player was at location 5, and ; carrying item 15 if ve=5 a- ; This would test if variable e had been set to 5, and the ; player's assistant was not present. Note that in the first case: 'if g+ r80' this could be followed by a simple 'if g+' to catch the remaining 20% of chances when the guard was present. The actions available are: vx=n ; set variable x to n vx+n ; add n to variable x vx-n ; subtract n from variable x As with tests, x is a letter between 'a' and 'z', and n is a number between 0 and 100. Results are undefined if an addition or a subtraction take the variable value outside the range 0 to 100. ln=m This makes location n be a copy of location m. The intended use of this is for altering locations, consider the following two locations. l 10 %"in a room with a door in the south wall" np15 sn42 . l 11 %10 np15 sx73 . If the player is at location 10, and tries to go south, string 42 will be printed, but he'll stay at location 10. However, the phrase 'unlock door' might cause the door to open, this would be done by: l10=11 which causes location 11 to be overlaid onto location 10. All the entries are the same, save for the south movement, whice becomes sx73, which means that location 10 now has a route south to location 73. Note how the description for location 11 is %10, this causes it to be a duplicate of the description for location 10. As was noted above, both locations involved in this action must be in the range 1 to 99. in=m This does the same for items, and can be used to alter item descriptions, move them around, or do anything else needed. This is where items 45 - 59 come into play, normally these are not accessible, but they can be copied with this action, thereby altering items that are visible. a- removes the assistant a+ makes the assistant appear g- temporarily disables guards g+ re-enables guards [1] gk kills a guard standing beside the player [1] It should be noted that guards are initially disabled, this allows the player to perform some set of actions before they start appearing, such as taking some item, or some other action. If a guard is beside the player, and he does some action that includes a 'g-', the guard will vanish, but will re-appear immediately if a 'g+' is done. e This is the game end - when this action is performed, the game is over, and the player has won b This is a bad game end, meaning the player has lost n print "Nothing happens" u print "I don't understand" f Usually, if a phrase maps to both a special effect and a normal action (such as 'take item'), if a set of actions are performed because of the phrase, and the associated effect, then the default action is not done. This action causes the default action to be done, even though some special actions were done as well. So as an example, a phrase like 'take something' could be trapped, and the effect would be: f 19 else ; do this all the time then "52 f ; print a message, but pick up the object anyway. . Also note how the single line is forced to happen by starting with an else. "n print string n from the string table cn score n points tn Teleport to location n. Note that movement of this nature does not invoke the 'm 1 2 3' type of actions, they are only for normal movement.