Combining Objects.

Started by renn_inoue, Tue 12/08/2003 17:38:07

Previous topic - Next topic

renn_inoue

I'm having some trouble combining 2 objects in the inventory interactions menu.   According to the manual, you should be able to use a conditional to combine the items.  Here's what I scripted:

// script for inventory7: Use inventory on this item
if (character[GetPlayerCharacter()].activeinv == 10) {
DisplayMessage(506);
LoseInventory(10);
LoseInventory(7);
AddInventory(8);
}
else if (character[GetPlayerCharacter()].activeinv != 10) {
DisplayMessage(507);
}

But it doesn't recognize the item numbers in the inventory window.  When I try using item 10 to combine, it gives me the != message.  And sometimes it will only combine the item with another wrong item.  For example, item 10 won't combine as it should, but item 9 will.  

Am I doing something wrong?  The items numbers are listed correctly in the inventory items menu in ags.

Archangel (aka SoupDragon)

Are you sure you're using inventory 10 on 7 and not 7 on 10?

renn_inoue

Yup, I've double checked it twice.  10 on 7.  But even if it was reversed, 7 on 10, I have this script under the inventory 10 interactions menu:

// script for inventory10: Use inventory on this item
if (character[GetPlayerCharacter()].activeinv == 7) {
DisplayMessage(506);
LoseInventory(10);
LoseInventory(7);
AddInventory(8);
}
else if (character[GetPlayerCharacter()].activeinv != 7) {
DisplayMessage(507);
}

Clicking on one or the other, they still don't recognize their numbers.   However, after testing it recently, I can't get any inventory item to work now.  At least before, by some fluke, it combined with some other inventory.  Now that doesn't work either.  It's like suddenly there is no number 10 or 7 recognized.  It treats as if it wasn't a 10 or 7.

Ginny

Hmm, check that you're using the interaction "Use inventory on this item"..
That's all I can think of.
Try Not to Breathe - coming sooner or later!

We may have years, we may have hours, but sooner or later, we push up flowers. - Membrillo, Grim Fandango coroner

Archangel (aka SoupDragon)

#4
Before your if() statement, put this code:

Display("%d",player.activeinv);

Then you'll be able to tell why the interaction isn't being triggered.

renn_inoue

#5
Quote from: Archangel on Tue 12/08/2003 20:19:11
Before your if() statement, put this code:

Display("%d",player.activeinv);

Then you'll be able to tell why the interaction isn't being triggered.

Any item I try displays the number -1.  Odd.

EDIT: It only displays -1 when I start the game with those objects in inventory.  When I run through the run to the point where the items are aquired without the objects in inventory, the number is 6 for the item that should be 10.

Archangel (aka SoupDragon)

Seems like there's a weird bug somewhere else in your script that's screwing that particular event handler up

renn_inoue

#7
 :P

I was afraid you'd say that.  At least the inventory interaction code itself is okay, though.  Now I just have to track the bug.  Thanks for the help everyone.

EDIT: I couldn't find the bug.  The only script lines in my code that have anything to do with inventory number values are the:

character[GetPlayerCharacter()].activeinv == x  //x is some value

Since this line only retrieves the value to compare and doesn't change it, I'm gonna assume something in my computer screwed the ags inventory system up and I'll just have to live without combining items. :P  Kinda sucks cause now I have to rewrite a lot of combination parts to lay down items as objects before they can be acted on.  If I ever put my game up I'll have to put a little note that says you can't combine items.  Or maybe I'll just leave it offline. :P  It's inferior as it is.  Having people wonder why they can't combine logical items is just going to frustrate people more.

If anyone comes across a simliar problem and solution, do let me know!  Thanks! :)


renn_inoue

I'm sorry to bother again, but I've discovered an interesting new development with my bug.  

When I use the default Inventory window:
InventoryScreen();

is when I get all my inventory items starting out at -1.  

When I use the Custom Inventory window, the numbers get their correct values and everything works fine.   But I kinda like the default window setup better.  

I can use the Custom Inventory window if that's all I can use, but if anyone now has an idea about why the default is tripping, let me know.  Maybe I've got an settings option switched on that isn't supposed to be?

Again, if nobody knows or still thinks its a script bug (which I still don't see how it could be with my simple scripts), that's okay because now at least I don't have to rewrite a bunch of parts of my code to work around non-combination items.  

Again, sorry to be a pest.  I know there are other, more serious problems people are having.

Ginny

Hmm, make sure that you haven't checked the "Handle inventory clicks in script" by accident, though I don't see why it would cause this problem.
Anyway, if you like the normal inventory just make the custom one identical to it :).
Try Not to Breathe - coming sooner or later!

We may have years, we may have hours, but sooner or later, we push up flowers. - Membrillo, Grim Fandango coroner

renn_inoue

Handle inventory clicks in script is unchecked so that can't be it.  

You are right, though, GinnyW.  Now that I have a solution to my problem, I should just go ahead and design my own inventory GUI.  It's just... GUI design looks scary.  :-[

*gets beaten with a MOD stick*  Yeah, yeah, mods.  I know there are plenty of GUI tutorials.  But most have broken image links.  I'm waiting for one with pretty pictures. ;)  The manual tutorial with pictures has spoiled me. ;D

Ginny

#11
hehe, lol.
Since you won't need to write any script, I think it'll be easy, just create a new GUI, give it all the properties the original inventory GUI has, add inventory window and buttons and do the same with the properties.
Thst should do it I think, except for a few things in the script you might need to alter. :)

Hmm, you know what, I dunno if this'll work, but try exporting the normal GUI then importing it again, and name it INVENTORY, renaming the normal one to GUI or something like that.
Then in the global script just specify the number for the imported version, and this might solve the problem :)
Try Not to Breathe - coming sooner or later!

We may have years, we may have hours, but sooner or later, we push up flowers. - Membrillo, Grim Fandango coroner

SMF spam blocked by CleanTalk