agidev.com
 Home | Intro | News | Games | Community | NAGI |  Articles  | Download | Links

Articles

AGI Error Code Tutorial v1.0

by Nick Sonneveld
Last updated 9th March, 2002

Page: 1 2 [ 3 ] 4 5 6

3. Interpreter Errors

The interpreter errors can be separated into two main categories: destructive and warnings.  Destructive errors are pretty bad.  If you get one, it usually means that the memory has been so screwed up that the interpreter can't even risk trying to load error messages from logic code.  There are a few warnings in here too so don't worry.  Warnings are errors that the interpreter has detected, but it can still keep on going.  The text in brackets is where the error occurs in the interpreter.  There's no specific order for interpreter errors, so I've grouped them into the obvious areas.

Memory:
"Sorry, your computer does not have enough memory to play this game. 256K of RAM is required." (memory init) (destructive)
The interpeter was unable to allocate a reasonably sized heap for your game.  This message probably doesn't mean much to people these days, but if you get it, you might want to try disabling some TSR's in your config/autoexec files or check the windows settings for dos.  This error can occur before the interpreter loads your game, so there no way the data in your game could cause this error.  Sierra realises you may have paid money for a game that doesn't work on your computer, that's why they apologised.
"No memory.  Want XXX, have XXX" (malloc) (destructive)
The game logic has tried to load a resource, and but the interpreter has run out of allocated memory.  This is an error actually caused by your game, the interpreter couldn't cause it unless it was something you did in your logic code.  If you're running a long sequence, and you're unable to call new.room, then perhaps you should try discarding resources as soon as you're done with then.  If you're still running out of room, try bundling view resources together and try and get some to mirror others.  Converted sounds take up a lot of room, so you might want to crop it.  Later games by Sierra actually checked the amount of available memory before it tried something memory intensive (like read a bible with lots of scripts), that way the player could still walk around without it crashing.
"Stack blown." (system timer) (destructive)
The interpreter has run out of stack memory.  The stack is used to push on any data on the currently running function before calling, parameters for sending to functions, and for the picture fill code.  The picture fill code, if you're filling around a very "rough" graphic, will use the stack like popcorn.  The stack filling code, while not very efficient with the memory, is very quick calculation-wise.

All the interpreters for the PC allocate the exact same amount for the stack but some people see the "stack blown" error more often than some people.  The reason for this are TSR's that stay in memory (or Windows) and call themselves at arbitary times.  Whenever they take over, they store the program's position in the stack, and they probably use the stack themselves before cleaning up.  Because all these programs are using the same stack that the interpreter created, the poor thing may get too big and over flow into other parts of the game.  That's when the error is thrown.

The best way to get past these errors is to change your stack-heavy pictures.  There's a small tutorial on this site on that very subject.  It also mentions how to patch the interpreter to increase the stack.  See "AGI Stack Overflow Information".
"Not now." (show object) (warning)
The interpreter was about to display an object on the screen but has discovered that there wouldn't be any memory for it.  There's a function called "show.obj" which will display a view resource along with the view's description.  It's used for displaying objects from the inventory.  It also checks the available memory to make sure that there's enough room to display the picture.  If you need to display it, try discarding some unused resources, or removing some animated objects from the screen.

File:
"Can't find HGC_Font file." (memory init) (destructive)
The interpreter has tried to set aside memory for the Hercules Graphics Card and has discovered that it can't find the Font description file anyway.  Make sure you've got this file in the same directory as your interpreter.  Some people don't package it because most people don't use the HGC these days.  A font file from another version *should* work.
"The directory <directory> is full or the disk is write-protected." (save) (warning)
"The disk is full." (save) (warning)
The save game function has tried to write your save game but came up against an error.  The interpreter can only assumed that since it wasn't a serious error, it must have been a full disk or it's write-protected.
"Sorry, this disk is full.  Position pointer and press ENTER to overwrite a saved game or press ESC and try again with another disk" (save/restore) (warning)
This is the same as the previous error, except the save functions managed to make a quick check to see if it's possible to write another save game.  Fortunately, the interpreter gives you a chance to write over an old save.
"Can't open file: <filename> Error in restoring game. Press ENTER to quit." (restore) (destructive)
In the process of restoring a game, the interpreter encountered an error.  Because it was in the middle of copying the contents of the save game all over the game's memory, the memory now contains half the current running game and half the game that was in the save game. I hope that made sense.  Anyway, the interpreter can't run under those sort of conditions so you're forced to quit.  It may be a bad disk, corrupted save game, or something else that made the restore process break.
"Can't find <filename>." (file load) (destructive)
The interpreter has tried to load an essential file and has discovered that it doesn't exist!  This function is called to open the following files: words.tok, object, logdir, viewdir, picdir and snddir.  Since the interpreter assumes these files to be in the same directory, it fails and quits.  Make sure you have all these files available before you try and run the interpreter.  All the directory files are essential, even if you don't have any sound resources, or any picture resources.
"Disk error: <error string>" (print error code) (destructive)
A disk error was encountered when trying to read/write a file.  A disk error is more serious than simply running out of space or finding that a file doesn't exist.  This is for the "sector stuffed" type errors.  You might want to check your hardrive or floppy disk for errors if you encounter this error.  This error is called whenever an error occurs with fileload, opening volume files or accessing a resource in a volume.
"<logic/picture/view/sound> <res num> not found" (dir error) (destructive)
The game's logic code has tried to access a resource that does not exist within the volume files.  The directory files stored a list of all the resources and their position within the volume files.  If the interpreter wants to access a resource, it will check the directory files first.  If you get this error, check your logic code and make sure you're not trying to load the wrong resource.  If it's correct, make sure you actually have the resource within the volume files.  You should not get the error if both of these things are correct.

Other:
"Message too verbose: <string>... Press ESC to continue." (message box draw) (warning)
You have tried to print a message on the screen that was too long and would not fit onto the screen.  The function actually displays the first 20 characters for you to identify the message.  Try and separate the message into several messages, or try not to include too many strings.

Page: 1 2 [ 3 ] 4 5 6