Machinarium Inventory System?

Started by mastastealth, Tue 14/09/2010 07:32:10

Previous topic - Next topic

mastastealth

I've been searching through the wikis and stuff on GUIs, but almost everything I find uses one of the older game type GUIs with all the "Look, Use, etc" commands.

I was wondering if someone knows of an already-created GUI a-la Machinarium? It would be similar to AGS's default GUI, but without any of the 4 main commands, or the 2 inventory buttons. It would simply show the items you already had in inventory straight into the bar.

If it doesn't exist, someone mind giving me some quick pointers on how to make one? I'm new to AGS, and I'm just starting to get the hang of the basic scripts and stuff, but the GUI scripting looks a little bit messier.  :P

Khris

This is known around here as the Broken Sword interface.

There's a mouse script that should work here:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=31160.0
(you don't need the two #section... lines)

For the inventory, simply remove the buttons and resize the GUI / InvWindow to your liking. Then set it's display mode to "Normal, initially on" or "Popup Y" if you want it to appear when the mouse moves near the top of the screen.

mastastealth

Thanks, that InvWindow in the GUI seems to be what I was looking for. However, despite adding an "Interact" script to the inventory items, when I click on them in that InvWindow on the bar, nothing happens? Do I have to "enable" that Inventory Window somehow?

Khris

I'm not completely sure the script I linked to does its job; looking at the code, there's seems to be stuff missing.

However, in Machinarium there wasn't a way to interact with an item.
(If you tried to set the item as active, i.e. mouse cursor, that should be done generically for all items inside on_mouse_click, not on a per-item basis.)

I just remembered that you have to set an option in General settings: Inventory clicks have to be handled in script.

I've meant to create a Broken Sword template for quite some time now since it's the best IMO and quite often asked about by newbies. I didn't get around to that yet, but I will.

mastastealth

Quote from: Khris on Tue 14/09/2010 22:32:20
However, in Machinarium there wasn't a way to interact with an item.
(If you tried to set the item as active, i.e. mouse cursor, that should be done generically for all items inside on_mouse_click, not on a per-item basis.)

Oh, then maybe I misunderstood the option. I thought "interact" on an inventory item was the actual "click". So I was doing:

Code: ags

function Item_Interact()
{
    Player.ActiveInventory = Item;
}


...to set my cursor as the item, which I could then use to click somewhere in the game. At the moment, clicking an item in my inventory window isn't setting any cursors, which I figured would be automatic...

What you're saying is to have that in an on_mouse_click function? I assume with that I could do something along the lines of:

on_mouse_click, if button == left, if ClickOnInvItem(return item) then Player.ActiveInventory = Item?

mastastealth

Ah, excuse my ignorance. I just searched through the forums and realized the Inventory Window has size options for the actual items, mine was really small and therefore not selecting anything  :-[ Thanks for the help!

SMF spam blocked by CleanTalk