Bad animated object

My interpreter is giving me a Bad anim.obj(x) error message every time I enter a particular room.  I've tried initializing the animation inside the if(new_room) { ... } scope as well as outside, yielding the same result.  No other animations have yielded this error message more than once or twice.  I'm initializing exactly as it is shown in the help file.  The object is defined in the object editor, and I'm using the correct object code (o19).  The view is defined.  All I want is an animation of a spinning eye ball, and yet, I am denied!!


sonneveld Can you paste the code that you used to animate this object?

If you're setting the loop or cel, make sure that it exists in the view resource.

- Nick
Andrew Baker // ****************************************************************************
// Logic 81: Talking with Baron Samedi
// ****************************************************************************

#include "defines.txt"

if (new_room) {

 // The next 6 lines need only be in the first room of the game
 /*if ((prev_room_no == 1 ||    // just come from intro screen
     prev_room_no == 0)) {    // or just started game

// Check what room the player came from and position them on the
// screen accordingly here, e.g:
// if (prev_room_no == 5) {
//   position(ego,12,140);
// }
 animate.obj(o19); // <----I tried animating it here (in the new_room scope)


/*animate.obj(o19);//<-----I also tried initializing it here and left it as a comment field

if (said("look")) {
 print("The Baron looms tall above you.");

if (ego_edge_code == bottom_edge) {     // ego touching left edge of screen;


That's all of it.  I just double-checked, and the correct view resource is present and accounted-for.
sonneveld doI think I know what the problem is now.  AGI Studio supplies an object file with the template game.  The object file, for some strange reason, also defines the maximum number of animated objects.  I can't remember what the number is for the template game, but I think it's 16 (off the top of my head).

AGI Studio doesn't let you change this unfortunately!  but if you want to delve into a hex editor, I'll tell you which byte to change:

byte 2 - change to 20 (0-19 is twenty objects).  this is 0x14 in Hex.

If you need help on how to do this, I'll try and knock up a program to do it for you.  This is definately something to add to AGI Studio (Nailhead?)

Update: sorry, this is wrong.. the object file is encrypted as well.  .. you'll have to XOR the number with 0x69 (this is character 'i').  

- Nick
sonneveld If you want to make the number bigger than that.. that's fine.  Gold Rush had a large number.  But it will take up important heap space which means you won't have as much room for loading other resources.   Don't worry about performace, I think today's computers can handle it. :)

Do you need 20 animated objects at a time?

- Nick
Andrew Baker I feel like I'm missing something.  I don't need 16+ animations on the screen at once, just in the whole game.  Can I reinitialize animated objects with different views if they are in different rooms?
sonneveld The point I was making was that, in the tutorial game, you can only have 16 animated objects - o0 to o15.  So you might as well reuse them whenever you change into a new room.  The ego HAS to be o0 but it doesn't matter if another character uses o4 in one room and o5 in another (unless you've got another logic code that you're calling that refers to a certain object number)

- Nick
Andrew Baker Well, that certainly clears up a lot of confusion.  Now, I can fix all the bugs in VG:QotD...  but give me a week or two, I've worked non-stop on that game for two weeks.
Andrew Baker Okay, I went back and changed all the anim.obj numbers so they were less than 16.  Now all my anim.obj's work just fine.  Of course, now that I know how to do this, I'm going to have to do a complete rewrite of Voodoo Girl.
AGI1122 Hey Nick what is the maximum number of animated objs that AGI can have on the screen at once? Maybe you could send me that hex utility and I could make my templates object file support more on screen animated objects. I don't beleive I would set it to the max but maybe to about 20 or so objects.