An Introduction to
Debug_Objects Mode in The Sims
for PC/Windows computers

Hacked objects are bound to have some coding errors. In worst case scenarios the game crashes or may lock up so badly that files are corrupted. Even minor errors end up using extra resources, causing the game to run slower, perhaps to the point the game isn't playable on lower end machines. Other "minor" errors can reset the sim or the lot disrupting gameplay. Badness all 'round

To avoid this you must test your objects thoroughly and this is done by testing your objects while the game is running in "Debug Mode." Debug mode was designed as a troubleshooting tool and will help you pinpoint errors in your code, saving you searching blindly and helping you to produce error free objects. Good stuff.

STARTING THE GAME IN DEBUG MODE

If you already have a desktop shortcut to the sims you can right click that and choose Properties from the menu that appears. Just under the icon you'll see a section that includes "Target Type", "Target Location" and simply "Target". That last is the file path for your sims game. Scroll to the end of that path and then, AFTER the closing quotation mark add a space and the command -debug_objects

  C:\Program Files\Maxis\The Sims\Sims.exe" -debug_objects

An optional command you might wish to include is to state a resolution size for the game to play in:

  C:\Program Files\Maxis\The Sims\Sims.exe" -r1024x768 -debug_objects

or -r800x600 if you are using the lower resolution.

PLAYING THE GAME IN DEBUG MODE

Debug mode will prompt a message whenever it encounters an error. It is a simple popup window called a dialog box ... the same sort you see in game play all of the time. This one has three buttons.

Cancel - This is meant to continue with the error I believe but to date I have never gotten it to do anything but lock my game up. I hear using the "prepare_lot" cheat will usually fix that right up but have not tried it. Instead I opt to avoid it at all cost but do feel free to experiment some on your own to see what circumstances it'll work under.

Reset - Attempts to recover from the error (usually with a great deal of success) and generates an error report for you. This report is a simple text file that is placed in the same directory as your Sims.exe file. The file name (which it tells you at the time) looks like a bunch of garble but it's chock full of info about when and where the error occurred.

Delete - Deletes what the game perceives as the offending object from the lot. There are times when an error is in the middle of a looping BHAV and you end up unable to do anything because the error message pops right back up again. Deleting the object generating the error helps out tremendously. The downside is that objects "push" actions onto each other so the object listed in the error message may not be the one with the 'wonky' coding. You'll find, in fact, the Sim trying to use the object is often sited as the offending object.

DECIPHERING YOUR OBJECT ERROR MESSAGE

The Object Error Message looks horrendous and confusing at first glance but if we break it into sections you'll find it's pretty straight forward. For the most part you'll not need to look below the first part of the first section. Here's an example of it:.

    An error occurred in object "user00000 - Bob" #105,
    Too many iterations.
    Build: Sep 25 2003, 14:23:46
    Object id: 105 name: user00000 - Bob
    Stack size: 8
    Error: Too many iterations.
    Iterations: 196150
    Frame 7:
    Stack Object id: 248
    Node: 1
    Tree: id 321 name 'Is lot a Residential Lot?' version 4
    from .\gamedata\global\global
    Prim state: 0
    Params: Locals: 87

The first "Frame" listed is always the frame the error took place in.

The "Node" means line within the BHAV that returned the error. The phrase is a little odd until we remember that the folks at Maxis use flowcharts instead of line coding.

The "Tree: id" is which BHAV you'll need to look in.

    An error occurred in object "user00000 - Bob" #105,
    Too many iterations.
    Build: Sep 25 2003, 14:23:46
    Object id: 105 name: user00000 - Bob
    Stack size: 8
    Error: Too many iterations.
    Iterations: 196150
    Frame 7:
    Stack Object id: 248
    Node: 1
    Tree: id 321 name 'Is lot a Residential Lot?' version 4
    from .\gamedata\global\global
    Prim state: 0
    Params: Locals: 87

The "Object id" is the "offending object" but it may not be the one that really has the error because an object can push an interaction onto another object (like a sim) or be accessing a BHAV from another object (like a global). One can usually look for that info in the "from" line but as this example shows that may not tell us which object actually has the code that needs fixing.

The sure way of telling which object has the code that needs fixing is the Stack Object id: ### (248 in this example). If you scroll waaay down you'll spot a list of all of the objects on the lot (more than just the ones you can see but this is certainly one tool that can be used to compile a shopping list) and you'll find the object listed at that number:

    247 = rvn - Dance Tile - on/off White
    248 = Television - Expensive - Left
    250 = Television - Expensive - Right
    251 = Gift - Inventory - Gargoyle

The Error type itself tends to be a little on the generic side but as you work with them you begin to figure out what is the most likely cause that type of error. In this particular case I have "too many iterations". I have, from experience, learned that this usually means I have a loop going on where it should not be. I'll have line one go to line two, then accidentally have line two go to line 2. Or line one. Or something like that. It loops around a bunch of times trying to find a way out and then freaks out and we have an error.

    An error occurred in object "user00000 - Bob" #105,
    Too many iterations.
    Build: Sep 25 2003, 14:23:46
    Object id: 105 name: user00000 - Bob
    Stack size: 8
    Error: Too many iterations.
    Iterations: 196150
    Frame 7:
    Stack Object id: 248
    Node: 1
    Tree: id 321 name 'Is lot a Residential Lot?' version 4
    from .\gamedata\global\global
    Prim state: 0
    Params: Locals: 87

Our screenshot earlier mentioned an "undefined transition" There are a few causes for that. One example would be when line 2 tried to go to line 33 when there is no line 33. This error also shows up when a BHAV is looking for a global line that does not exist, a common problem caused by expansion packs altering objects.

Example: cash registers cloned after Vacation is installed look to see if they are on a vacation lot using Global BHAV 324. But anyone with Hotdate alone will only have up to Global BHAV 320 and so the cash registers don't work for them.

Until we are familiar with the various types of error we will be using debug mode to pinpoint WHERE the error is and trying to figure out WHAT the error is on our own.

Author: Raeven