Problem looking at inventory item [solved]

Started by Clarabella, Thu 19/02/2009 17:52:39

Previous topic - Next topic

Clarabella

I know it may seem stupid, but I have problems looking at an inventory item. I want the main character to say something when looking on an inv item, and I only manage to make this dialog line start when the option "handle inventory clicks in script" is off. The problem is that, if that option is off, I have problems with other functions ("interact" and "use)...
Is this a common problem? Is there something I don't know about using these functions?
Here's the script i use:

function bLook_OnClick(GUIControl *control, MouseButton button)
{
Mouse.Mode = eModeLookat;
}

and

function iXxx_Look()
{
cYyy.Say("Bla bla bla");
}

Thanks everyone!

Matti

Quote from: Clarabella on Thu 19/02/2009 17:52:39
The problem is that, if that option is off, I have problems with other functions ("interact" and "use)...

Why is that? What's the problem.

As CJ states in this thread, the handle-inventory option "means that you want to override the built-in AGS handling of inventory clicks. When it's set to true, you have to manually process the click in the on_mouse_click function instead."

So if you use the normal cursors (interact/look etc.) the option should be turned off. But what is your problem then?

Make sure you use the lightning bolt icon in the panel to tell AGS what should happen when an item is being clicked..

Clarabella

Quote from: matti on Thu 19/02/2009 18:00:06
Quote from: Clarabella on Thu 19/02/2009 17:52:39
The problem is that, if that option is off, I have problems with other functions ("interact" and "use)...

Why is that? What's the problem.

As CJ states in this thread, the handle-inventory option "means that you want to override the built-in AGS handling of inventory clicks. When it's set to true, you have to manually process the click in the on_mouse_click function instead."

So if you use the normal cursors (interact/look etc.) the option should be turned off. But what is your problem then?

Wow, I totally misunderstood the meaning of this option then... now I see why look function didn't work with that option on.

The problem with "interact" is that I set something like this in the on_mouse_click, if (button == eMouseLeft) :

InventoryItem *i = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);     
if (i != null) {
if (Mouse.Mode == eModeInteract)
{
lStato.Text = String.Format ("Usa %s", i.Name);
}
}

to print actions on a label (don't know if "print" is the right word, sorry, I'm Italian. I mean: things that I make happen clicking on objects, characters, etc., are written on the label)
Well, nothing happens when "handle inventory script" is off. But now you explained me what's the meaning of "handle inventory script" I guess I'm not doing the right thing, because I'm trying to override the AGS handling of inventory (right?)
Ok, I think I have to study the AGS tutorials again, and better than I did :P

Quote
Make sure you use the lightning bolt icon in the panel to tell AGS what should happen when an item is being clicked..

yes, I always pay attention to this  :)

Clarabella

ok, now that I understand the use of the option "handle inventory scripts" I managed to solve all the problems: with labels, functions and so on.
Thank you very much Matti!

SMF spam blocked by CleanTalk