Straange inv obj bug...

happyturk Having some strange problems with inventory objects.

Where to start...

I only have six at the moment, still in the beginning stages. But when I'm in debug, it refuses to recognize any objects other than 0 and 1 as being valid. That's not -really- the problem, but I thought it bore mentioning.

Object i5 is in the objects file as being in room 29. In room 29, the code doesn't recognize it as being there, so I manually stuck it there myself in the initialization of the game. That seemed to work as far as the game 'seeing' it, but then when I added 'get' code to be able to pick it up, my inventory changes from objects 0 and 4 NOT to 0, 4, and 5, but to 0, 4, and -3-, and the names for 3 and 4 are both truncated inexplicably.

The get code's about as simple as it can be, basic stuff really, so much so that I'm embarassed to be having trouble with this:

if (said("get","chisel")) {
 if (obj.in.box(o0,63,132,80,143)) {
   print("You pull the chisel free from where it was lodged in the pipe.");
   erase(o7);
   get(i5);
   }
 else {
   print("You're not close enough.");
   }
 }

I tried substituting

   v230=255;
   put(i5,v230);

for get(i5); just to see what would happen, that didn't work either.

I thought maybe the names were too long, so I tried to shorten the names of some of the inv. objects, but then the game froze when trying to load my save file to get past the bloody long intro. -_o Which... I'm not sure if that's supposed to happen, but ah well.

If anyone's encountered any similar problems, insight would be very much appreciated, thankye.

~happyturk
AGI1122 Well there is supposed to be a set ammount of inventory objects in the defines.txt file. Chances are you haven't set it any higher to recoginze the new objects in the debug mode.

As for the other thing I am not sure if I understand what you are saying. ???
happyturk What I meant, but had trouble expressing because I'm not very good with words... c_c Bleh. Is that If, say, my objects are

0 Blarfle
1 Snazzaraz
2 Whatchado
3 Tizzery
4 Doohickey
5 Tennis Shoe

In the room in question, I already have Blarfle and Doohickey, and when I implement get(i5) by typing 'get tennis shoe', and then pull up my inventory list, It lists:

larfle
zery
Doohickey

So it's accessing the wrong inv object, and it's cutting off the first half of the names. -_o

But it may be a bug related to what you just said, so I'll try that and see if it fixes it.
AGI1122 Well if it's cutting off the first part of the words that sounds kind of weird I have never heard of that one before. What OS, system and all that other stuff are you using? I would try your game with NAGI and see if the problem persists in NAGI as well.
sonneveld The inventory code for NAGI and AGI are the same.  Early versions of Sarien had problems with inventory but they're fixed in the latest version.. I don't know if you'd have to get it in CVS or .70.. I'd try cvs first.

I'm not sure what the invent status with AGIL is.

- Nick
AGI1122 What I was talking about had nothing to do with the invent code but rather I thought it might be a problem with the displaying of the words. He said that the beginning of the words was cut off. I remember something sort of like this before and that it only did it in the original interpreter on newer computer while NAGI would show the words without messing them up.

As for the other problem he mentioned about it "accessing the wrong inv obj" I am not sure about that one.
Andrew_Baker I had inventory corruption problems when I used get() with an argument for an inventory object that hadn't been defined in the object editor.
sonneveld are you using save games AFTER you change the object file?  If so, you'll have to keep in mind that the savegame data actually stores a copy of the object file.. so when the game loads up, it will try to copy the old object file from the save game onto the new one.

You shouldn't use save games if you change any of the game, because things like objects, scripts and animated objects may differ and you'll get confusion all around.

- Nick
happyturk Using WinXP. AGIStudio v 1.33. Standard Sierra interpreter, not sure what version.

What I meant by 'wrong object' was that it was adding the partial name of object -three- to my inventory list instead of object -five- as I was instructing it to.

Which is weird, yes.

And the save game is at the very beginning, just to get past the intro; nothing ever changes in the room it loads in or before in the intro, so it's safe aside from this one issue.

And... after fiddling for a bit, I finally changed the names of the inv objects to make them shorter and just sat through the blasted intro, that seemed to clear up the problem, everything's working fine now. Not sure -why- name length would have been an issue since I've seen inv objects in other games with longer names, but whatever works, I guess.

Thanks for all've your help! ^_^
sonneveld umm... even if you save the game right at the start..  y'see.. when the interpreter loads the object file, it also sets some pointers, pointing to the name strings.  But it only does that on startup.. because it assumes that the loaded save games have the exact object file format.

so the process for differing object files occurs like this:

1) run game, game loads object file 1... sets pointers for object file 1.

2) save game

savegame = object file 1

3) edit object file in agi studio

4) run game, game loads new object file *2*... sets pointers for object file 2.

3) restore game
savegame = object file 1!!

4) restore game copies data from object file 1 over object file 2.  The pointers are still expecting object file 2 though.. so the pointers aren't pointing in the right place and strange stuff will occur.

so once you change the object file, you will have to scrap all your save games and start again.. sorry.

- Nick
happyturk ...right. I know. That's what I did. Threw out the old save and started it from scratch again. I knew that was the problem with the saves, I was just hoping to find a way to fix it short of altering the object file, which there wasn't, so I did. o_o

Sorry for the confusion.
sonneveld the agi save format is fairly inflexible when it comes to changes in the game data.  I wonder if sierra had a development version that contained more data.

One day, I'm hoping to write some code for NAGI which will support a more flexible format.. hopefully something compatible between AGIL and Sarien.. no time atm though.  NAGI has the same inflexible format as AGI.. so it's a pain because I don't want to make certain changes which will break the save format again.

- Nick