next up previous contents
Next: 4.4 Units Up: 4. The World File Previous: 4.2 Defining new entity   Contents

4.3 Using include files

The include statement can be used to include entity definitions into a world file. For example, the world file from the previous section can be divided into an include file called

# This is an include file.
# It uses the 'define' construct to define a new type of entity.

define myrobot position ( player() laser() )
and a world file called
# This world file creates two robots with lasers.
# It uses the 'include' statement to include the robot definitions.

include ""

environment ( file "cave.pnm" scale 0.03 )

myrobot ( name "robot1" port 6665 pose [1 1 0] )
myrobot ( name "robot2" port 6666 pose [2 1 0] )
The definitions are included using the include "<filename>" statement. Stage searches for <filename> in these directories, in this order:

  1. the current directory
  2. the directory that contains the current world file
  3. the directories listed in the STAGEPATH environment variable