The User class is one of the main game classes.
It handles the user input, menubar, and other event handlers.
Properties
- alterEgo
- canInput
- controls
- echo
- prevDir
- prompt
- inputLineAddr
- x
- y
- blocks
- mapKeyToDir
- curEvent
Methods
-
void init([string
pInputStr, number maxLen]) |
Sets up the User class. If specified,
it sets the inputLineAddr property to pInputStr, otherwise,
the local array is used. If specified, it sets the maxInputLen
property to maxLen, otherwise, it's set to 45. Finally, it sets
up the curEvent property to a local Event instance.
An interesting note is that the
default is 45, but the default inputLineStr is only 41 characters.
This is a bug in the original class system, fixed in my version.
|
-
void doit() |
If gSetRegions is equal to zero,
it clears it's event object, then retrieves a full event (evALL_EVENTS),
and calls it's handleEvent() method.
|
-
bool canControl([bool
fCONTROLS]) |
This is used to find out whether
or not the object can be controlled, as well as to set whether
of not.
If specified, and TRUE, the controls
property is set to fCONTROLS and prevDir is set to CENTER. it
returns the controls property.
|
-
number getInput(heapPtr
pEvent) |
Gets input from the user. This
is used as the dialog which receives the commands such as "open
door".
It returns the length of the input
string.
|
-
number said(heapPtr
pEvent) |
Checks the event's type to see
if it's an evSAID. If it is, and the event's not claimed, the
game class' pragmaFail() method is called.
|
-
void handleEvent(heapPtr
pEvent) |
The User event handler.
It maps the event keys to directions,
handles the menubar, calls the Game class' event handler, handles
alterEgo's event, and if canInput, handles the input/said.
|
|