Made with Netscape Composer, DRDOS, Win 3.1, and Win95 when necessary
Written by Joseph P Morris
Proofread by Alan P Keane
(C) 1999 Joseph P Morris
Any trademarks in this document are the property of their respective
owners.
This is free software and as such there is no warranty whatsoever.
Use at your own risk..
Update history:
0.5.01 - 22/05/99 - Final checks for R 0.5
0.5.0 - 05/6/99 - Release 0.50, totally new conversation engineDocumented forgotten functions transfer_to_pocket, force_from_pocket Documented forgotton functions choose_member and choose_leader Documented new function get_number
0.4.1 - 28/3/99 - Release 0.41, VRM system changed to SeeRInserted a new chapter 5: programming conversations (with the new script system) Updated 1.4.1 so it is not obsolete anymore Updated 3.2.3 to add new flags and keywords Documented new Section:Rooftiles in 3.2.9 Added new variables game_minute, game_hour, game_day, game_month, game_year Added undocumented functions transfer_object, get_first_object Added new functions replace_object,move_forward, move_backward, turn_l, turn_r Added new functions add_quantity, take_quantity, wait_for_animation, lightning Added new functions find_object_with_tag, find_container Added new functions get_pflag, set_pflag, get_user_flag, set_user_flag, get_yn Updated screenshots of editor. Added section 2.2.9 - setting an object's owner Added section 2.2.10 - editing an object's statistics Added section 2.2.11 - editing an object's behaviour
0.4.0 - 18/1/99 - Release 0.4, rewrite of core map systemMentioned the graphical script editor in section 3.1. Updated the description of VRMs and how they are compiled in section 4.1 Added new description of how you must use flags since 0.041 Added new VRM functions get_flag and set_flag, see above
0.3.1 - 5/9/98Removed sections 2.2.8 to 2.2.10, about obsolete features of the editor. Added new section 2.2.8, about editing objects inside containers Added new VRM functions redraw_map, line_of_sight, move_to_top and in_pocket Updated create_object and get_top_object, get_best_object etc. Added new vrm function move_object which you must use instead of modifying the X and Y coordinates Added new functions spill_contents and spill_contents_at Added new flags etc to section 3.2.3 and 4.2.4 Added NODRIFT command to Section: Sound in section 3.2.7 Added Section 3.2.7 and 3.2.8 to the index (oops) Added Part 5, about the .GAM file Described partially-solid objects in section 3.2.3
0.3.0 - 15/6/98Added section 2.1.4, about cut and paste Added section 2.1.5, about the tile randomiser Added section 2.1.6, about bulk replace Added two new .cel files to section 1.4.1 set_darkness changed to a single level instead of RGB levels
0.2.8 - 15/6/98Fixed some typos. Added 'light' and 'enemy' to section 4.2.4 Added new function 'set_darkness' to section 4.3.4
0.2.7 - 11/6/98Added new function 'delay' to section 4.3.2 Added new function 'start_song' to section 4.3.2 Updated entry for 'stop_song' in section 4.3.2
0.2.6 - 10/6/98Added new function 'rnd' to section 4.3.2 Added new function 'restart' to section 4.3.4
0.2.5 - 9/6/98Added the 'ifHurt' parameter to section 3.2.3 Fixed typo in the example of section 4.3.2 Added 'object->stats->oldhp' to section 4.2.4
0.2.4 - 21/5/98Sections 1.4.4 and 1.4.5 are re-written because the music is now script-controlled.not loaded incrementally. Added the overlay flag to section 3.2.2 Added the post_overlay flag to section 3.2.3 Added the wielded flag to section 3.2.3 Wrote about the ifDead parameter for objects in section 3.2.3 Added Section 3.2.7, about the new sound loaders Added Section 3.2.8 about the new music loaders. Added the new system variable 'victim' to section 4.2.4 Described new function set_object_sequence in section 4.3.1 Described new printxy function in section 4.3.2
0.2.3 - 20/5/98Wrote about the automatic object placement in section 2.2.8 and 3.2.3 How to put objects into containers. Section 2.2.10
Contents
Part 1 : Introduction
1.1 What is the IRE?Part 2 : The IRE map editor
1.2 What do I need to edit the IRE?
1.3 File formats1.3.1 - Graphics1.4 Where the files should be stored
1.3.2 - Sounds
1.3.3 - Music1.4.1 - RES1.5 How the program searches for files
1.4.2 - RES\BACKINGS
1.4.3 - RES\CODE
1.4.4 - RES\MUSIC
1.4.5 - RES\SOUND
1.4.6 - RES\SPRITES
2.1 BackgroundsPart 3 : The IRE script file2.1.1 getting familiar with the editor2.2 Sprites
2.1.2 placing tiles on the map
2.1.3 selecting tiles
2.1.4 cut and paste
2.1.5 Randomising tiles
2.1.6 Bulk Replacing2.2.1 The editor in sprites mode2.3 Rooftops
2.2.2 Creating sprites
2.2.3 Moving sprites
2.2.4 Changing sprites
2.2.5 Setting the direction
2.2.6 Deleting sprites
2.2.7 Tagging Objects
2.2.8 Editing Containers
2.2.9 Setting a character's individual name
2.2.10 Editing an object's individual statistics
2.2.11 Editing an object's individual behaviour2.3.1 The editor in rooftops mode
2.3.2 Editing rooftops
3.1 What is the script file and what does it do?Part 4 : The IRE VRM system
3.2 Script file sections3.2.1 Section: Sprites
3.2.2 Section: Sequences
3.2.3 Section: Characters
3.2.4 Section: Descriptions
3.2.5 Section: Code
3.2.6 Section: Tiles
3.2.7 Section: Sounds
3.2.8 Section: Music
3.2.9 Section: Rooftiles
4.1 What are VRM files?Part 5 : Programming Conversations4.1.1 The VRM concept4.2 The OBJECT
4.1.2 How VRMs are made
4.1.3 A VRM tutorial
4.1.4 Rules for writing VRMs
4.1.5 How the example works
4.1.6 Data Types4.2.1 Introducing the OBJECT4.3 Function Reference
4.2.2 Creating an OBJECT from scratch
4.2.3 Modifying OBJECTs
4.2.4 OBJECT Reference guide
4.2.5 The TILE4.3.1 Object functions4.4 System Variables
4.3.2 IO functions
4.3.3 Flow control functions
4.3.4 Miscellaneous functions
4.5 Keyboard Macros
5.1 OverviewPart 6 : Game description files
5.2 Page structure and simple commands5.2.1 Simple Linking5.4 Manipulating the game world
5.2.2 Interactive Linking
5.2.3 Images
5.2.4 Setting the text colour
5.3 Advanced conversations - Conditional branching5.3.1 Checking for an object
5.3.2 Important tips
5.3.3 Checking for a party member
5.3.4 Using your own flags
5.3.5 Personal flags5.4.1 Calling VRM functions
5.4.2 Creating and destroying objects
5.4.3 The theory of the conservation of money
6.1 Crucial linesPart 7 : Conclusion and Contact info
6.2 The text console
6.3 Loading screen
I spent the next few years in Ultima 6, hacking it, twisting it, folding
it into new shapes.
I wrote a set of tools which hack the program, and allow you create
new worlds, but there is a limit.
Ultima 6 has some pretty strange data structures which I never did
figure out completely.
In '94 I started an abortive attempt to make a U6 clone, which was codenamed U6C. I couldn't draw a player and it bombed.
After the failure of Avios to run satisfactorily on the P200 I am using, despite intense optimisation, I decided to stop working on it, and turned instead to making a 'perfect' ultima 6 type game. This is what I have so far.
The IRE is a Computer Role-Playing Game which takes most of its ideas from Ultima 6, and some from Ultima 7.
The main difference between the design of U6 and IRE, is that IRE is
designed from the ground up to allow someone to edit it. Ultima 6
was not designed this way.
First, we shall look at all the resources that the game can use.
Map files
The map file is the world in which the player inhabits. At present the engine can only support one map per game, although this will probably change later.
Font
The font is the character set used in the game. The characters are fixed-space 8x8 letters, and are stored in the raw bit-packed format used by Arthur Barr's font editor.
Script file
The script file is central to IRE. It is a description file that
describes a game written using IRE.
It tells the program which sprites will be loaded, it binds the sprites
into animation sequences and defines the behaviour of all characters and
objects in the game.
The script file is described in detail in Chapter 3.
VRM files
Although the script coordinates everything, it is the VRM files which
do the actual work.
VRMs (or Virtual Runnable Modules) are written in C (using my library
functions) and get loaded into the game as it starts. Each game event
is driven by a corresponding VRM.
VRM programming is described in detail in Chapter 4.
Internal graphics
Certain parts of the IRE system have their own sprites, such as the
mouse pointer and the volume slider. These graphics are not controlled
by the script file (although they might be later), and the program will
attempt to load them itself. The internal graphics are 256-colour
and stored in the Animator .CEL format. You can also use PCX if you
prefer.
If you need to convert between CEL and another format, try using PICTVIEW
by Jan Patera.
Sprites and tiles
Sprites and tiles are all defined in the script file, and are loaded
in as the script is parsed.
They are stored in .CEL or .PCX format, and may have either 256 colours
or 16.7 million.
Backing pictures
At present backing pictures are loaded in by the program, like the internal
graphics of the mouse pointer and the volume slider. They must be
in PCX format and either 640x400 in size, or 640x480.
They can be 8-bit or 24-bit PCX files.
Game package
Once you have a finished game and you are ready to distribute it, you
can pack all the datafiles into one large resource file. IRE uses
the .rar files from Eugene Roschal's fine archiver, RAR.
The files must NOT be compressed or the game will be unable to read
them.
Set the compression method to STORE (ALT-M) in order to do this.
Summary
|
|
|
Map files | The IRE editor | |
Font | Arthur's font editor (supplied) | |
Script file | Any text editor | This is covered in part three |
VRM files | SEERC is supplied to build them | This is covered in part four |
Internal graphics | Autodesk Animator | You can use PICTVIEW by Jan Patera to convert graphics to CEL files |
Sprites and Tiles | Any PCX editor | |
Backing pictures | Any PCX editor | |
Game package | The RAR archiver, shareware |
PCX files.
PCX files are straightforward, so any package that creates a .PCX should produce something readable by IRE.
Here are some known caveats:
The PCX files must be compressed using the runlength method. This is the standard, but if you do somehow manage to make an uncompressed PCX file, the program will likely choke on it.
The PCX files must be either 8-bit or 24-bit. 1,2,4 or 16-bit PCX files will be rejected and the program will stop with an error.
CEL files.
The .CEL files refer to Autodesk Animator .CEL files. This means Autodesk Animator, not Animator Pro. Animator Pro uses .FLI files and just calls them .CEL files.
If you try and load a .CEL file created by Animator Pro, IRE will go back to DOS with a panic message saying that the .CEL file you gave it "is not a .CEL file".
If you don't have the original Animator, use .PCX files instead of .CEL.
Alternatively, get RSE 2.00, a freeware program which is able to read and write .CEL files compatible with IRE.
Graphics sizes.
Stereo .WAV files are not supported however.
I don't know if .WAV files can be compressed, but it they can, that
won't work either.
The IRE's sound engine can support the following types of .MOD file:
File name | Name | Channels | Comments |
.MOD | Protracker module | 4 | Generic module format |
.MTM | ? | 16 | More obscure format |
.S3M | Screamtracker III | 32 | Popular module format |
.STM | Screamtracker II | 4 | PC extension to the MOD format |
.ULT | Ultratracker | 32 | Originated on the (late) GUS soundcard |
.XM | Fastracker | 32 | Rival format to S3M
Both FT1 and FT2 variants supported |
Before you race off, remember that there is a maximum of 32 channels available to the sound engine.
If you use all 32 for the music there will be none left for the sound effects.
The amount of channels reserved for the music and sound is set in the
game's config file, not the script file. By default it is
16+4, i.e. 20 channels in total.
Each IRE game will have a directory of its own, and it will look for
the files in various subdirectories
in the tree.
By default, IRE will look in the RES directory, so we'll refer to as
the RES directory in future.
(RES is shorthand for resources).
Note that it does not have to be RES, and you should call your directory
something else when you develop an IRE game.
(It's controlled by your .GAM file, which is described in Part 7)
If you've followed the previous section, you should have some idea of the resources that each IRE game will use.
Unless the file is requested by the system itself, it can go anywhere you like, as the script file will contain the full path of each file.
Internal Graphics and the script file itself, must go in particular places, which will be described in detail later. Where you put the other resources is up to you.
The files are generally organised in this way:
1.4.1 - RES
The RES directory must contain the following files:
main.txt | The script file |
arrow00.cel | The mouse pointer image |
soundbar.cel | The volume slider backing image |
slider1.cel | The slider that has been selected |
slider2.cel | The slider that is not selected |
font.dat | The typeface used in the game |
eyesore.cel | Used by the editor for the 'Random Tile' |
warning.cel | Shown if the Random Tile appears in the game |
credits.dat | ANSI credits at end, like ENDOOM in Doom |
help.txt | A conversation file that is run when F1 is pressed, see Part 5 |
1.4.2 - RES\BACKINGS
The RES\BACKINGS directory must contain the following file:
panel.pcx | The background image of the game status area |
1.4.3 - RES\CODE
You need a place to store the VRM files used in the game, I called mine
RES\CODE.
Again, the VRMs are defined in the script file, so you can put them
anywhere you like,
RES\VRM might be another choice.
You could keep them on another drive, or even just in the RES\ directory,
although that would be untidy.
1.4.4 - RES\MUSIC
You need a place to store the music files. I keep them in RES\MUSIC.
As of kernel version 0.025, the music is defined in the script file,
so you can put them anywhere you like,
RES\MODS might be another choice.
You could keep them on another drive, or even just in the RES\ directory, although that would be untidy.
1.4.5 - RES\SOUND
You need a place to store the sound effects. I keep them in RES\SOUND.
As of kernel version 0.025, the music is defined in the script file,
so you can put them anywhere you like,
RES\WAVS might be another choice.
1.4.6 - RES\SPRITES
You need a place to store the sprites used in the game, I called mine
RES\SPRITES.
Again, the sprites and other game images are defined in the script
file, so you can put them anywhere you like, maybe RES\OBJECTS.
When it tries to load a file, it will look for it in the following order:
NOTE: The map editor will ONLY load maps from the IRE directory,
and not from the RES or RAR sources. All other files, the graphics
and such can be loaded from other sources.
A Background
Objects and characters
Rooftops
First, look the main window. This is the map, as it will
appear when the game is being played.
You can pan around the map using the cursor keys, or the four arrow
buttons to the right of the window.
Also, note the two black panels on the far right-hand side of the screen.
They control the screen display, and allow you to switch off the other layers of the level if you find they get in the way while you are editing.
"SPRITES ON" means that the movable objects in the game, such as the player, other characters and similar things will be displayed. If you click once in the black area, it will read "SPRITES OFF" instead, and any sprites visible on the map will disappear while you are editing the backgrounds.
Similarly, "ROOFTOPS ON" means that the highest-level objects in the
game, normally the roofs of buildings, will be displayed. If you
click in the black area, it will change to "ROOFTOPS OFF". Rooftops
are not displayed by default, as you are mainly going to edit the insides
of buildings and that
is generally impossible with the roof in the way.
Looking to the right of the main map window, are two small squares,
marked 'L' and 'R'.
This shows the currently selected tiles, which will appear when you
click on the map.
The tile in the 'L' window is the tile that will appear if you click with the left button, and the 'R' tile is the tile that will appear if you click with the right mouse button.
This means that you can use the left mouse button to do most of your drawing, and set the right-button to a common sort of tile and use it to erase mistakes without having to select another tile from the list.
The bar has some buttons at either end, allowing you to scroll around the tiles, one at a time or at high speed, through the list of tiles.
To choose a tile, move the mouse over the bar, and click on the tile you want, with the mouse button you wish to contain this tile.
For example, if you click on a wall with the left button, the wall will appear on the 'L' box, and drawing with the left button will draw walls.
Now, you can doodle around on the map with that particular tile.
Adding new kinds of tile is dealt with in Chapter 3.
When it is completed, the Prefab system will support hundreds of clipboards that are stored to disk so you can create a library of commonly-used map sections.
To achieve this, do the following:
1. Click on the 'Random Tile' button at the bottom of the screen. This looks hideous to remind you that the tiles are still on the map.
2. Draw the 'Random Tile' over the section you want to be randomised. If it's a fairly large area, you can use the 'Clear L' or 'Clear R' buttons to fill the screen with the current tile.
3. Now, choose the tiles that you want it to pick from. These must be grouped together on the tile bar: you cannot choose from different tiles scattered everywhere.
4. To do this, Left-Click on the first tile in the group, and Right-Click on the last tile in the group.
(For example, with the grass, left-click on the first tile, and right-click on the seventh), the editor will pick tiles between these two.
5. Click on the Randomise button. All the yellow tiles will be replaced with a selection from the group you chose in step 4.
1. Choose the group of tiles that you want to isolate, for example the grass. Like Step 4 in the Randomiser, you must use the Left and Right buttons to choose the first and last tile to be replaced.
2. Click on 'Replace Tiles', and all the tiles in the group you've selected will turn into the Random Tiles!
3. Now you can use the randomiser to turn them into mud or whatever
you fancy.
First, look the main window. This is still the map, but note that
the character has a white box around him. This is because the player
has been selected, and he is the object being edited.
Now, look again at the two black panels on the far right-hand side of the screen.
"ROOFTOPS OFF" has not changed at all, but "SPRITES ON" has changed to "EXCLUDE OFF".
This switch still controls the display of the sprites, but now it will
switch off most of the sprites if it is enabled, instead of the
whole lot.
Specifically, "EXCLUDE ON" will display only the currently selected
object, i.e. the one with the white box. It is used for situations
when the other objects get in the way of the one you are positioning.
When you do this, a box will appear, showing you a list of all the objects in the game, and displaying a picture of each one.
When you've found the one you want, using the cursor keys to scroll, press ENTER and the object will appear in the middle of the screen.
The object will be highlighted with the white selection box, and you can drag it to the proper place.
To create copies of this object quickly, you can press INS (or INSERT) on the keyboard, and a copy of the object will appear wherever the mouse pointer is on the map. If the mouse pointer is not over the map, no object will be created.
The INS method creates a copy of the selected object. If no object is selected, it will pop up the creation list and the object will appear in the centre of the screen, like 'New Item'.
Individual Names
An object can have its own special name, for example 'Kenny McKormick', which is used when you talk to the person, among other things.
Below the map is the panel marked 'Individual Name:'. You can click on this to enter the object's individual name.
You can move objects by dragging them around the map with the left button, or, you can instantly move an object (without dragging) by right-clicking where you want the object to go. This is often useful if the selected object is off-screen.
When an object is selected, one of these arrows should be depressed.
This is the direction in which the object is facing.
For example, the player can face in any of the four directions.
To make the player face left, select the player and click on the left arrow
button.
The player should now face left.
Many simple objects only have one direction, in which case the arrow buttons will have no effect. Doors and windows usually have two directions, Up/down for the horizontal position, and Left/Right for the vertical position.
The directions an object has are defined in the script file.
This will pop up the creation list again, and the object will change
to the new type. (By default, it will highlight the type of object it was
before in the menu.)
There will be no warning before the sprite is removed, so take care.
The entry box is used to assign a control value to certain objects.
What the object does will depend on the script assigned to it in the main script file, but it will often be necessary to mark certain objects with a tag.
One of the main uses of tags will be locked doors.
A door can be open, shut, or locked shut.
There will also be a key to lock or unlock the door.
In these cases, the key and the door must both have the same Tag number for the key to fit the door.
Click on the number in the black entry box to enter a different tag number.
The button marked 'find tag' will ask you for a number, and then search all the objects in the game to find one with the appropriate tag number. It will not be able to show the object if it is inside a container.
The button marked 'Next free tag' will find the first tag number which does not exist in the game.
Container editing is done using the new 'Edit Pockets' button.
First, select the object you wish to modify. When it is highlighted,
you can click on 'Edit Pockets', which will display a list of the objects
which are in the container. You should see this:
There are currently four things you can do with containers:
1. Create a new object inside a container
2. Delete an object inside a container
3. Move an object out of a container
4. Bring an outside object into the container.
Creating and Removing objects
'Create object' is the button used to create an object. Clicking on this will bring up the familiar creation menu.
To remove an object, first click on the object you want to remove in
the list. It will turn red, indicating that it has been selected.
Then click on 'Remove object' and the chosen object will disappear.
Moving Objects out of the container.
First, highlight the object you want to move out of the container.
Then click on 'Move Outside' and the object will disappear from the
list. When you leave the pocket editing window, you will
find the object on top of the container.
Bringing Objects in to the container.
First, get out of the pocket editor.
Select the container, and place it ON TOP of the object you want to
be inside the container.
Now, making sure the object is highlighted, click on 'Edit Pockets',
and choose 'Bring Inside'.
Press 'Y' to continue and the object will be there.
CAVEAT: It is not currently possible to edit the properties of
an object while it is inside a container. If you wish to adjust the
direction or tag number of an object in a container, you will have to move
it out of the container first.
At the bottom of the panel is a field marked 'Object is property of:'.
If you click on this while an object is selected, you will be asked
to click on the person who owns the object.
Here is the screen you will see:
TYou can pan around the map to find the person who owns it, and click on them. They will be highlighted red when an object they own has been selected.
Alternatively you can choose the person from a list (of all objects which are marked as 'Person' and have an individual name).
If you decide that the object should be public property, you can click
on 'Make Public Property'.
This is done using the 'Statistics' button.
First, select the object you wish to modify. When it is highlighted,
you can click on 'Statistics', which will display the properties you can
edit. You should see this:
This should be self-explanatory.
2.2.11 - Changing an object's behavior
In release 0.5 you can also change the way an individual object interacts with the rest of the world, by giving it its own unique set of functions.
This is done using the 'Behaviour' button.
First, select the object you wish to modify. When it is highlighted,
you can click on 'Behaviour', which will display the properties you can
edit. You should see this:
Each of the boxes (except Speech File) is a VRM function which is called when the event happens. You can choose this from a list.
Speech File is the only one which is not a VRM file: instead you enter
the path to the file containing the conversation.
In the current release, there is no list of files. However the
program will check if the filename you have entered is correct, and warn
you if it does not exist.
Rooftops are completely separate and are for decorative purposes only.
As the name implies, Rooftops are special tiles that are drawn above everything else in the game. They are not always drawn, and the rooftop layer can be shown or removed at will by VRM scripts. By default, they will be removed if the player is underneath a tile.
At the bottom of the screen is the set of tiles that can be used.
These are defined in the script file.
Each tile is a single frame, and it may or may not cause the roof to
disappear when the player is underneath it.
(You don't want this to happen when the player is standing outside
the building and the roof is overhanging.)
Basically you just click and paint the roof tiles. The first tile
in the list is blank and can be used to erase bits of roof.
To do this you must go into the main script file.
You can either do this manually, or you can use the graphical Script
editor, SCRIPTER.
Scripter is not documented yet, but if you read this chapter and then
play around with it, it should be easy enough to pick up.
The IRE script file is a description file that describes a game written
using
IRE. It tells the program which sprites will be loaded, it binds
the sprites
into animation sequences and defines the behaviour of characters in
the game.
The script file is parsed by the game (and the editor) as it starts
up, and any errors it detects will be reported at this stage, with a red
and green error report (except in Linux and BeOS which are black-and-white).
If you intend to start playing around with script files, It is a good idea to print this document out for reference.
Here are some rules for writing script files:
The sprites section is basically a list consisting of the following
form:
SECTION: spritesname filename
'name' is the title of the sprite. Every time you want to refer
to this image,
you should call it by this name.
'filename' is the file containing the image. Images are stored as autodesk animator .CEL files, or .PCX files.
The list will continue until the next section is reached.
EXAMPLE:
SECTION: spritesleft_frame sprites\left01.cel
left_frame2 sprites\left02.cel
left_frame3 sprites\left03.celright_frame sprites\right01.cel
right_frame2 sprites\right02.cel
right_frame3 sprites\right03.celup_frame sprites\up01.cel
up_frame2 sprites\up02.cel
up_frame3 sprites\up03.celdown_frame sprites\down01.cel
down_frame2 sprites\down02.cel
down_frame3 sprites\down03.cel
There are two ways to declare sequences, the 'traditional' way, and
the Quick
way.
Traditionally, sequences are declared like this:
SECTION: sequences
name sequence_name'name'
<options>
framelist:
frame1
frame2
...
END
'framelist:'
FRAMELIST: marks the start of the list of frames. All frames in the
list are entries in the SPRITES section.
'END'
END marks the end of the list of frames.
I.E, everything between framelist: and END will be treated as a frame,
and the program will try to find it in the sprite list.
<options>
You don't literally type '<options>'. Instead, this is the
part where you can specify some flags to control the animation.
The following flags are understood by the game:
pingpong | This makes the animation play backwards when it finishes.
E.g. frame 1, frame 2, frame 3, frame 2, frame 1 |
loops | This will make the animation repeat endlessly. |
stepped | This makes the animation play only after each turn of the game, rather than continuously. |
overlay <sprite> | This will make the specified sprite appear on top of the animation. The overlay will be a single frame, not a real animation. For example, the blood on the dead player is an overlay. |
'LOOPED' or 'LOOP' can be used as alternatives to 'LOOPS'.
Quick sequences
Although the sequence declarations are OK for most things, it is over-long for simple sequences which only need one frame. For example, map tiles will usually consist of a single frame, and the above declaration is overkill.
To speed this up, I added a quicker, easier way to define simple sequences
for map tiles and other single-frame entities.
These are called QuickNames, and they are a one-line sequence definition.
Suppose you wanted to declare this sequence:
name GrassTileUsing a QuickName to declare the tile, it would be done this way:
framelist:
grasstile00
END
quickname GrassTile grasstile00..which is a lot simpler (though much less flexible).
For reference only, it can be noted that the actual declaration of a
QuickName
consists of three words.
1. quickname | Start the declaration |
2. sequence_name | Identifying name of the sequence being created |
3. sprite_name | A sprite from the SPRITES: section |
EXAMPLES:
SECTION: sequences
name MoveLeft
framelist:
left_frame
left_frame2
left_frame3
END
name Moveright
framelist:
right_frame
right_frame2
right_frame3
END
name Moveup
framelist:
up_frame
up_frame2
up_frame3
END
name Movedown
framelist:
down_frame
down_frame2
down_frame3
END
name Dead_Guy
overlay blood
framelist:
dead_guy
END
quickname First_Tile
tile_frame_1
quickname Second_Tile
tile_frame_2
Characters are defined in this way:
SECTION: charactersname charname
hp 99
dexterity 99
weight 99
damage 99
description "You see a Thing."
short "Thing"ifDead thing_is_destroyed
ifUsed thing_is_used
ifTriggered thing_is_stood_on
solid
fixedup up_sequence
down down_sequence
left left_sequence
right right_sequence
'name'
NAME is the description of the character. It is used in the editor,
and in VRM files, if a new object is to be created. Name is required.
'hp'
HP is the initial health of the character. If it is not present,
the health is assumed to be 100. It has a maximum value of 2 billion
health points. If it drops below 0, the object dies. If it
drops below -10000 the object is vapourised!
'dexterity'
DEXTERITY is not yet used. It has a maximum value of 2 billion.
'strength'
STRENGTH is used to determine how many objects this character can carry.
It is only useful if this really is a character. Strength
is implemented in the character's VRM file, not by the actual game itself.
It has a maximum value of 2 billion.
'intelligence'
INTELLIGENCE is not yet used, but it will be used by VRM code to do
something later on. It has a maximum value of 2 billion.
'weight'
WEIGHT is used in conjunction with Strength. In my default files,
a character of strength 30 can carry a total of 30 weight points.
Weight is used by the function 'weight_total', in VRM files. It has a maximum
value of 2 billion.
'damage'
DAMAGE is used in my VRM files as the amount of damage that the object
will do if it is used as a weapon.
In the case of the player or another person, damage is the amount of
damage caused by his or her fists. It has a maximum value of 2 billion.
'light'
LIGHT is the amount of light the object casts, it can be either 0,
1 or -1.
0 means it casts no light at all, 1 means it casts light and -1 means
it casts darkness instead of light.
'description'
DESCRIPTION is a text description of the object which is displayed
when you Look at it. If no description is supplied, the game will
say 'you see nothing of interest.'. (This can be modified, looking
is done through VRM files).
Descriptions can be done in two ways. Either you specify the text of the description in quotes, or you can put the name of an entry from the Description section.
'short'
SHORT is usually a single-word text description of the object which
is displayed when you USE, GET or DROP it. If no description is supplied,
the game will say 'no description'. Watch out for this message when
testing your game.
'ifUsed'
IFUSED will call a VRM function if the player Uses the object.
The parameter will be a VRM in the Code section.
'ifTriggered'
IFUSED will call a VRM function if the player steps on the object.
The parameter will be a VRM in the Code section.
NOTE! current_object will point to the object that was
stood on, and victim will point to the player, or whoever trod on
it.
'ifDead' (also 'ifKilled')
IFDEAD will call a VRM function if the object is destroyed.
This happens when the health reaches 0.
The parameter will be a VRM in the Code section. If no VRM is specified,
nothing will happen until it reaches -10000 when it will disappear and
anything in it's pocket will be emptied out on the spot where it stood.
'ifHurt' (also 'ifDamaged')
IFHURT will call a VRM function if the object takes damage.
(That is, if the health at the end of the turn is less than it was at the
start of the turn).
The parameter will be a VRM in the Code section. If no VRM is specified,
nothing will happen.
I use it in my demo to make the people shout when they are hit, and
to make the bombs explode in a chain reaction.
'ifLookedAt' (also 'iflook', 'iflooked')
IFLOOKEDAT will call a VRM function when the player looks at the object.
This can be used for things like bottles, or allowing the player to know
what's in a container without opening it. Or, it could be used to make
a Basilisk...
The parameter will be a VRM in the Code section. If no VRM is specified,
nothing will happen.
'onInit'
ONINIT will call a VRM function when the object is first created.
It has not been tested.
'behaviour' (also 'behavior')
BEHAVIOUR will call a VRM function every turn of the game loop.
This is used to make the player work as well as
any other object that moves of it's own accord.
The parameter will be a VRM in the Code section. If no VRM is specified,
nothing will happen.
'Conversation'
This is the conversation file that the game will run if the player
talks to this object. It is NOT a VRM file, it is an interpreted
text file. I keep mine in RES\PEOPLE.
See Part 5 to learn about writing conversations.
'contains'
This is an object which the person will be carrying when they are created
(either in the editor or at run-time). For example 'contains knife'
will mean that the person will be created with a 'knife', which is another
object in the scriptfile.
You can have up to 8 'contains object' lines per character.
'resurrect_as'
If an object is dead, it can be resurrected unless otherwise stated.
Normally the object will change form when it is killed, and will return
to its original form when resurrected.
However, you can use 'resurrect_as object' to make the object come
back as something else.
NOTE: resurrect_as has only been lightly tested and may not
work.
'no_resurrect'
A flag to prevent the object from being able to be resurrected.
'solid'
SOLID is a flag that means this object will be solid and the player
cannot walk through it.
'blockslight'
BLOCKSLIGHT is a flag that means this object will block light created
by a nearby light source.
'fixed'
FIXED is a flag that means this object is nailed to the ground and
the player cannot pick it up. It also prevents the object from being
pushed, or even moving by itself.
NOTE! When any object enters a container it will become fixed
(to prevent it from trying to move about) and will stop being fixed when
it leaves the pocket.
'tabletop'
TABLETOP is a flag that means this object is solid and cannot be walked
upon, but objects can be pushed and dropped on top if it.
'invisible'
INVISIBLE is a flag that means this object can only be seen in the
editor, not in the game itself. (Useful for tripwires etc)
'container'
CONTAINER is a flag that means that things can be dropped into this
object and move into its pocket in the game. (In the map editor,
you can move objects into anything.)
'translucent'
TRANSLUCENT is a flag that means this will be drawn using the new translucency
code.
You will be able to see other things through the object.
'post_overlay'
POST_OVERLAY. If the current object's sequence has an overlay
attached, the overlay will be drawn ABOVE all other sprites. The
object will appear below the roof, however.
It is used in the demo to make the door appear above anything else,
and also in the chairs, to make the back appear above the player.
If the object has no overlay, the flag will have no effect.
NOTE: There can be up to 255 objects which do this onscreen
at once. If this limit is exceeded, the rest will not be drawn.
'wielded'
WIELDED is a flag that is used by my default VRMs. If it is set,
the object can be wielded as a weapon or shield etc.
Wielded is not used by the engine at all.
'fragile'
FRAGILE is a flag that is used by my default VRMs. If it is set,
the object will break if thrown too far.
Fragile is not used by the engine at all.
'SpikeProof'
SPIKEPROOF is a flag that prevents this object from setting off any
Triggers.
NOTE: Spikeproof objects cannot be dropped into a container
either.
'Person'
PERSON is a flag that is used to determine if an object is intelligent
or not. It will also apply to animals and monsters.
At present it is only used in one place: If it is set, the object won't
be able to walk onto a tabletop.
'Quantity'
QUANTITY is a flag that means that a single object can actually be
a group of objects, like a pile of gold coins.
For example: 'Look at gold coins: You see 1000 gold coins.'
The actual quantity of objects will be set by the map editor, or by
VRM code, if the object is created at run-time.
Directions.
The next few entries will be the character's movement frames.
To use these, you must specify the direction, then the animation which
is played when the character goes in this direction. The animation
will be an entry from the SEQUENCES section.
The following directions are supported internally and MUST be defined:
upPartially-Solid Objects
down
left
right
You really want to use the graphical editor for this one!
If you have a large object, you might not want all of it to be
solid.
For example, the doors. The door consists of two halves, the
door and the adjacent wall. The player must be able to walk through
only ONE part of the door.
In order to control this, you need to specify two things: The size of the solid part, and the offset from the top-left hand corner. Because the door can either be horizontal or vertical, we must specify both axes separately.
The vertical door has a width and height of 1x2, but the solid area
is just 1x1. And it doesn't start at 0,0 anymore, but 0,1.
So, we have a 1x1 solid area at 0,1.
Here is a helpful diagram:
And here's one for the Horizontal:
You would specify this in the character's description using the SETSOLID command.
SETSOLID has five parameters, the axis, (V or H) the offset (+x,+y) and the size of the solid area (+w,+h)
For the vertical door, which has an offset of 0,1 and a solid area of 1x1 the command is:
SETSOLID V 0 1 1 1
The horizontal door is 2x1, and the solid area is again, 1x1.
But it is at an offset of 0,0.
So the command for this is:
SETSOLID H 0 0 1 1
If setsolid is not used for a large object, the game will assume the entire object is solid.
If you don't follow, take a look at the examples in the main.txt file and use the graphical editor instead.
Active Areas
Active areas are just the same as partially-solid objects, but the areas
which are not covered do not interact with the game at all,
so looking at that square or using it will have no effect.
These are specified using:
SETACTIVEAREA (axis) (x offset) (y offset) (width) (height)
If no active area is specified, it will assume the entire object is
active.
See Partially-solid objects, above.
Descriptions were briefly mentioned in the above section. They
are a way of defining a set of commonly-used text strings for descriptions
in characters and tiles.
They will be used especially in tiles, as there will be a lot of tiles
which need the same description.
Like the Sprites section, the Descriptions section is just a list.
Each entry is in the form:
LABEL String
Where LABEL is a unique identifier for the description, which will be
used in the Characters section.
String is just the text of the description, no quotes.
For example:
SECTION: Descriptions
grass You see some lush green grass
stonewall You see a thick stone wall
player Hi, Mom!
Each entry is a function that is contained in a .VRM file. VRM files are kept in the subdirectory CODE by default, but this just a matter of preference.
Example:
SECTION: CODE
mainproc code\mainproc.vrm
follower code\follower.vrm
schedule code\schedule.vrm
player code\player.vrmThe first three code entries are special and must be supplied.
opendoor code\opendoor.vrm
closedoor code\closedor.vrm
FOLLOWER is called each turn of the game, if you have any followers in the game. Followers are created when someone joins your party, and their behaviour is set to call this function each time they move. A reasonable default behaviour is to centre on the player, using a simple tracking algorithm.
SCHEDULE is called each turn of the game. For this reason, it must take up as little time as possible! It can be used to simulate multitasking but most people will use it to run time-based functions. The demo uses it to make the player come out of the acid trips after a certain number of turns.
The tiles section is used to declare all map tiles that can be used in the game.
Map tiles are declared in a 3 or 4 line declaration like this:
SECTION: tiles
name grass'name'
sequence grass_sequence
description "You see some lush green grass"
solid
'sequence'
SEQUENCE is the animation sequence that is used whenever the tile is
displayed. Mostly it will be a single-frame animation sequence defined
using quickname, but for other things, such as water, it can be a full
animating sequence. The name you put here must be in the Sequences
section.
'description'
DESCRIPTION is a text description of the object which is displayed
when you Look at it. If no description is supplied, the game will
say 'you see nothing of interest.'.
Descriptions can be done in two ways. Either you specify the
text of the description in quotes, or you can put the name of an entry
from the Description section.
'solid'
SOLID is optional. If it is present, the tile will be impassible,
like a wall. If it is not present, the player and any NPCs in the
game
will be able to move through it.
'blockslight'
BLOCKSLIGHT is optional. If it is present, the tile will block
light from a nearby lightsource.
Each entry is the name of a sound that is contained in a .WAV file. WAV files are kept in the subdirectory SOUND by default, but this just a matter of preference.
Example:
SECTION: SOUNDS
ouch sound\ouch.wav NODRIFT # Ouch is always played at a fixed pitchThe name will be used in VRM code to play a sound file.
close_door sound\closdoor.wav # Close_Door will not necessarily be played at original pitch.
Each entry is the name of a song that is contained in a .MOD or .S3M
file. The files are kept in the subdirectory MUSIC by default, but
this just a matter of preference.
For a full list of the sound formats supported, see section 1.4.?
Example:
SECTION: MUSIC
intro music\intro.modThe name will be used in VRM code to play a song file.
theme music\theme.xm
The rooftiles section is used to declare all tiles that can be used
to make a roof.
There can be up to 255. The first one is automatically created
by the system (it is blank).
Roof tiles are declared in a completely different manner to anything
else.
It is just a list of of files, with a single optional flag, and no
name.
The order is important: this is the order they will be presented in the editor, and it cannot be changed without affecting the map.
SECTION: rooftiles
root/tile1.celBy default, the tiles will cause the roof to disappear if the player is standing underneath one.
roof/tile2.cel
roof/tile3.cel stand_under
roof/tile4.cel
roof/tile5.cel stand_under
In Quake, by Id Software, every event that happens in the game is written in a small chunk of script language, called Quake-C, which is compiled into bytecode and parsed by the game.
IRE uses this same approach.
Each game event is written in C, and compiled using a compiler called
SEERC. The compiled code is a .VRM file, which is loaded into
the game as it starts up.
Of course, it's better if you do have a basic grasp of C.
VRMS are written using my special library of functions, for convenience and for security. You cannot use any other functions than are in this library. A VRM, once compiled, will run on any platform.
However it's a good idea to include the source code for the VRMs, in case the VRM binary format ever changes.
To make a VRM, you must first produce a source file using your favourite text editor, and save it with a .CPP file extension, somewhere inside the res/code directory
Then you type BUILD from the res/code directory, and the system will
look for and compile any VRMs that have changed.
You should now have a .VRM file corresponding to the .CPP file you
just wrote!
If any errors occurred, you will get some warning messages during compilation.
Any warnings are considered BAD. You might have a .VRM file out
the other end, but it probably won't work until all the warnings are gone.
Now, if the script file has an entry for OBJECTS.CPP, and if there is a call to the VRM, you will see the VRM work!
I think it's time for a quick tutorial now.
First, go into you chosen paint package, and draw a straight line, or something that looks like a sewing needle.
Save it to RES\SPRITES\needle.PCX (or .CEL)
Next, edit main.txt in the RES\ directory.
Look for SECTION: Sprites
Go to the end of the list, and add a new entry:
Needle SPRITES\needle.pcx(Or, needle.cel, depending on what format you used)
Now, go to SECTION: Sequences
Go to the end of the sequence list, and add a new entry:
quickname Needle NeedleNow, go to SECTION: Characters
name Needle
up Needle
down Needle
left Needle
right Needle
weight 3
description "You see a sharp
sewing needle"
ifUsed
NeedleCode
Now, there is one last entry to make to the script file.
Go to SECTION: Code, and add the new entry:
NeedleCode CODE\needle.vrmNow, we should be ready to make the VRM.
Go into the RES\CODE directory, and create a new file, called NEEDLE.CPP.
The file should read as follows:
// Needle - a sample VRM. This line is
a comment, by the way.
#include "vrm.hpp"
PROC
print("Ouch!\n");
ENDPROC
// Stop typing..
Now, quit from the editor, and type..
BUILD..on the command line. If you typed it correctly, it should chunter for a bit, and you will have a nice NEEDLE.VRM file.
Now, go back to the main IRE directory, and run the editor.
ED -edit test1Go into Sprites mode, and you should be able to create a needle.
Now, run the game! Find the needle, use it, and the player should
be able to prick their thumb on the needle.
These are the ground rules. Venerate them and Obey them in All Things.
Simple Pascal to C conversion guide...
PASCAL | C | DESCRIPTION |
BEGIN | { | Start a block of code |
END | } | End a block of code |
(* | /* | Start a comment |
*) | */ | End a comment |
if a = b then | if (a == b) | If A and B are equal |
a AND b | (a && b) | logical AND in an IF statement |
a OR b | (a || b) | logical OR in an IF statement |
a XOR b | (a ^^ b) | logical XOR in an IF statement |
if NOT a then | if (!a) | if a is not true (i.e. a is zero) |
a := b; | a = b; | let a = b |
// Needle - a sample VRM. This line is a comment, by the way.
#include "vrm.hpp"
PROC
print("Ouch!\n");
ENDPROC
// Stop typing..The first line is just a comment. It is ignored.
The next line, '#include "vrm.hpp"' is needed to set up the compiler.
Don't worry about it, just remember to put it there.
Then we have the PROC line. This tells the compiler that the module
is here,
and everything after it will be compiled up until the ENDPROC line.
(It's actually a #define macro to simplify the process of setting up
a VRM function)
Now we have the actual code.
print("Ouch!\n");
This will print a string in the standard C way, which might be a bit of a shock to PASCAL or BASIC programmers.
I'll go into detail later, but basically, it prints the text out on
the console.
The '\n' at the end is a special code, meaning end-of-line, and the
next string or number to be printed will appear on the line below.
After that, we have the ENDPROC line, which tells the compiler that this is the end of the procedure.
And finally we have another comment.
C data types. All C data types are supported, but these are the
most useful ones:
STRING is a special addition of mine, it maps onto 'char *'
NAME | TYPE | DESCRIPTION |
char | a single letter | Can also be a number from -128 to 127 |
unsigned char | same as char | This is a number from 0 to 255 |
short | number | A number from -32768 to 32767 |
unsigned short | number | A number from 0 to 65535 |
int | number | A number from -2147483647 to 2147483648 |
unsigned int | number | A number from 0 to 4294967296 |
char * | text string | A fixed length text string |
PROC
char character;ENDPROC
short number;
STRING str;character = 'a';
character = 120; // Pascal goes apeshit if you try to do this.. ..but this is not pascal.number = 3;
number = 1 + 2;string = "This is a string";
OBJECT is a pointer to a Thing that appears in the game, that is, a Sprite in the editor, and a Character in the script file.
Each OBJECT is a group of ints, chars and other gubbins that makes up an object in the game.
If you know C, then you'll know what I mean when I say that it is a
pointer to a structure, and each member of the OBJECT is accessed using
object->member notation. If you don't know C that well, then just
do as I say and it will be fine :-)
Normally, an OBJECT is declared as follows:
OBJECT *myobject;However, you must note that 'myobject' is not yet there!
To actually create the object, you will need to call my function, create_object.
You must have some idea of which object to create at this point.
To create a needle from the tutorial, you would use the code:
OBJECT *new_needle;and lo, a needle will appear at coordinates 10,10 on the map.
new_needle = create_object("needle",10,10);
When using create_object, the name you specify is a name in 'Section:
Characters'. If you try to create an object that is not in the section:
characters list, the game will exit and display the following error:
...where 'OBJECTPANEL' is the name of the object that it tried to create.
Now, creating objects is extremely useful, but mostly you will be modifying
existing objects that are internal to the game.
Each OBJECT is a collection of all the properties that the game
character has. The character's position, their health, even their
appearance and behaviour can all be controlled by fiddling around with
the properties of the character's OBJECT.
The object which you are going to spend a lot of time fiddling around
with is the player.
The player has a special variable you can use, so you don't have to
hunt for them. This is called, surprisingly, player.
I'll use the player to demonstrate the parts you can modify. If you look in vrm.hpp, you will see there are others. But you don't want to mess with those.
Each part of an object is addressed using the form object->part.
This may sound confusing, but an example should help.
To set the player's health to 100, you would say:
player->stats->hp = 100;
Where 'player' is the object being modified, and 'stats->hp' is the
amount of health, the part of the player we are changing.
object->stats->hp | number | The object's health. When this is 0, the object dies, or is destroyed |
object->stats->str | number | The object's strength |
object->stats->intel | number | The object's intelligence |
object->stats->weight | number | The object's weight |
object->stats->damage | number | The amount of damage the object can do as a weapon. |
object->stats->quantity | number | Quantity of objects in a group or pile, for example 1000 gold coins. |
object->tag | number | Unique ID number for events, like the unique ID of a key for a door. |
object->light | -1, 0, 1 | If 1 or more, the object emits a circular light pattern of fixed intensity.
If -1 or less, the object emits a circular pattern of DARKNESS. Future releases will support varying intensity and patterns. |
In addition, there is also object->user[0] through to object->user[9], which is a group of 10 variables set aside for VRM writers to use how they want :-)
The following parts of an object you can look at, but you should
not modify unless you know what you're doing.:
Member | Type | Description |
object->name | string | The name of the object. Same string as used in create_object(name) |
object->desc | string | The description you see when you look at it. |
object->personalname | string | The individual name of the object, set in the map editor, or NULL for none. |
object->w | number | width of the object in pixels |
object->h | number | height of the object in pixels |
object->mw | number | width of the object in map squares |
object->mh | number | height of the object in map squares |
object->curdir | number | Direction the object is facing. 0 = up, 1 = down, 2 = left, 3 = right |
object->pocket | OBJECT * | The first entry in a list of objects inside this object's pocket. For bags etc.. |
object->wield[..] | OBJECT *[ ] | An array of objects that the character is wielding. wield[0] to wield[7]
You can wield weapons by modifying this, but don't do anything silly. |
object->stats->oldhp | number | The object's health points at the start of the turn. Modifying this may disrupt the operation of 'ifHurt', see section 3.2.3. |
object->stats->pFlags | number | Conversation flags specific to this object. You should not use this directly, use get_pflag and set_pflag instead. |
object->enemy | OBJECT * | This object is the NPC's enemy, they may relieve their stress on this object. |
object->owner | OBJECT * | This is the object which the current object belongs to. If you steal it when they are looking, they will beat the hell out of you. NULL if public property. |
object->next | OBJECT * | This is the next object in the map square that the object is in. The objects afterwards will appear above it. |
Warning:Unavoidable Changes in 0.041Since release 0.041, you can not use the traditional method of getting
at the flags! If you try to, the VRM will not compile.
Unavoidable Changes in 0.040 Since release 0.04, you must NEVER modify the object's X and Y positions,
or the game will bomb out.
|
There are three objects that have special purposes..
player
We have already looked at player. Player always points to the object you are currently controlling, whether it is the player themselves, or a follower who you have switched control to.
current_object
This is the 'current object'. Many VRMs are designed to perform a certain action on an object, such as moving it, opening it, closing etc. When the VRM code starts running, current_object will have been set to the object you are supposed to modify.
From the IRE demo, here is an example:
PROCWhen you go up to the door and USE it, the game sets current_object to point to the door you are opening.change_object(current_object,"StoneDoor1_Open");ENDPROC
play_sound(0);
victim
Victim is used by the IsTriggered mechanism described in section 3.2.3.
When the VRM code starts running, current_object will have been
set to the object that is being triggered, and victim will be the
object you are supposed to modify.
From the IRE demo, here is an example:
PROCWhen you tread on The Death, it becomes the current_object. You become the victim.victim->stats->hp -= current_object->stats->damage;ENDPROC
TILES are similar to objects, but they deal with the fixed tiles
that make up the map.
The only way you will ever see the TILES, is when you use the function get_tile(x,y), which returns the TILE at that position on the map.
The TILE will be declared as, for example, TILE *tilepointer;
You can never create or destroy tiles.
Here is a list of the members of a TILE what you should know about:
Member | Type | Description |
tile->name | string | The name of the object. Same string as used in create_object(name) |
tile->desc | string | The description you see when you look at the tile |
This is a list of all the functions currently supported by the engine....
Format: void set_flag(OBJECT *object, FLAG_TYPE, int ONE_OR_ZERO);
Description: Allows you to set a controlling flag in an object.
Input: The OBJECT which is to be modified, and the flag to change
(See below for the list) and the new value it will take.
Flag | Description |
IS_ON | If 1, the object is usable. If 0, it has been 'killed' and is not really
there.
Setting it to 1 again will bring he object 'back to life'. |
IS_PARTY | Is the object a party member? If so, you can walk through it and swap places |
IS_FIXED | Can the object be picked up, pushed around or move by itself? Fixed to the ground if 1. Objects automatically become fixed when put in a container, and un-fixed when they leave. |
IS_SOLID | Can you walk over it or is it solid? Impassible if 1 |
IS_TABLETOP | If 1, you can drop objects on it, even though it is solid. |
IS_CONTAINER | If 1, then you can drop other objects into it, and it will move them into its object->pocket list. Affects move_from_pocket |
IS_TRANSLUCENT | If 1, the object is drawn semi-transparently. No other effects. |
CAN_WIELD | If 1, the object can be wielded by the player (Not enforced by the engine) |
IS_SPIKEPROOF | If 1, the object does not respond to triggers, and cannot be dropped in containers. |
IS_FRAGILE | If 1, the object will break if thrown too far. (Not enforced by the engine) |
IS_INVISIBLE | If 1, the object cannot be seen on the map and will not always interact. |
IS_YOURS | If 1, the object is Your Property (Not enforced by the engine) |
DOES_BLOCKLIGHT | If 1, the object will block light from a light source. |
IS_PERSON | If 1, the object cannot walk onto a tabletop, other effects will come later too |
SEEK_STATE | Reserved for moving NPCs |
IS_QUANTITY | If 1, the object can be a group of objects. For example, one object could be a pile of 1000 gold coins, (which could be split into several piles of 250 gold coins or similar). |
Returns: nothing.
Since IRE 0.041, you MUST use this function instead of accessing the
flags directly.
Example:
get_flag (new in 0.041)
set_flag(player,IS_TRANSLUCENT,1);
Format: int get_flag(OBJECT *object, FLAG_TYPE);
Description: Allows you to find out whether a controlling flag is set or not.
Input: The OBJECT which is to be modified, and the flag to change (See set_flag for the list)
Returns: 1 if the flag is set, or 0 if it isn't set.
Since IRE 0.041, you MUST use this function instead of accessing the
flags directly.
Example:
if( get_flag(player,IS_TRANSLUCENT))
print("The player is high as a kite\n");
set_pflag (new in 0.05)
Format: void set_pflag(OBJECT *object, int flag_no, int ONE_OR_ZERO);
Description: Allows you to set a conversation flag in an object. See Part 5 for more detail about this.
Input: The OBJECT which is to be modified, and the flag to change (a number between 0 and 31) and the new value it will take.
Returns: nothing
Example:
set_pflag(object,31,1); // Set flag 31 to be TRUE for this objectget_pflag (new in 0.05)
Format: int get_pflag(OBJECT *object, int flag_no);
Description: Allows you to examine a conversation flag in an object. See Part 5 for more detail about this.
Input: The OBJECT which is to be scrutinised, and the flag to examine (a number between 0 and 31).
Returns: 0 if the flag is false, or something else if it is true.
Example:
if(get_pflag(object,2))
{
printf("He is angry and will not speak to you.\n");
return;
}
set_user_flag (new in 0.05)
Format: void set_user_flag(STRING flag_name, int ONE_OR_ZERO);
Description: Allows you to set a named conversation flag that is accessable throughout the game. If the named flag does not exist, a new one will be created with that name. See Part 5 for more detail about this.
Input: The flag to change (a string) and the new value it will take.
Returns: nothing
Example:
set_user_flag("killed_the_king",1);get_user_flag (new in 0.05)
Format: int get_user_flag(STRING flag_name);
Description: Allows you to examine a named conversation flag that is accessable throughout the game. If the named flag does not exist, it returns FALSE. See Part 5 for more detail about this.
Input: The flag to examine (a string)..
Returns: 1 if the flag is true, 0 if the flag is flase or does not exist yet.
Example:
if(get_user_flag("killed_the_king"))move_object (new in 0.04)
printf("TREASON! HIGH TREASON!\n");
Format: int move_object(OBJECT *object, int x, int y);
Description: Moves the object around the map. If you modify the coordinates directly, the game will fall over.
Input: The OBJECT which is to be moved, and the new position it will occupy.
Returns: 1 if the move was successful, 0 if it was blocked by an obstruction.
Since IRE 0.04, you MUST use this function or risk calamity.
Example:
move_object(player,player->x+1,player->y+1);
transfer_object (new in 0.04 but undocumented)
Format: void transfer_object(OBJECT *object, int x, int y);
Description: Moves the object around the map without checking. Can move through walls or on top of solid objects.
Input: The OBJECT which is to be moved, and the new position it will occupy.
Returns: Nothing. If it fails (unlikely) the game will abort with an error message.
See move_object above.
create_object
Format: OBJECT *create_object(STRING name, int x, int y);
Description: Creates a new object and adds it into the list of Things.
Input: A STRING with the name of the sprite to create, (from CHARACTERS), the coordinates where it will appear.
Returns: The newly-created object.
Since IRE 0.04, the X and Y coordinates must be specified.
Example:
OBJECT *enemy;
enemy = create_object("evil_dude",10,10);
remove_object
Format: remove_object(OBJECT *victim);
Description: Destroys an object and frees the resources it is using.
Input: The OBJECT to be removed.
Returns: nothing.
(pointless) Example:
OBJECT *enemy;change_object
enemy = create_object("evil_dude");
remove_object(enemy);
Format: change_object(OBJECT *object, STRING name);
Description: Changes an existing object into another type of object. Most of the statistics such as health, strength etc remain unchanged.
Input: The OBJECT you are going to change, A STRING with the name of the new object type, (from CHARACTERS).
Returns: nothing.
Example:
OBJECT *enemy;replace_object (new in 0.05)
enemy = create_object("evil_dude");
change_object(enemy, "really_evil_dude");
Format: replace_object(OBJECT *object, STRING name);
Description: Changes an existing object into another type of object
completely, discarding all previous statistics and other info.
Input: The OBJECT you are going to change, A STRING with the
name of the new object type, (from CHARACTERS).
Returns: nothing.
Example:
OBJECT *enemy;set_object_direction
enemy = create_object("evil_dude");
replace_object(enemy, "pumpkin");
Format: set_object_direction(OBJECT *object, long DIRECTION);
Description: Set the direction that the object is facing.
Input: The OBJECT you are going to change, A number 0-3, or preferably,
one of the following macros:
UPReturns: nothing.
DOWN
LEFT
RIGHT
Example:
OBJECT *enemy;set_object_sequence
enemy = create_object("evil_dude");
set_object_direction(enemy, UP); // Face upwards, (North)
Format: set_object_sequence(OBJECT *object, STRING sequence);
Description: This will change the appearance of the object, so that a special animation sequence is displayed instead, until the object moves. It has no physical effects on the object, only its appearance.
Input: The OBJECT you are going to change, A string, which must be one of the entries in SECTION: SEQUENCES from the script file.
Returns: nothing.
Example:
OBJECT *enemy;get_object
enemy = create_object("evil_dude",10,10);
if(enemy->user[0] == bored)
set_object_sequence(enemy, "evil_dude_twiddling_thumbs");
Format: OBJECT * get_object(short x, short y);
Description: Looks at the map square X,Y, and returns the object in this position. If there are more than one object in this space, it will return the one on the top of the pile.
Input: The X and Y coordinates of the map square to be investigated.
Returns: The object it found, or NULL if nothing was found. MAKE
SURE you check that this is not NULL, otherwise the game will crash out.
Example:
OBJECT *it;get_top_object
it = get_object(100,100);
if( it != NULL)
print("We found something!");
Format: OBJECT * get_top_object(short x, short y);
get_top_object is obsolete. Please use get_object instead.
get_best_object
Format: OBJECT * get_best_object(short x, short y);
get_best_object is obsolete. Please use get_object instead.
get_first_object (new in 0.040 but undocumented)
Format: OBJECT * get_first_object(short x, short y);
Description: Looks at the map square X,Y, and returns the object in this position. If there are more than one object in this space, it will return the one at the bottom of the pile.
Input: The X and Y coordinates of the map square to be investigated.
Returns: The object it found, or NULL if nothing was found. MAKE
SURE you check that this is not NULL, otherwise the game will crash out.
Example:
OBJECT *it;
it = get_first_object(100,100);
if( it != NULL)
print("We found something!");
find_object_with_tag (new in 0.05)
Format: OBJECT * find_object_with_tag(int tag, STRING name);
Description: Looks through the entire map and returns the first object of type 'name' with the matching tag, or NULL if none could be found..
Input: The tag number to search for, and an optional object type to search for, or NULL if any object will do.
Returns: The object it found, or NULL if nothing was found. MAKE
SURE you check that this is not NULL, otherwise the game will crash out.
Examples:
OBJECT *it;find_container (new in 0.05)
it = find_object_with_tag(15,NULL); // any type of object will do
if( it != NULL)
print("We found something!");it = find_object_with_tag(15,"door"); // only a door will do
if( it != NULL)
print("We found a door!");
Format: OBJECT * find_container(OBJECT *object);
Description: Looks through the entire map and returns the object that contains the specified object.
Input: The object which you want to find the container for.
Returns: The object it found, or NULL if nothing was found. MAKE
SURE you check that this is not NULL, otherwise the game will crash out.
Example:
it = find_container(object);
if( it != NULL)
print("We found the container which has %s in it.",object->name);
show_object
Format: show_object(OBJECT *object, int x,int y);
Description: Displays an OBJECT on the screen, without any relation to the map whatsoever. Used for status area and suchlike.
Input: The object to be projected, and the X and Y coordinates on the screen where the object will appear.
Returns: nothing.
Example:
OBJECT *object = NULL; // Zero to begin withobject_is_calledPROC
if(object == NULL)
object = create_object("cursor");show_object(100,100,object);ENDPROC
Format: short object_is_called(OBJECT *object, STRING name);
Description: This returns a non-zero value if the NAME string is the same as the object's name. Returns 0 if no match.
Input: The object being tested, and the name we are looking for.
Returns: non-zero on a success, 0 on error..
Example:
if( object_is_called(object,"door"))move_to_pocketprint("it is a door");
Format: move_to_pocket(OBJECT *object, OBJECT *pocket);
Description: This moves OBJECT into the pocket of the object POCKET.
To preserve the integrity of the game, certain things are disallowed.
You cannot move an object into its own pocket,
or pick up an object marked as a Person. If you need to do either
of these, use transfer_to_pocket.
No checking is performed as regards weight!
move_to_pocket correctly handles grouped objects such as a pile of coins.
Input: The object to move, and the object which has the pocket we are interested in.
Returns: none.
Example:
move_to_pocket(current_object,player);
transfer_to_pocket
Format: transfer_to_pocket(OBJECT *object, OBJECT *pocket);
Description: This moves OBJECT into the pocket of the object POCKET.
It can be used to move people, inclusding the player, into a container,
which is illegal when using move_to_pocket.
Use with care, since the game will not work correctly if the player is
incapacitated.
transfer_to_pocket correctly handles grouped objects such as a pile of
coins.
Input: The object to move, and the object which has the pocket we are interested in.
Returns: none.
Example:
transfer_to_pocket(player,vehicle);move_from_pocket
Format: long move_from_pocket(OBJECT *object, OBJECT *pocket, short X, short Y);
Description: This moves OBJECT out of the pocket of the object POCKET, and put it on map square X,Y. If something else is in the way, it will return 0, allowing you to print 'blocked' or such.
Input: The object to move, object which has the pocket we are interested in, nd the X,Y of the place to drop it.
Returns: 0 if the operation failed, because there was something in the way. 1 on success.
Example:
move_from_pocket(current_object,player,100,100);
force_from_pocket
Format: long force_from_pocket(OBJECT *object, OBJECT *pocket, short X, short Y);
Description: This moves OBJECT out of the pocket of the object POCKET, and put it on map square X,Y. It doesn't check to see whether the object can go into the square or not: it just does it.
Input: The object to move, object which has the pocket we are interested in, nd the X,Y of the place to drop it.
Returns: 0 if the operation failed, because the object didn't exist or the destination was outside the map. 1 on success.
Example:
force_from_pocket(current_object,player,100,100);weigh_object
Format: long weigh_object(OBJECT *object);
Description: Returns the total weight of an object, and all within it.
BUG: If you have a bag inside a bag, it will not sum the weight
of the inner bag.
Input: The object to weight, and all objects within it.
Returns: Weight of the object and all who sail in her.
Example:
if( weigh_object(player) > 5000)add_to_partyprintf("Sire! He is weighted down with loot!\n");
Format: long add_to_party(OBJECT *new_member);
Description: Adds a character to the party if possible.
Input: The OBJECT (preferably a character but doesn't have to be), which will be added to the party.
Returns: -1 if the operation failed, (too many in party) or the number of the new guy.
Example:
OBJECT *brick;choose_memberif(add_to_party(brick) < 0 )
print("The brick doesn't want to join because the party is too large\n");
Format: int choose_member(int member);
Description: Makes the party member 'member' take control and become the player.
Input: The number of the party member who will become the player.
Returns: 0 if the member was not in the party or q if the operation succeeded.
Example:
int brick_id;brick_id = add_to_party(brick);
choose_member(brick);
choose_leader
Format: int choose_leader(int member);
Description: Makes the party member 'member' take control of the party. All other members will follow him or her.
Input: The number of the party member who will lead the party.
Returns: 0 if the member was not in the party or 1 if the operation succeeded.
Example:
int brick_id;brick_id = add_to_party(brick);
choose_member(brick);
is_solid
Format: int is_solid(int x; int y);
Description: Checks if the map square at x,y is clear of any obstructions.
Input: The x,y co-ordinates of the map square to examine.
Returns: 1 if there is an obstruction there, 0 if not.
Example:
if( is_solid(100,100))in_pocketprintf("Map square 100,100 is blocked\n");
Format: int in_pocket(OBJECT *obj);
Description: Scans the entire world, looking for this object.
Returns 1 if the object is not where it thinks it is, which normally indicates
the object is inside a container.
in_pocket will take a comparatively long time to do, so perform any
quicker tests first when possible.
Input: The object to check out.
Returns: 1 if the object is inside a container, 0 if it is lying on the ground.
Example:
if( in_pocket(player))line_of_sight (new in 0.041)printf("Holy Gee, this is awful!\n");
Format: int line_of_sight(int xa, int ya, int xb, int yb);
Description: This will draw an imaginary line between the two positions
on the map.
If there is an obstruction, it will return 0. If there is a clear
path between the points, it will return 1.
Input: The two sets of X,Y coordinates, which it will try to find a line-of-sight between.
Returns: 1 if there is a clear line of sight, 0 if there is an obstruction.
Example:
if( line_of_sight(player->x,player->y,enemy->x,enemy->y))move_to_topprintf("Time to die!\n");
Format: void move_to_top(OBJECT *object);
Description: This will move the object to the top of the pile for the
square it is sitting on.
(It actually works by transferring the object to 0,0 and then back
to the previous position, so it is now at the top of the heap).
Input: The object to adjust.
Returns: none.
Example:
move_to_top(player);spill_contents
Format: void spill_contents(OBJECT *object);
Description: Removes all the contents of a container, and puts them in a pile above it.
Input: The object to have its contents spilled.
Returns: none.
Example:
spill_contents(chest);spill_contents_at
Format: void spill_contents_at(OBJECT *object, int x, int y);
Description: Removes all the contents of a container, and puts them in a pile elsewhere.
Input: The object to have its contents spilled, the position where the spillage will occur.
Returns: none.
Example:
spill_contents_at(chest,chest->x,chest->y+1);move_forward (new in 0.05)
Format: int move_forward(OBJECT *object);
Description: Moves the object one step forward in the direction it is facing.
Input: The OBJECT which is to be moved.
Returns: 1 if the move was successful, 0 if it was blocked by an obstruction.
Example:
move_backward (new in 0.05)
move_forward(player);
Format: int move_backward(OBJECT *object);
Description: Moves the object one step backward in the opposite direction to the one it is facing.
Input: The OBJECT which is to be moved.
Returns: 1 if the move was successful, 0 if it was blocked by an obstruction.
Example:
move_backward(player);
turn_l (new in 0.05)
Format: int turn_l(OBJECT *object);
Description: Rotates the object 90 degrees anti-clockwise.
Input: The OBJECT which is to be rotated.
Returns: The direction the object is now facing.
Example:
turn_l(player);
turn_r (new in 0.05)
Format: int turn_r(OBJECT *object);
Description: Rotates the object 90 degrees clockwise.
Input: The OBJECT which is to be rotated.
Returns: The direction the object is now facing.
Example:
turn_r(player);
add_quantity (new in 0.05)
Format: void add_quantity(OBJECT *container, int quantity, STRING type);
Description: Creates a quantity of a single type of object and places
them in another object's pockets.
If the object to be created has its QUANTITY flag set, a single object
will be created and its quantity value set to the specified amount.
If it does not have the QUANTITY flag, then the requested quantity will
be the number of objects created.
Input: The container which will receive these objects, the number of objects to create and the type of object.
Returns: Nothing.
Example:
printf("The pharoah showers you with gold!\n");
add_quantity(player,1000000,"gold_coins");
take_quantity (new in 0.05)
Format: int take_quantity(OBJECT *container, int quantity, STRING type);
Description: Destroys a quantity of a single type of object from another
object's pockets.
If the requested amount is not in the object's pockets it returns 0.
Input: The container which will lose these objects, the number of objects to destroy and the type of object.
Returns: 1 on success, 0 if there wasn't that many objects there.
Example:
if(!take_quantity(player,10000,"gold_coins"))
printf("I'm sorry sir, you can't afford it.\n");
Format: print(STRING text, parameters....);
Description: prints some text on the console. Corresponds to printf in real C.
Input: A string, which may contain control codes, followed by zero or more parameters ..
Control codes:
Control code | Description |
\n | Begin new line. Only \n at the end of the string will work correctly, \n in front will have odd results. |
\\ | A slash, \ (Single slash is used to start a control code, like \n) |
\" | A quote, " (the string is started by quotes. In BASIC you use """ , but in C is is \") |
%d | A decimal number appears at this point. E.g. print("found %d things",100); prints 'found 100 things' |
%c | A character appears at this point. E.g. print("[%c]",'a'); prints '[a]' |
%s | A string appears at this point. |
%% | A percentage, % (single % is used to print a parameter, like %d) |
Returns: nothing.
Example:
STRING str1="cow";Output:
STRING str2="moon";printf("This is a string\n");
printf("%d + %d = %d\n",1,1,2);
printf("The %s jumped over the %s\n",str1,str2);
This is a string
1 + 1 = 2
The cow jumped over the moon
printxy
Format: printxy(int x,int y, STRING text, parameters....);
Description: prints some text directlt on the screen, not to the console. The text will not appear until the next redraw.
Input: Two numbers, the X and Y coordinates where the text will
appear. The TEXT and PARAMETERS are the same format as print, which
is described above.
Returns: nothing.
Example:
printxy(32,32,"Thiswill appear in the game window");clear
Format: clear();
Description: clears all text from the game console..
Input: nothing.
Returns: nothing.
Example:
print("You won't see this\n");play_song
clear();
Format: play_song(STRING song_name);
Description: Plays a song.
Input: The song name. This will be one of the entries in 'SECTION: MUSIC' of the script file.
Returns: nothing.
Example:
play_song("intro");play_sound
Format: play_sound(STRING sound_name);
Description: Plays a sound.
Input: The sound name. This will be one of the entries in 'SECTION: SOUNDS' of the script file.
Returns: nothing.
Example:
play_sound("ouch");stop_song
Format: stop_song();
Description: Dips the volume of the music to 0. Does not stop
the actual playing of the music.
You must call start_song() afterwards.
Input: none.
Returns: nothing.
Example:
stop_song();start_song
Format: start_song();
Description: Resets the volume to it's original level, before stop_song()
was called.
You must have called stop_song() beforehand, or it will have no
effect.
Input: none.
Returns: nothing.
Example:
start_song();get_input
Format: get_input();
Description: Gets a fresh key from the user, and puts it into the system variable, key.
Input: none.
Returns: nothing.
Example:
get_input();get_yn
if (key == KEY_UP)print("You pressed UP\n");
Format: get_yn(STRING question);
Description: Prints a question (followed by 'are you sure?') and waits for the user to press Y or N.
Input: A string containing the question.
Returns: 1 if the user pressed Y, otherwise 0.
Example:
if(get_yn("Commit suicide"))
call_vrm("kill_player");
get_number
Format: get_number(int default);
Description: Prints the number given as a default, and allows the user to edit it.
Input: A number, which is the default if the user just presses Enter.
Returns: The new number, or 0 if the user pressed Escape.
Example:
int num;
printf("Enter a number:\n");
num = get_number(100);
printf("The user typed %d\n",num);
redraw
Format: redraw();
Description: Updates the entire screen display. This happens in the main loop anyway, but if your VRM has taken control, to choose a spell or something, you'll want to do this.
Input: none.
Returns: nothing.
Example:
show_object(100,100,object); // Draw the objectredraw_map
redraw(); // Update the display to make it appear immediately
Format: redraw_map();
Description: Updates the entire screen display, and redraws the map,
recalculating the light levels too.
This happens in the main loop anyway, but if your VRM has taken control,
to choose a spell or something, you'll want to do this.
Input: none.
Returns: nothing.
Example: (Fades the viewport to black)
int ctr;lightning (new in 0.05)
for(ctr=0;ctr<255;ctr++)
{
set_darkness(ctr);
redraw_map();
waitfor(2);
}
Format: lightning(duration);
Description: Flashes the screen blue-white for a number of game ticks. This number is in 35ths of a second and should be at least 2. It will not appear visible until the next update of the screen (e.g.,redraw_map).
Input: Length of the lightning flash in 1/35ths of a second.
Returns: nothing.
Example:
lightning(2);
Format: call_vrm(STRING name);
Description: Calls another VRM, using the name from Section: CODE.
Input: The name of the VRM to call.
Returns: nothing.
Example:
call_vrm("object_vrm");
Format: TILE * get_tile(short x, short y);
Description: Looks at the map square X,Y, and returns the TILE in this position. See 4.2.5 for more info.
Input: The X and Y coordinates of the map square to be investigated.
Returns: A pointer to the tile. Unless the coordinates
were off the map, it will always return something.
Example:
TILE *t;restart
t = get_tile(100,100);
print("The tile at 100,100 is described as.. '%s'\n",t->desc)
Format: restart( );
Description: Reloads the map and sets everything back to it's default state.
Input: None.
Returns: None.
Example:
if(everyone == dead)set_darkness
restart();
Format: set_darkness(int level);
Description: Sets the amount of darkness, 0-255.
Input: Amount of darkness to apply. 0 is daylight, and 255 is total blackness.
Returns: None.
Example:
set_darkness(192); // Make everything quite dark, but not pitch black.random
Format: int rnd(int max_number);
Description: rnd returns a random number from 0 up to the number you
specify as the maximum, -1.
For example, rnd(3) will return either 0,1 or 2.
Input: The maximum number it should return, plus one.
Returns: The random number.
Example:
int t;waitfor
t = rnd(4);
if(t == 0)
print("It was a zero\n");
if(t == 1)
print("It was a one\n");
if(t == 2)
print("It was a two\n");
if(t == 3)
print("It was a three\n");
Format: void waitfor(int time);
Description: waitfor waits for a number of time units, before
execution is resumed.
Each time unit is 1/35 of a second (because IRE uses a 35Hz timebase).
For example, waitfor(35) will delay one second.
It does not stop the animation.
Input: The number of 1/35ths of a second to pause.
Returns: None.
Example:
waitfor(35); // delay one second
wait_for_animation (new in 0.05)
Format: void wait_for_animation(OBJECT *obj);
Description: wait_for_animation waits for an object to finish animating before execution is resumed. It is useful for special effects or plot-critical scenes. It will return immediately if the object has an animation that loops.
Input: The object with the animation to wait on.
Returns: None.
Example:
set_sequence(arch_villain,"arch_villain_dying");
wait_for_animation(arch_villain);
show_roof is a CHAR.
show_roof can be set to either 1 or 0.
If show_roof is 1, the ROOFTOP layer is displayed and you cannot see
inside buildings.
If show_roof is 0, the ROOFTOP layer is not displayed, and you see
the insides of buildings.
storage
storage is an array of LONGs, which you can use to store things.
Mainly they are used to communicate between VRMs.
STORAGE is always available at any point. There are up to 1024
elements in the storage array, and future releases will have more.
storage[0] is the first storage item, and storage[1023] is the last. NEVER use storage[1024] because it does not exist!
objectstore
objectstore is an array of unallocated OBJECTS, which you can use to
store things. Mainly they are used to communicate between VRMs. For
instance, objectstore[0] might point to the player. By using create_object
you can add new objects
in the objectstore. The status areas in the demo work this way.
OBJECTSTORE is always available at any point. There are up to 128 elements in the storage array, and future releases will have more.
objectstore[0] is the first storage item, and objectstore[127] is the
last. NEVER use objectstore[128] because it does not exist!
key
key is the current keypress. When the user presses a key, the
value of the key they have pressed will end up here.
If you need to get a fresh keypress in a VRM, use the function get_input.
Otherwise key will contain the last keypress from the main loop.
See also 4.5, the Keyboard List
current_object, victim
See section 4.2.4
game_minute, game_hour, game_day,game_month, game_year
These allow you to examine and control the current time in the game.
The game system follows earth time, with each turn taking one second,
and so-on.
It differs from the earth calendar in that each month is always
30 days, although this may be customisable in future releases.
Example:
if( key == KEY_UP)Function Keysprint("You pressed UP");
KEY_F1Numeric keyboard keys
KEY_F2 (Used by the system)
KEY_F3 (Used by the system)
KEY_F4
KEY_F5
KEY_F6
KEY_F7
KEY_F8
KEY_F9
KEY_F10 (Used by the system)
KEY_F11
KEY_F12
KEY_ESCMain keyboard section
KEY_1
KEY_2
KEY_3
KEY_4
KEY_5
KEY_6
KEY_7
KEY_8
KEY_9
KEY_0
KEY_TABArrow Keys
KEY_Q
KEY_W
KEY_E
KEY_R
KEY_T
KEY_Y
KEY_U
KEY_I
KEY_O
KEY_P
KEY_ENTER
KEY_A
KEY_S
KEY_D
KEY_F
KEY_G
KEY_H
KEY_J
KEY_K
KEY_L
KEY_Z
KEY_X
KEY_C
KEY_V
KEY_B
KEY_N
KEY_M
KEY_COMMA
KEY_DOT
KEY_SPACE
KEY_UP
KEY_DOWN
KEY_LEFT
KEY_RIGHT
1. The player Talks to an object or a person
2. A VRM routine calls the function talk_to(name,start)
When a conversation takes place, the game will load in the file containing the conversation and process it interactively like a web browser.
Conversations are based on pages. At the top of the page is an
image, normally a portrait of the person you're talking to.
Below this is the text of the conversation, and at the bottom are the
choices you get of what to say.
Each choice is a link to another page, or a link to "exit" which ends
the conversation.
Commands can also be embedded into the page, which can create objects,
remove objects, change flags, and call VRM functions.
You can also use commands to make different things happen depending
on whether a flag is true or false.
More commands will be added in the future as necessary.
Each page has it's own title. When the conversation starts it will look for the page called 'Start', although it may also look for other pages too in future.
The page starts with the command:
[page="start"]
..and continues until the command:
[endpage]
Everything between these two commands will be displayed on the screen, unless it is another command.
The commands you will need to know to make simple conversations are:
[nextpage=""]
[link=""]
[linkto=""]
[image=""]
[colour="#xxxxxx"]
Important tips!
5.2.1 Simple page linking
There are two ways to link pages. [nextpage=""] is the most simple, so I'll explain it first.
Here's an example:
[page="start"]
This is the first page.
Press a key for the second page...
[nextpage="page2"]
[endpage]
[page="page2"]
This is the second page!
Press a key to finish.
[nextpage="exit"]
[endpage]
This will display two lines:
This is the first page.
Press a key for the second page...
When you press a key, the page will change and read two more lines:
This is the second page!
Press a key to finish.
..and when you press a key the conversation will end.
The command [nextpage="page2"] makes the program wait for a key to be pressed, and then it looks for a page titled 'page2' and displays that.
The command [nextpage="exit"] makes the conversation finish when a key is pressed.
5.2.2 Interactive page linking
Now let's look at [link=""] and [linkto=""]
These two commands are used together to provide the choices at the bottom
of the page.
[link=""] displays the message at the bottom, and [linkto=""] is the
page that the link will take you to.
LINK must come first, and LINKTO just afterwards, otherwise it may
fail.
Here's an example:
[page="start"]
You see a shifty-looking man in a trenchcoat.
"Pssst! Wanna buy some stuff?"
[link="What 'stuff' have you got?"]
[linkto="whatstuff"]
[link="No! Get lost!"]
[linkto="getlost"]
[endpage]
[page="whatstuff"]
"The usual contrabands..Mars bars.. M&Ms... Terry's chocolate oranges.."
[link="Not today man, the feds are everywhere"]
[linkto="nottoday"]
[link="You're off your rocker!"]
[linkto="getlost"]
[endpage]
[page="getlost"]
"Suit yerself.."
He walks away in a huff.
[nextpage="exit"]
[endpage]
[page="nottoday"]
"Wo! Thanks for the tip, man."
He looks both ways and slips off into the night.
[nextpage="exit"]
[endpage]
You should be able to work out what that does. If not, put it into a file and try it out.
You can have a maximum of 10 links per page (this will take a lot of screen room!).
5.2.3 Images
The portrait at the top of the screen is set using the [image=""] command.
You must put this as the first command after the [page=""] line.
The word in quotes is the title of a Sprite found in the "Section:
sprites" part of the scriptfile, main.txt.
See chapter 3.2.1 of this document.
Here's an example:
[page="start"]
[image="greengrocer"]
You see a small greengrocer.
"Good day sir, how can I help you?"
:
:
:
[endpage]
You must specify a portait for each page. This allows you to change the character's expression from page to page.
You can also specify a background image if you don't like the blackness.
This is done with the following command:
[backing="filename.pcx"]
The game will not look in the Scriptfile for this image, it will be loaded directly from disk.
This is actually what happens if you press F1 for help in The Flat. It loads a conversation called "help.txt" which is in the FLAT/ directory, and this is what it does:
[page="start"]
[backing="backings/help1.pcx"]
[nextpage="exit"]
[endpage]
This feature is considered experimental.
5.2.4 Setting the text colour
You may wish to change the colour of text in the body of the conversation.
This is done using the [colour=""] command. (You may also use
[color=""] if you prefer)
It works in the same way as HTML, except that it only lasts for the
rest of the line.
The colour is in quotes, and it is specified with a # followed by six
hex values, just like HTML.
The first two set the amount of red in the colour (00-ff), the second
two set the amount of green (00-ff) and the last two the amount of blue
in the colour (00-ff).
You can get little java applets and things to work out the colours,
just look for a good page about web design.
Here are some of the most commonly-used colours:
red: #ff0000
green: #00ff00
blue: #0000ff
pink: #ff00ff
yellow: #ffff00
cyan: #00ffff
orange: #ff8000
grey: #808080
Black would be #000000, but you can't change the background colour yet,
so this would be invisible.
White is #ffffff, but this is the default anyway.
Generally I use medium grey [colour="#808080"] for narration, and leave the rest of the text white.
Returning to the sweet-pusher as an example:
[page="start"]
[colour="#808080"]You see a shifty-looking man in a trenchcoat.
"Pssst! Wanna buy some stuff?"
[link="What 'stuff' have you got?"]
[linkto="whatstuff"]
[link="No! Get lost!"]
[linkto="getlost"]
[endpage]
This is done with flags. A flag is a message that can either be true or false, depending on what has happened previously.
5.3.1 Checking for an object
The simplest case is 'Am I carrying such-and-such an object?' The result will either be true(yes) or false (no).
Here's an example. It's not really a conversation, but anyhow. If you're carrying 'The Death', it says so, otherwise it says you're not carrying it.
[page="start"]
System test: are you carrying that nasty weapon, THE DEATH?
[am_carrying the_death]
[if true]Yes, you are carrying it.
[if_not true]No, you are not carrying it.
[endpage]
Now, how does it work?
[am_carrying the_death]
This looks in the player's pocket for an object named 'the_death'.
If it is in your pocket, it will set the flag 'True' to be true.
The next part is clever.
[if true]Yes, you are carrying it.
[if true] Examines the flag called 'true', and then decides what to do. If 'true' is set true, it prints the text. Otherwise it does nothing at all.
[if_not true]No, you are not carrying it.
This again looks at the flag called 'true'. But it does the opposite thing! If 'true' is NOT true, it prints the text, else it does nothing.
Because both of these are looking for one of the two possible states, ONE of them will be displayed and the other won't.
You can also use [if false] instead of [if_not true].
(For the advanced reader: TRUE and FALSE are separate flags, but they are always set to be opposite.)
5.3.2 Important tips!
[am_carrying mobile_phone]
[if true]"You have played this game for far too long, mortal!"
[if true]"It's time to go to bed..."
[am_carrying large_stereo]
[if true]"This is a library, sir. I'm afraid I must ask you to
leave."
[if true][nextpage="exit"]
[if false]"Welcome to the library. How can I help you?"
[if false][nextpage="howcanihelp"]
In this case, the librarian will ask you to leave and stop talking if you have the ghetto-blaster. If you don't, they will go onto a different page and continue the conversation.
5.3.3 Checking for a party member
Similarly to looking for an object, you will also want to see if a particular person is in your party.
[is_in_party gordon_harris]
[if true]"Ah, any friend of Gordon's is a friend of mine."
[if true][nextpage="page2"]
[if false]"I don't know you, stranger!"
[if false][nextpage="exit"]
5.3.4 Using your own flags
You are not just lumbered with True and False, you can create any number of flags you like, up to 8192.
The commands you use to create flags are SET and CLEAR, which make the flag be true or false, depending on which one you used. (Set makes a flag true, clear makes it false).
The flags are automatically created as you try to use them. If you try to set or clear a flag which doesn't exist yet, it is created there and then. If you try to test a flag which doesn't exist , it is assumed to be false.
For example:
[if_not already_met]"Hello, I'm Gordon Harris."
"How can I help you?"
[set already_met]
The first time you have this conversation, he says "Hello, I'm Gordon
Harris", because the flag already_met is false.
Then it prints "How can I help you?" which always appears.
Finally it sets the flag 'already_met' to be True, so the introduction
will not be shown again, unless you do [clear already_met].
5.3.5 Personal Flags
The flags described above are fine for many circumstances, but they
are 'global', that is, all the characters see the flag the same.
Clearly this is not good for the above example, since by meeting Gordon
Harris, you would also have 'met' all the other characters in the game.
Once solution would be to have lots and lots of flags, for example 'met_gordon_harris' and 'met_kevin_parrot' etc, but this would be untidy.
Instead, there are 32 numbered flags, which are specific to the current
person you're talking to.
These are called 'Personal Flags', or p-flags for short.
As I mentioned, the p-flags do not have names, they are numbered from
0 to 31.
If you need to keep track of each p-flag number, you can write a memo
at the top of the file, before the first [page=""] line.
They have their own special [if] commands:
[if_pflag n] (or [if_personal_flag
n])
[if_not_pflag n] (or [if_not_personal_flag n])
[set_pflag n] (or [set_personal_flag
n])
[clear_pflag n] (or [clear_personal_flag n])
Here's an example:
[if_not_pflag 0]"Hello, I'm Gordon Harris."
"How can I help you?"
[set_pflag 0]
This time, it uses the personal flag specific to Gordon Harris.
In fact, if you had more than one copy of Gordon Harris in the game, you
would still be able to meet both of them individually.
This is the most neat part of the conversation system.
By manipulating the environment , you will be able to do really neat stuff, like buying and selling, creating and destroying objects, and by calling a VRM function, absolutely anything else.
5.4.1 Calling VRM functions
There are two ways to call VRM functions from a conversation.
1. [callvrm="function"]
2. [on_exit_callvrm="function"]
[callvrm=]
This calls the VRM function immediately. You should not call redraw() in the VRM function you are using, or the display will become corrupted.
VRM functions can interact with the conversation too, by setting flags
(such as True and False) and p-flags.
This is a way to get information about the game state if there isn't
a command to do that in the conversation.
You can also use it to move objects around, or open doors by talking
to an intercom.
[on_exit_callvrm=]
This calls the VRM as soon as the conversation ends.
This should be used when the VRM will redraw the screen, or you are
doing something drastic such as killing the player.
When the VRM is called, current_object will be set to the character you're talking to.
For example:
[page="start"]
"Hello."
[link="You're a b*st*rd!"]
[linkto="bstard"]
[endpage]
[page="bstard"]
[if_not_pflag 0]"Never say that to me again!"
[if_not_pflag 0][nextpage="exit"]
[if_pflag 0]"Now you die!"
[if_pflag 0][on_exit_callvrm="killplayer"]
[if_pflag 0][nextpage="exit"]
[set_pflag 0]
[endpage]
If you insult this guy twice, he kills you, by calling the VRM function 'killplayer'.
5.4.2 Creating and destroying objects
You can create objects directly in the player's pockets.
This has several uses, besides the obvious one in Ultima 6, where the
King gives you a key when you talk to him.
It can also be used for trading, by creating the money in the player's
backpack and destroying the object you sold, or vice-versa.
At present [create] does not check to see whether there is room in your
backpack to carry the object.
However [destroy] (or [remove]) does check to see whether the object
is
in your backpack, so that the angry trader can poke you in the eye if you
try to sell something you don't have.
This check is performed of course, by setting the global flags TRUE and FALSE to the appropriate value afterwards.
You also specify the amount of objects you want to create or destroy. In some cases this will be ignored, if the object is indivisible, but for other cases such as money, it will add or remove various quantities of that object from your backpack.
If you want to take away an amount of something, it will return FALSE if you don't have that much, to prevent you from being able to short-change the trader.
Here's an example, selling a TV set:
[destroy 1 tv]
[if false]"What are you trying to pull?"
[if true][create 1000 gold_coins]
[if true]"Done!"
[nextpage="start"]
Here's another, buying a TV set:
[destroy 2000 gold_coins]
[if false]"You can't afford it!"
[if true]"Thankyou, sir!"
[if true][create 1 tv]
[nextpage="start"]
5.4.3 The theory of the Conservation of Money
Now that example was very crude. The money was actually destroyed and the object was created on-demand.
This is what Ultima 6 and Ultima 7 do, but you might prefer it if the money and goods actually change hands.
This would mean that you could actually kill the trader after taking the money and get the TV back afterwards, but you would also have to make sure the trader is stuffed with cash, or he won't be able to afford the TV when you try to sell it!
If you prefer to work this way, instead of using CREATE and DESTROY,
use GIVE and TAKE.
But don't blame me if the King gives the player the only copy of the
key to the castle and the player loses it..
[take n objects]
This takes the specified object (or an amount of them)from the player's backpack and transfers it into the backpack of the character you're talking to. No loss!
Similarly,
[give n objects]
..will take the specified object(s) from the backpack of the character
you're talking to, and transfer them to the player's backpack.
As an example, here's the buying and selling the TV again, but with the money and the TV being moved around instead of created and destroyed.
[take 1 tv]
[if false]"What are you trying to pull?"
[if true][give 1000 gold_coins]
[if true]"Done!"
[nextpage="start"]
Here's another, buying a TV set:
[take 2000 gold_coins]
[if false]"You can't afford it!"
[if true]"Thankyou, sir!"
[if true][give 1 tv]
[nextpage="start"]
Neither of these examples take into account whether the trader has the
money or the TV.
This is more complex, since GIVE will change the state of TRUE and
FALSE, so we'll need to use a temporary flag.
Here's the finished version..
[clear temp]
[take 1 tv]
[if false]"What are you trying to pull?"
[if false][nextpage="exit"]
[if true][set temp]
[if temp][give 1000 gold_coins]
[if temp][if true]"Done!"
[if temp][if false]"I'm sorry sir, I seem to have exceeded my budget
for acquisitions."
[if temp][if false][give 1 tv]
[nextpage="start"]
[clear temp]
[take 2000 gold_coins]
[if false]"You can't afford it!"
[if true][set temp]
[if temp][give 1 tv]
[if temp][if true]"Thankyou, sir!"
[if temp][if false]"I'm sorry sir, we're out of stock."
[if temp][if false][give 2000 gold_coins]
[nextpage="start"]
MYGAME.RAR
MYGAME.GAM
The .RAR file will contain the resources, all the sound, graphics and
level data.
The .GAM file is a text file containing the descriptions needed to
make the .RAR file work.
Typically it will look like this:
#
# Generic Description file
#
-file mygame.rar
-resdir mygame
-mapfile level1
-console_x 16
-console_y 320
-console_w 75
-console_h 17
'-file mygame.rar'
This is the name of the .RAR file where all the resources are kept.
'-resdir mygame'
This is the name of the directory inside the RAR file, where all the
resources can be found.
I used RES for my general experiments, and FLAT for The Flat.
'-mapfile level1'
This is the world file which the game will try to load. It will
look for level1.MAP, level1.MZ1 and level1.MZ2.
'-console_x' specifies the X position of the console.
'-console_y' specifies the Y position of the console.
'-console_w' specifies the width of the console in CHARACTERS.
Not in pixels.
'-console_h' specifies the height of the console in LINES. Not
in pixels.
There are three types of LOG:
'-log full'
This is the default. It runs in text mode, and displays full
diagnostic information.
'-log partial PICTURE.PCX'
This will switch to graphics mode early on, and display the .PCX picture,
with full diagnostic information superimposed.
'-log none PICTURE.PCX'
This will switch to graphics mode, and display the picture, but it
will not show any diagnostic information as the game loads.
If you use '-log partial', you will want to specify where the information
appears and how much there is.
This is done using '-logxy'
'-logxy Xposition Yposition Lines'
This consists of three numbers on the same line.
First, the X-coordinate where the text will appear.
Secondly, the Y coordinate where the text will appear.
Finally, the number of lines of text that will be displayed.
It is assumed that the width will always be around 60 columns.
For example:
-log partial mypic.pcx
-logxy 0 380 10
Will display the picture mypic.pcx, and display 10 lines of text starting at 0,380
Online References:
About IRE:
IT-HE Homepage:
http://members.tripod.com/~JPMorris
PICTVIEW, which can convert to and from .CEL files:
http://pascal.fjfi.cvut.cz/~patera
Contact Info:
If you have any questions at all about IRE or VRM programming, feel free to email me...
DOUG-15@bigfoot.com
b52g@usa.net
If you didn't get an answer for a few days, try this instead....
End of Document