Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Candle on Sun 02/10/2005 05:35:32

Title: Animate Inventory item
Post by: Candle on Sun 02/10/2005 05:35:32
Can you Animate Inventory item?
I have a torch that would look better if I could.
Title: Re: Animate Inventory item
Post by: strazer on Sun 02/10/2005 14:52:08
Try this script module (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=26117).
Title: Re: Animate Inventory item
Post by: Candle on Sun 02/10/2005 22:33:53
What do I do with the file in the zip? I'm not sure how this works.
Title: Re: Animate Inventory item
Post by: Ashen on Sun 02/10/2005 22:51:40
Just import it into 'Module Manager' (on the 'Script' menu) and you should be good to go - assuming you've got 2.7 or later.

strazer, one thing:
if (IsGamePaused() == true) return 0; // if game is paused, quit function (no animation)
Wouldn't this mean the module won't work if the Inventory GUI is popup modal?
Title: Re: Animate Inventory item
Post by: Candle on Sun 02/10/2005 22:56:08
Thanks for clearing that up for me .
Edit
Where do I can the script part to use it? I can't seem to find any info on how to use it in the help file or I'm over looking it .
Title: Re: Animate Inventory item
Post by: TheMagician on Sun 02/10/2005 23:09:28
QuoteCode:
if (IsGamePaused() == true) return 0; // if game is paused, quit function (no animation)
Wouldn't this mean the module won't work if the Inventory GUI is popup modal?

I just tested the module and indeed it only works with the standard inventory GUI if this line is removed.

Apart from that you've created a very nice and useful module, Strazer!

I love the whole module-business with AGS!  :D
Title: Re: Animate Inventory item
Post by: strazer on Sun 02/10/2005 23:56:18
Quote from: Ashen on Sun 02/10/2005 22:51:40Wouldn't this mean the module won't work if the Inventory GUI is popup modal?

You're absolutely right. Thanks for the hint. I use it in my own game which has a non-modal inventory GUI, that's why I haven't noticed it.
Fixed version 0.90b is now up (just commented out that line).

Quote from: Candle on Sun 02/10/2005 22:56:08Where do I can the script part to use it? I can't seem to find any info on how to use it in the help file or I'm over looking it.

This module provides script functions written by me. Such script module functions are not built into AGS itself, therefore cannot be found in the manual.

To use the script module, import it into your game, as Ashen said, via menu "Script" -> "Module manager...". Then you have access to the functions detailed above.
Where you have to put the functions depends on when you want the animation to start/stop. If you want the torch to be animated right from the beginning of the game, put InvItemAnimation.Start in your game_start function. You could also, for example, start the animation only if the torch has been lit first (using lighter on torch or whatever).
Title: Re: Animate Inventory item
Post by: Candle on Mon 03/10/2005 00:08:08
Thank you strazer for all the help .
Title: Re: Animate Inventory item
Post by: Ashen on Mon 03/10/2005 00:21:08
Quote from: strazerFixed version 0.90b is now up (just commented out that line).

Perhaps you could replace it with something like if (gInventory.Visible != true) return 0; instead, although that might mean the user would have to edit the line, to point to whatever they called their Inventory GUI. It just seems a bit of a waste of time to be processing the animations, when you can't see the Inventory anyway.
Title: Re: Animate Inventory item
Post by: Candle on Mon 03/10/2005 00:37:02
EDIT I got it , it was a small t and not T
Works perfect thanks guys.


Title: Re: Animate Inventory item
Post by: strazer on Mon 03/10/2005 00:59:24
Quote from: Ashen on Mon 03/10/2005 00:21:08
It just seems a bit of a waste of time to be processing the animations, when you can't see the Inventory anyway.

Problem is, any character could have the item in his inventory and for all I know the user could have this character's inventory displayed on any GUI. It seems quite messy to automatically check all GUIs for an InvWindow containing the item. On the other hand I don't want the user to have to edit the module or specify what InvWindows to check or something.
So I think for simplicity's sake I'll leave it the way it is. I don't think the animation routines use that many resources anyway. If you disagree, feel free to modify the module to your needs.