Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: CodeJunkie on Thu 12/08/2004 21:22:52

Title: Custom Inventory Item Selection
Post by: CodeJunkie on Thu 12/08/2004 21:22:52
I've modified the template inventory and in the script changed the inventory type to custom.  All works well except for a small problem - the bottom half of inventory objects aren't selected when clicked.   I don't have any buttons or anything blocking the way, the listbox is on it's own, and far from the bottom of the window.  If I change back to the default inventory gui in the script then it works fine.  I haven't added any extra scripting for my custom inventory though - just moved some things about, deleted some objects and changed the appearance.  Am I missing something from the default inventory scripting that would make the objects fully clickable?  I'm not too bothered about getting the selector to work.  I took a look at http://www.adventuregamestudio.co.uk/yabb/index.php?topic=14752.0 and tried it out, but I couldn't seem to work it and it's probably a bit too complex for me right now.  All suggestions welcome.
-Sim
Title: Re: Custom Inventory Item Selection
Post by: SilverWizard_OTF on Fri 13/08/2004 14:43:52
Maybe you should add s slider (like this that the default inventory screen has), to scroll through your inventory items.
  I hope you know how to add one, bacause i don't (well, i mean i was never interested to learn that).
Title: Re: Custom Inventory Item Selection
Post by: Radiant on Fri 13/08/2004 16:39:57
The easiest solution is to add two GUI buttons, that are respectively scripted to
  game.top_inv_shown += game.inv_items_per_line;
  game.top_inv_shown -= game.inv_items_per_line;

(my spelling may be wrong here, check the help page for game. variables)
Title: Re: Custom Inventory Item Selection
Post by: CodeJunkie on Fri 13/08/2004 18:22:37
I assume you mean game.top_inv_item?
I'm confused though.  I couldn't find += and -= in the Operators section.  Do you mean >= and <=?  Anyway, I'd be grateful if you could explain what the script does a bit, and also I can't see where I'm supposed to integrate the objects, or what the objects could do.  Thanks for the help so far though, I do appreciate it.
Title: Re: Custom Inventory Item Selection
Post by: CodeJunkie on Sat 14/08/2004 21:11:49
I don't like to drag the topic up again, but at the same time I don't want to create a new one.  My initial problem still stands, however I'm not sure how Radiant's suggestion works.  And suggestions or help would be appreciated.
Title: Re: Custom Inventory Item Selection
Post by: monkey0506 on Sun 15/08/2004 01:57:44
Have you tried using his script? I don't really know what these do, and I don't feel like looking them up, but did you even try it?
Title: Re: Custom Inventory Item Selection
Post by: CodeJunkie on Thu 19/08/2004 22:10:40
I've tried using the script, yes.  I've tried modifying it a bit too, but the underlying problem is that I don't understand where the two GUI buttons come in, which makes the script more or less useless.
Title: Re: Custom Inventory Item Selection
Post by: Redwall on Thu 19/08/2004 22:31:54
Check out interfaceclick and see how the inventory buttons work.
Title: Re: Custom Inventory Item Selection
Post by: CodeJunkie on Fri 20/08/2004 11:15:51
I understand how the inventory buttons work, except that I can't see how ints 'button' and 'interface' are set.Ã,  I'm not sure why two buttons should be added though- what would they do?Ã,  The default inventory hasn't got two extra buttons as far as I know.Ã,  I put the above two lines of script into game_start and the game will run, but no difference.Ã,  I don't understand what causes the problem.
In case it helps, I had deleted the two scroll buttons, however they are the last two objects in the inventory GUI and I've 'commented' out that part of the script anyway.Ã,  I'm pretty sure that wouldn't make a difference as the script is only run when the buttons are pressed.  The inventory only holds three items (the player can never end up with more than three items anyway).  Each item image is 64x64 as well.
Looking back at another GUI I made I noticed that the same problem was there, and that one had plenty of room, only the graphics were modified I think.  Is there an important thing that is missing between a custom inventory and a default inventory (some sort of clickable area)?
Title: Re: Custom Inventory Item Selection
Post by: CodeJunkie on Fri 20/08/2004 11:59:20
 :-[ I solved it
SetInvDimensions seems to set the space items take up.  I don't know why it worked fine on the default inventory though - I can't see how it can tell the size of my items.  Still, it's fixed.
Sorry about the hassle  :(
Title: Re: Custom Inventory Item Selection
Post by: Pumaman on Fri 20/08/2004 20:12:15
The default inventory window InventoryScreen() ignores SetInvDimensions and works off the largest inventory item picture, which is why you saw this behaviour.