Author Topic: Help me perfect my multi-inventory system!  (Read 1560 times)

Rui 'Trovatore' Pires

  • Lunge da lei per me non v'ha diletto!
    • I can help with AGS tutoring
    • I can help with play testing
    • I can help with proof reading
    • I can help with scripting
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
Help me perfect my multi-inventory system!
« on: 05 Apr 2004, 18:53 »
OK - I've got a problem. It's code-related, but I can't just copy/paste the code here, 'cause the problem may be caused by something else, and besides, it relies a lot on the context, so I've uploaded a template. Kindly download it and help me...

So I got three inventory "places", right? 1, 2 and 3 (in the game they'll represent containers). Now, I can switch through them and carry items between them, and I can even drop them in the room...

!!!BUT!!!

After messing with them awhile, I found out that they always ended up in the same order - first the oil can, then the broom, and then the lamp. Incidentally, that's their INV number - oil can is item #1, broom is #2, lamp is #3. This is the behavious I want to elliminate.
One of the things the current code does is get the 1st inventory item in the list via a GetInvAt command. I thought that wouldn't gibve me any trouble, since it processes the items in the order they are found in the inventory window. BTW, this also happens in the DROP inventory window.

One sidenote - this behaviour may be related to the function that is run when any given item is picked up - since some containers have limits and in order to put down the item (or try to) in that container the format used was "USE INV ON (itself)", I had to do it so that every time the player picks the item up, it is added to the other containers, and when he puts it down, it is removed.

...help please? It works very fine like it is, but it's not what I want, and I've run out of ideas. Please, ye sages of AGS scripting!...

http://www.agagames.com/redrum/problem.agt
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Scummbuddy

  • Mittens Knight
  • Give Stylish Confetti to BoZo - Wheee!
    • I can help with AGS tutoring
    • I can help with animation
    • I can help with backgrounds
    • I can help with characters
    • I can help with proof reading
    • I can help with scripting
    • I can help with story design
    • I can help with voice acting
    • Scummbuddy worked on one or more games that won an AGS Award!
Re:Help me perfect my multi-inventory system!
« Reply #1 on: 05 Apr 2004, 19:09 »
can you call a randomizer function to select where to put the inventory into what slot?

like when you go to pick up an inventory item?
« Last Edit: 05 Apr 2004, 19:10 by Scummbuddy »
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

Rui 'Trovatore' Pires

  • Lunge da lei per me non v'ha diletto!
    • I can help with AGS tutoring
    • I can help with play testing
    • I can help with proof reading
    • I can help with scripting
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
Re:Help me perfect my multi-inventory system!
« Reply #2 on: 05 Apr 2004, 19:13 »
No, cause when I mean "pick up" I mean get it from the inventory window. Anyway, the very same thing happens when the character gets an item from the ame world. Think Discworld I, wherev you have to place the item yourself in the inventory. And because of the container limitations, the player should be able to choose his own. It can't be random.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Pumaman

  • Creator of AGS
  • Administrator
  • Mittens King
  • I sense danger.
    • Lifetime Achievement Award Winner
    • Pumaman worked on one or more games that won an AGS Award!
    •  
    • Pumaman worked on one or more games that was nominated for an AGS Award!
Re:Help me perfect my multi-inventory system!
« Reply #3 on: 05 Apr 2004, 20:47 »
When you switch between containers, does it change the player character?

The inventory window currently keeps track of the order that items are added to it, until such a time as the player character is changed, at which point the items switch back to the default order.

Rui 'Trovatore' Pires

  • Lunge da lei per me non v'ha diletto!
    • I can help with AGS tutoring
    • I can help with play testing
    • I can help with proof reading
    • I can help with scripting
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
Re:Help me perfect my multi-inventory system!
« Reply #4 on: 05 Apr 2004, 20:51 »
Ah! I didn't know that! Ok, I'll fiddle with it a bit keeping THAT in mind to see if I can work around it. If not, it'll have to remain as it is. Thanks!

EDIT - Hmm, I HAVE to change the player character in order to update the inventory in order to get the items by their wanted order (and there's no workaround THIS, even if I didn't use GetInvAt, anything I can use needs an updated inventory). CJ, could you change this behaviour, or make it "toggleable"?
« Last Edit: 05 Apr 2004, 21:04 by redruM »
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Pumaman

  • Creator of AGS
  • Administrator
  • Mittens King
  • I sense danger.
    • Lifetime Achievement Award Winner
    • Pumaman worked on one or more games that won an AGS Award!
    •  
    • Pumaman worked on one or more games that was nominated for an AGS Award!
Re:Help me perfect my multi-inventory system!
« Reply #5 on: 06 Apr 2004, 20:48 »
I'll add it to my list.

Rui 'Trovatore' Pires

  • Lunge da lei per me non v'ha diletto!
    • I can help with AGS tutoring
    • I can help with play testing
    • I can help with proof reading
    • I can help with scripting
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
Re:Help me perfect my multi-inventory system!
« Reply #6 on: 06 Apr 2004, 21:34 »
Oh by all means, add it to your list... but would it be too much to ask, if I were to ask you to add it quite soon?  ::)
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.