Script Classes for Adventure Games/User Class

From SCI Wiki
Jump to: navigation, search

Official SCI Documentation

Chapter: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14
15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | Index


The User Class

Author: Jeff Stephenson

Date: 5 April 1988

 


The User Class

A User is an object which corresponds to the person playing the game and acts as the intermediary between the person and the other objects in the game. In the current games there is only one User, and thus we use the class User rather than an instance of the class.

In file: user.sc
Inherits from: Object
Inherited by: none


Properties

alterEgo

The ID of the Ego which is controlled by the User.

canInput

TRUE if the User should accept input lines from its player, FALSE otherwise. Any time you don't want the player to be able to type an input line, just set canInput to FALSE. Default at startup is FALSE.

canControl

Set to TRUE to let the User control the alterEgo with direction keys, mouse, etc. Anytime you want to set the alterEgo on a pre- programmed motion, set canControl to FALSE to prevent the player from interrupting the motion and taking control. Default at startup is FALSE.


Methods

doit:

The doit: method for User checks for an event. If one is present, User sends the handleEvent: event message in succession to TheMenuBar (the game's menu bar), alterEgo, and regions (the list of regions, beginning with the current room). If any of these objects respond to the event, they should set the claimed property of the event to TRUE to let the other objects receiving the event know that it has been dealt with. If, after everyone has had a look at it, the event is still unclaimed, User puts up an input line and waits for the player to type a line of input. If a line is entered and the kernel is able to parse the line, the User turns the event into a saidEvent, indicating that valid input has been entered, and again sends the handleEvent: event message to the above objects. Once it has done so, it disposes of the event and returns.

 

Notes


 

Table of Contents

 

< Previous: The Event Class Next: The Game Class >