SOLVED: MouseClicks on inventory items

Started by Eastwing, Mon 16/06/2014 07:35:27

Previous topic - Next topic

Eastwing

Hello! I'm using AGS 3.3

I'm trying to create my own interface style. So I created inventory window but it's items don't react on any mouse clicks!
Code: ags
//LEFT MOUSE BUTTON:
if (button == eMouseLeft)
{
    if (IsPositionInteractive)
    {
        InventoryItem *TempInv = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
	if (TempInv == null) ProcessClick(mouse.x, mouse.y, eModeInteract);
	else 
        { //THIS SECTION WONT WORK:
	    player.ActiveInventory = TempInv;
	    mouse.Mode = eModeUseinv; 
	    player.Clickable = true;
        }
    }
    else ProcessClick(mouse.x,mouse.y, eModeWalkto);


When I paste that section to on_key_press (bind it to Spacebar for example) it works fine. ???

I suppose it's frequent question, but my English is not well and I just don't know how to search solution.

Billbis

Replace eMouseLeft by eMouseLeftInv for left clicks on inventory window.
It took me a while to realize it myself. :-D

Eastwing

#2
Stupid me :-D

Thank you!

Adeel

Quote from: Billbis on Mon 16/06/2014 07:52:22
Replace eMouseLeft by eMouseLeftInv for left clicks on inventory window.
It took me a while to realize it myself. :-D

Hahaha! Same here! (wtf) (laugh)

Khris

Note that eMouseLeft/RightInv are only used by AGS when on_mouse_click is called if you have set inventory handling to manual in General settings.

Calin Leafshade

I still think this distinction is utterly stupid.

Eastwing

Quote from: Calin Leafshade on Mon 16/06/2014 22:39:52
I still think this distinction is utterly stupid.

It's unevident, yes.

monkey0506

Quote from: Calin Leafshade on Mon 16/06/2014 22:39:52I still think this distinction is utterly stupid.

This is due to the fact that AGS treats inventory items as part of a GUI (for which on_mouse_click is not called). While it would make sense (now) to make this invisible to the user (and probably add a proper LocationType for InventoryItems as well), it would actually break existing game scripts -- the very reason why it is the way it is.

Of course, considering AGS is completely broken and unusable for any purpose, someone should just write a new one in Lua anyway.

Calin Leafshade

on_mouse_click should be called when, i dunno, maybe, possibly, when the mouse is clicked.

Just an idea.

monkey0506

All part of the engine you're writing from scratch in Lua amirite?

on_mouse_click ignoring clicks on GUIs was an intentional, by-design feature of the engine to distinguish between clicking anywhere in the actual game versus an interface_click. You can call it a stupid naming convention all day long, but there was obvious logic behind it. Oh, and you can make sure to not make any stupid blunders like that in your engine. Which is releasing soon, amirite? I mean, I've been holding my breath waiting for the first ever modern game engine, the first ever game engine to use a real language like Lua, the first ever modern game engine designed to make 2D, 2.5D, and 3D games with the same ease of use, the first ever game engine to allow you to make commercial games, the first ever game engine to run on every platform from DOS to PS4. Can't wait.

Calin Leafshade

Your post illustrates why people think you're a really cool guy.

Billbis


:=


Can't you stop doing that both of you? We're not talking about game Engine here, but simply about how to make an actual game using actual AGS 3.3.0.

SMF spam blocked by CleanTalk