Problem with unresponsive inventory

Started by pxl, Tue 03/02/2009 18:15:35

Previous topic - Next topic

pxl

Hey,
seems like I have to start off in this forum just like the majority of people. With a question. I've read the FAQ, Beginners tutorial and searched the forums for the answer to my problem, but to no avail.

I'm starting out my first game, and so far I'm using the standard GUI with the standard Inventory. I've chosen to go First Person (mainly because I want to try the program out before spending 10+ hours on character design).

So, on to the problem.

As I said, I'm going for First Person here, so I have ShowPlayerCharacter set to False in my first (and only) room. I've got a letter, which I'm able to pick up and add to the inventory using:
function oLetter_Interact()
{
  oLetter.Visible = false;
  player.AddInventory(iLetter);
}


After that, I open the inventory, and there it is. But nothing happens, no matter how I click it. I have set the interact event on the item (iLetter) to:
function iLetter_Look()
{
  Display("I'd like to read this, but I can't...");
}

which is in the GlobalScript.asc.
In my attempts, I've even resorted to direct all events to this function. Alas, nothing.

So, you guys are my last resort. Shall my game-making days be over even before they begun?
Thanks in advance.



(Oh, and in case this actually is answered somewhere in the forums and I managed to miss it, a simple point and nudge to that thread would be nice)


GarageGothic

Please check that the "Handle inventory clicks in script" option in the General Settings is set to false.

pxl

I'm afraid it's still the same whether it's set to True or False. This really puzzles me.

Khris

Are you using the default template? Is the InvWindow on the GUI clickable?

pxl

I'm using the Default Template and gInventory has it's Clickable set to Yes.
Thanks for really quick responses by the way.

GarageGothic

#5
Oh yes, I forgot. Interact doesn't actually work in the inventory because it selects the inventory item (making it the cursor) rather than "interacting" with it. So the event doesn't actually run. If you need an interact function in your inventory, you have to code it yourself.

This would require you to set "Handle inventory clicks in script" to true and check for eMouseLeftInv returning "true" in the on_mouse_click (MouseButton button) function. I'm sure you can find previous posts about this by using the forum's search function. There's also a bit of info about this in the "Inventory item events" section of the manual.

Edit: An easier solution may actually be to manually change the mouse cursor of the Talk function when you open/close the inventory, and use the Talk interaction for "interact" instead.

pxl

But shouldn't "Look at Inventory Object" work? Because thats the function I'm really after. Beeing able to look through descriptions of items in the inventory.

Scratch that. I noticed now that I can click a little area in the top-right corner of the letter sprite. I'm making a 640x480 game, am I exceeding some kind of sprite size limit for inventory items?

GarageGothic

If you go to the GUI editor and click on your inventory window, there are two properties called ItemHeight and ItemWidth. If you change these to the size of your item sprites, they should be fully clickable.

pxl

#8
Awesome! That fixed everything!
Thanks again for the unbelievably speedy responses and helpful attitudes. I'll go ahead and mark this with a thumbs up now. Well, I couldn't do that. Well, consider this problem solved.

SMF spam blocked by CleanTalk