Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: sloppy on Tue 15/11/2005 21:15:25

Title: Display message when interacting with inventory
Post by: sloppy on Tue 15/11/2005 21:15:25
Here's a question:
I have it that you use one inventory item with another and you end up with another inventory item.  Then I have a display message saying that.    But what happens is that the message appears before the third item appears in the inventory.  You have to click the message away before you see the inventory object.

How can I force the display message to be the last thing that appears after everything else happens?
Title: Re: Display message when interacting with inventory
Post by: Ubel on Tue 15/11/2005 21:29:54
You could try to put:
Wait(1);
in between the AddInventory and Display codes.

Or if you are not using script codes, just use the "Pause command processor" option between them and give it the value 1.

I hope that was clear enough.
Title: Re: Display message when interacting with inventory
Post by: sloppy on Tue 15/11/2005 22:00:38
Your first suggestion doesn't seem to work.
Here's what I put in the inventory 1 "use inventory on this item" interaction:
if (player.ActiveInventory==inventory[2]) {
player.AddInventory(inventory[3]);
player.LoseInventory(inventory[1]);
player.LoseInventory(inventory[2]);
Wait(1);
Display("You've made a new object.");Ã, 
}
The display message still appears before inventory 1 & 2 disappears and inventory 3 appears.

And I don't know what this means.Ã,  I can't find a "pause command processor" option:
Quote from: Pablo on Tue 15/11/2005 21:29:54
Or if you are not using script codes, just use the "Pause command processor" option between them and give it the value 1.
Title: Re: Display message when interacting with inventory
Post by: strazer on Tue 15/11/2005 23:08:56
You can add several "Run Script" actions for the same interaction. Try adding another "Run Script" action and put the Display command in there.
Title: Re: Display message when interacting with inventory
Post by: sloppy on Tue 15/11/2005 23:32:27
Yes, now that works!  Thanks!
Title: Re: Display message when interacting with inventory
Post by: strazer on Tue 15/11/2005 23:39:42
Glad to hear it.
It seems AddInventory and LoseInventory commands are indeed delayed-response functions, meaning they don't execute immediately but rather when the current script ends.

Btw, you can also use this workaround if you want to do stuff after a dialog has ended, because RunDialog is also a delayed-response function.