-- restricted.i -- Version 2 -- by Anssi Räisänen Nov 18, 2011 -- This extension must be used together with the standard library. -- This extension introduces the location class 'restricted_location'. -- Here, all actions are disabled according to the message given in the restricted_message object below. -- All actions in a location inheriting from this location class will have the same outcome, defined in the -- message. The default is "You can't do that here." but you can easily change it to something more -- appropriate as needed. This message will then display for all actions tried out in the location: -- >jump -- But you're tied up! -- >take keys -- But you're tied up! -- >attack guard -- But you're tied up! -- etc. -- Note that out-of-world actions such as 'save', 'restore' and 'quit', along with a number of others, -- have not been restricted. Similarly, 'look' and 'inventory' work normally. If you wish to restrict them, -- as well, please add those verbs to the list below. -- Based on the situation the hero is in, you may wish to enable some verbs below by just removing them from -- the list. E.g. if the hero is tied up, he might still be able to listen, think or shout, etc. Remove these -- verbs from the list below in that case. Alternatively, you can leave them in the list but declare a DOES ONLY -- statement for that verb in the location e.g. -- VERB think -- DOES ONLY "Nothing helpful comes to your mind right now." -- END VERB. -- It is of importance to note that exits should be also restricted when the hero is in a location of this kind. -- That can't be handled on the library level but sooner done manually for each appropriate location instance. -- If you wish to make the actions (= verbs and commands) work normally in a restricted_location, give the -- location the attribute 'NOT restricted'. (To disable the verbs and commands again, you should of course change -- the attribute of the location back to 'restricted'.) -- Finally, please note that the restricted_message is shown only if the verb passes all the usual checks in -- the library. THE restricted_message ISA OBJECT DESCRIPTION "You can't do that here." -- change this line to more appropriate as needed END THE. ADD TO EVERY LOCATION IS NOT restricted. END ADD TO. EVERY restricted_location ISA LOCATION IS restricted. VERB answer CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB ask CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB ask_for CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB attack CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB attack_with CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB bite CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB break CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB break_with CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB burn CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB buy CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB catch CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB clean CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB climb CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB climb_on CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB climb_through CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB close CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB close_with CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB consult CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB cut CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB cut_with CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB dance CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB dig CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB dive CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB dive_in CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB drink CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB drive CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB drop CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB eat CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB 'empty' CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB empty_in CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB empty_on CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB 'enter' CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB examine CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB 'exit' CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB extinguish CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB fill CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB fill_with CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB find CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB fire CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB flip CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB follow CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB free CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB get_up CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB get_off CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB give CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB go_to CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB i CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB jump CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB jump_in CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB jump_on CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB kick CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB kill CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB kill_with CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB kiss CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB lie_down CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB lie_in CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB lie_on CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB lift CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB light CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB listen0 CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB listen CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB lock CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB lock_with CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB 'look' CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB look_at CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB look_behind CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB look_in CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB look_out_of CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB look_through CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB look_under CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB look_up CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB open CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB open_with CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB 'play' CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB play_with CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB pour CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB pour_in CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB pour_on CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB pray CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB pry CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB pry_with CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB pull CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB push CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB push_with CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB put CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB put_against CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB put_behind CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB put_down CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB put_in CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB put_near CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB put_on CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB put_under CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB read CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB rub CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB 'say' CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB say_to CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB scratch CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB search CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB sell CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB shake CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB shoot CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB shoot_with CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB shout CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB 'show' CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB sing CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB sip CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB sit CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB sit_on CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB sleep CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB smell0 CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB smell CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB squeeze CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB stand CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB stand_on CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB swim CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB swim CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB swim_in CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB switch_on CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB switch_off CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB take CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB take_from CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB talk CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB talk_to CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB taste CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB tear CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB tell CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB think CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB think_about CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB throw CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB throw_at CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB throw_in CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB throw_to CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB tie CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB tie_to CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB touch CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB turn CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB turn_on CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB turn_off CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB unlock CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB unlock_with CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB use CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB use_with CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. VERB write CHECK THIS IS NOT restricted ELSE DESCRIBE restricted_message. END VERB. END EVERY. -- Examples of use: -- 1) -- THE bedroom ISA RESTRICTED_LOCATION -- DESCRIPTION "You are in the bedroom, sitting on a chair and tied up tightly to it. There's not much you can do presently." -- (you should change this description when the hero gets free) -- VERB cut -- this verb can be left at the list above; the DOES ONLY statement below would override this extension -- DOES ONLY -- IF obj = rope AND knife IN hero -- THEN "You cut the rope with the knife you're holding and stand up." -- MAKE bedroom NOT restricted. -- ELSE "Nope." -- END IF. -- END VERB. -- END THE bedroom. -- Another way of doing the same, using nested locations: -- THE bedroom_tied ISA RESTRICTED_LOCATION IN bedroom -- NAME 'Bedroom (tied up on a chair)' -- DESCRIPTION "You are in the bedroom, sitting on a chair and tied up tightly to it. There's not much you can do presently." -- VERB cut -- this verb can be left at the list above; the DOES ONLY statement below would override this extension -- DOES ONLY -- IF obj = rope AND knife IN hero -- THEN "You cut the rope with the knife you're holding and stand up." -- LOCATE hero AT bedroom. -- the normal location where verbs work as they should -- ELSE "Nope." -- END IF. -- END VERB. -- END THE bedroom. -- 2) -- In this example, we'll see how to use events together with restricted -- player interference: -- (In this extension, declare: -- THE restricted_message ISA OBJECT -- DESCRIPTION "" -- leave the message empty -- END THE. ) -- and then, in your game code: -- THE void ISA RESTRICTED_LOCATION -- HAS value 0. -- DESCRIPTION "You can see absolutely nothing." -- END THE. -- EVENT void_action -- IF value OF void = 0 -- THEN "Nothing seems to work here. There is a spot of green light in the distance." -- ELSIF value OF void = 1 -- THEN "No action seems to help. The green light grows bigger." -- ELSIF value OF void = 2 -- THEN "The green light comes close and you notice that it is a cute little UFO." -- ELSIF ... -- END IF. -- INCREASE value OF void. -- SCHEDULE void_action AT hero AFTER 1. -- END EVENT. -- START AT void. -- SCHEDULE void_action AT hero AFTER 1. -- This way, only the event messages and not any actual outcomes for the verbs are displayed. This method can be used -- when you want to alter the messages after restricted verbs and also if you want to bring the story forward -- without taking the player input into account in any way. -- 3) -- An easy way to give variation to the restricted message is to use DEPENDING ON, e.g.: -- THE restricted_message ISA OBJECT -- DESCRIPTION -- DEPENDING ON RANDOM 1 TO 4 -- = 1 THEN "You can't do that here." -- = 2 THEN "That can't be done here." -- = 3 THEN "That's not possible at the moment." -- = 4 THEN "How exactly? Remember your hands are tied!" -- END DEPEND. -- END THE. -- 4) Restrict exits manually this way: -- THE bedroom ISA RESTRICTED_LOCATION -- ... -- EXIT east TO kitchen -- CHECK bedroom IS NOT restricted -- ELSE "No way!" -- END EXIT. -- -- END THE bedroom. -- 5) If you have several locations in your game where you wish the actions to be restricted, and you wish to -- have different outcomes to actions in these locations, you can do the following: -- THE restricted_message ISA OBJECT -- DESCRIPTION -- IF hero AT bog -- THEN "But you're standing waist-deep in the mud!" -- ELSIF hero AT work -- THEN "But the boss keeps scrutinizing you through the cam!" -- ELSE ... -- END IF. -- END THE.