|
QUESTION:
Only the JUNGLE example declares an actor, and
it doesn't use a script. (I was hoping the
tiger would be an actor.) I would like to see
an example script, and I wonder whether it can
be made responsive to something the hero says or
does?
Paul de Anguera (deanguera@seanet.com)
ANSWER: A possible script in the JUNGLE example could be:
ACTOR tiger AT northern_path
SCRIPT hunting
STEP
"A hungry tiger walks along the path
and disappears to the south."
LOCATE tiger AT southern_path.
"From the north a hungry tiger appears."
STEP
"The tiger takes a sniff at you before continuing
south."
LOCATE tiger AT clearing.
MAKE tiger sleeping.
USE SCRIPT sleeping.
SCRIPT sleeping
STEP WAIT UNTIL hero HERE
"As if aroused by your appearance the tiger turns
in its sleep."
STEP
"Suddenly the tiger is completely awake, staring
directly at you. In his eyes you can see his
hunger."
MAKE tiger NOT sleeping.
END ACTOR tiger.
In this simple example the tiger is aroused by
the hero entering the clearing where he is
sleeping.
Some short examples can also be found in the
manual. And there is an example featuring Floyd,
the robot from Planetfall, in the Etudes in the
Alan
examples directory of the IF Archives on
ftp.ifarchive.org. NOTE however that the
sources in the etudes have been around for a
long time and possibly does not compile
unaltered.
Actor interaction is one of the most problematic
things in IF in general. Interacting with actors
is usually implemented in Alan using player
constructs like
> pat the tiger
> ask the janitor about the car
> tell susan to go home
The first example is rather simple and could be
implemented by adding a verb to the tiger
(handling the special case of patting the tiger,
patting other things would not be possible
unless the verb was generally available):
VERB pat
DOES
"Well, patting a tiger is a feat to admire, however
the tiger is not so impressed!"
MAKE tiger hungry.
USE SCRIPT hunt FOR TIGER.
END VERB pat.
A script named 'hunt' also has to be implemented
in the tiger to handle what it does when it
hunts for something to eat. Note however that if
the tiger simply would eat the hero, this can be
handled directly in the verb body and does not
necessarily imply an additional script.
QUESTION:
Can an object contain an object of a different
class (such as a bottle containing a genie or a
miniature world)?
Paul de Anguera
(deanguera@seanet.com)
ANSWER: Alan does not
support containment of anything other than
objects. However it is wise to keep in mind that
we do not necessarily have to build a complete
simulation of the 'normal' world and its laws of
physics etc.
E.g. implementing a bottle containing a genie in
a bottle would really only require some
descriptional text for the bottle, an invisible
genie (actor or object, see the manual for hints
how to do this). A world inside a container can
be implemented as a set of normal locations, the
connection to the 'real' world being a special
exit or, as in this example, verb:
OBJECT bottle
...
VERB enter
CHECK miniature_world IS visible
ELSE "You can not fit in the bottle."
DOES
LOCATE hero AT miniature_center_square.
END VERB enter.
END OBJECT bottle.
QUESTION: Are there
rules against recursive references, such as an
object that ultimately contains itself?
Paul de Anguera
(deanguera@seanet.com)
ANSWER: Alan does not
prohibit anything which will not lead to a
run-time problem. The principle being that the
player should not ever have the game crash on
him.
Bugs, in the class of logical cliches, can not
be ruled out by the language and compiler. So
in this particular example you can have
objects that are containers and place them in
each other. The result is initially surprising
and rather entertaining, thus left as an
exercise for the reader.
QUESTION:
Can an actor change an attribute of the hero
(blessing him for example)?
Paul de Anguera
(deanguera@seanet.com)
ANSWER: All entities in
an Alan 'program' are global, so their
attributes are accessible from
anywhere. Provided the 'blessed' attribute has
been declared on the hero the following
statement can be used from anyplace, including
from a verb inside an actor or from a script:
MAKE hero blessed.
Making any actor blessed requires the
attribute to be declared as a default actor
attribute. The implications of being blessed
must of course also be implemented.
QUESTION:
Can an actor give or steal an object? (in other
words, can you get objects into or out of the
inventory under program control?)
Paul de Anguera
(deanguera@seanet.com)
ANSWER: The LOCATE
statement moves entities (e.g. objects) from
wherever they are to the indicated position
(location, container) without any restrictions
(except for the case when the new position is
in a container, in which case its limits are
applied). In fact the standard 'take' and
'drop' verbs use program control to transfer
object to and from the inventory.
There has also been some discussion on how to
aid the author to prohibit a move out of a
container, but no good solution has yet been
found (probably a new section in the container
will be needed). An example of this problem is
when an actor carries an object and the
hero/player takes it, the actor should get a
chance to react.
QUESTION:
How do I make a verb applicable to both actors
and objects? Brad
O'Donnell (s7m6@unb.ca)
ANSWER: This was one of
the key new features of Alan v2.7. An example
is available as Verbs refering to actors
and objects among the samples.
QUESTION: How come my
DEPENDING ON RANDOM x TO y doesn't work like I
think it should?
ANSWER: This is a bug in
the DEPENDING ON statement (2.8). The
DEPENDING ON statement was designed to only
execute the expression once, but for several
reasons (mainly temporary brain damage ;(, but
it was aimed to preserve compatability between
versions) it does evaluate the expression once
for every case until it finds a match. This
means that given:
DEPENDING ON RANDOM 1 TO 8
= 1 : "A one!"
= 2 : "A two!"
ELSE "A three and go!"
END DEPEND.
will be executed as if it was equivalent to:
IF RANDOM 1 TO 8 = 1 THEN
"A one!"
ELSIF RANDOM 1 TO 8 = 2 THEN
"A two!"
ELSE
"A three and go!"
END IF.
This will execute "A one!" one out of 8, but
"A two!" only in 1/8th of 7/8, which is less
than one out of eight. This is because the
RANDOM must first return something not a 1
to miss the first case and then, on the
second evaluation, a two in order to catch
that case. The more cases that you have the
more squewed this distribution gets. This
effect might also lead you into believing
that RANDOM might return values not in the
range.
Unfortunately it is impossible to fix this
bug without making interpreters
incompatible, so I have decided to leave it
as it is for now.
The good thing is that it will work
perfectly for any expression that yields the
same value in consecutive evaluations, such
as the value of an attribute.
WORKAROUND: Due to the
last section above it is easy to make a
work-around. Simply assign the value to an
attribute and use that in the DEPENDING
statement:
SET r OF o TO RANDOM 1 TO 8.
DEPENDING ON r OF o
=1 : "A one!"
=2 : "A two!"
ELSE "A three, and go!"
END IF.
QUESTION: Does ALAN
support built-in time capabilities ? A.k.a
counting turns and converting them into
passing minutes. Is there a way to display the
time after each turn ?
Amir Lotan
(pandora_box@geocities.com)
ANSWER: Alan does not
currently support this as built in
functionality. However using a few lines of
code turn counting and converting into time
can be handled. In the same way you can use
an event to automatically display it (or
whatever you chose) each turn. E.g.
EVENT tick.
INCREASE turns OF hero.
IF minute OF clock = 59 THEN
SET minute OF clock TO 0.
INCREASE hour OF clock.
ELSE
INCREASE minute OF clock.
END IF.
"The time is now"
SAY hour OF clock. "$$:$$" SAY minutes OF clock.
END EVENT tick.
QUESTION: Although your
compiler is better than AGT it lacks basic
elements like title screen, instruction option
and tool bar. Amir Lotan
(pandora_box@geocities.com)
ANSWER: Well, the
opinion on what are basic elements depends
on if you focus on the visual appearance or
the ability to support authoring. We have
mainly focused on the 'basic elements' that
are needed to support easy authoring.
This is not to say that we have not been
thinking about things that would improve the
visual appearance and make it more in the
traditional style (i.e. look the same as all
the other systems ;-)
QUESTION:
I edit my files with Notepad under Windows and
save them as text files. I can see the files
in the directory but the ALAN compiler doesn't
find them. Why is that?
ANSWER: Notepad under
Windows can save files as ordinary textfiles
that Alan can read and compile. However if
you use the text file format when you save
Notepad will always add a ".txt" extension
(type). In windows this extension is the
sole indication of what type the file is. So
if you type the file name as "mygame.ala" in
the dialogue box chances are that it ended
up as "mygame.ala.txt". If you have the
option "Show extensions of known file types"
turned off you will still see a file with
the name "mygame.ala" but it is shown as a
text file icon. Try renaming the file in a
MSDOS-command shell using
ren mygame.ala.txt mygame.ala
and retry the compilation.
The above also applies when saving files as
text files using Word or similar programs. Get
a real text editor program. There are many
free ones on e.g. Winsite, Tucows or
Download.com. My favorite is NT-Emacs, a
NT/Windows port of the increadible Emacs
editor. It is very, very powerful but can be a
bit complex and frustrating to begin with.
QUESTION: The ALAN
compiler messages scroll off my screen before
I can read them. I tried piping them to a
file but couldn't get it to work (wish this
was Unix, not DOS). Is there an option or
flag to make them go to a file or display a
screen at a time?
Paul de Anguera (deanguera@seanet.com)
ANSWER: All command
line options are described in the manual,
but can also be listed by using the '-help'
option to the compiler. To handle error
messages there are mainly two options which
can be of use:
-listing <file> create a listing file with error messages
-cc show messages in short compact format
However the Alan compiler uses the standard
error message channel (stderr instead of
stdout, for you techies) for message output
which on some system has been more trouble
than it is worth. In the future it will use
the standard output channel for this, which
will make it easier to redirect (especially
on the PC).
QUESTION: Maps are
important; I've found that most people won't
play D&D without one. Is there some way to
display a diagram or invoke another program to
do it? I thought of typing one with graphic
keys but am hoping for something nicer.
Paul de Anguera (deanguera@seanet.com)
ANSWER: Alan is a
text-only system, but there is a method to
call external programs, the SYSTEM
statement. This could be used for example to
call a program to show a detailed map. But
use of this feature should be most
restricted as any calls to standard MS-DOS
programs will probably not work on an
Amiga... As an author you are responsible to
make your games as portable as possible, in
this case that your map showing program is
available on all platforms. You could
also try to draw a map using ANSI character
art. This is reported to work on most
platforms.
QUESTION: When I try to
run ARUN or ALAN on my PC I get: "Load
error:no DPMI - Get csdpmi*b.zip"
What's going on? And where can I get this file?
Mark H. Scrutton (mhscru01@ulkyvm.louisville.edu)
ANSWER: Some early
versions of Alan for the PC was built using
DJGPP, the excellent PC port of the GNU
C-compiler environment, GCC, by
D.J.Delorie. This produces true 32-bit
virtual memory applications, a feat which on
PC's require something called a DPMI
host. All Windows versions have one but if
you run plain DOS you might miss one. There
is a free one called CWSDPMI which is
distributed with DJGPP and can be
down-loaded from any SimTel mirror such as:
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2misc/
QUESTION: Why does Alan stop with a "No coprocessor" message on my 386?
Mark Bijster (markb@sci.kun.nl)
ANSWER: See the
answer to the previous question. In this
case the installation of emu386.dxe is
reported to remedy the problem.
QUESTION: The MAC
version does not seem to work correctly. I
try to compile the Saviour example but it
just leaves a saviour.txt file and then
exits without any message.
ANSWER: For early
versions of the Mac-port this, as well as
a number of mysterious unexpected
terminations of the Alan compiler (most
often without any messages at all), has
been reported to be remedied by making the
memory allocation for the Alan compiler
larger. The requirements depends very much
on the size of your game.
|