Default inventory window click handling

Started by Kara Jo Kalinowski, Sat 08/02/2025 03:51:33

Previous topic - Next topic

Kara Jo Kalinowski

For my game, Artifact, I had started on a blank game in AGS 3.5.1 (so had no code at all) except that I wanted a simple right click / left click interface with inventory displayed on screen. So I copied some trimmed down parts of the BASS code which worked for left clicks/right clicks in the room itself. Meaning I wanted left/right clicks on inventory items to do something, because right now they were doing nothing.

I asked for help on the Discord, and I didn't exactly get a full answer to my questions. I was told, basically, that AGS is supposed to handle inventory actions on its own, but I was asking what cursor mode the mouse had to be in for the mouse to do that (was told it didn't matter).

Eventually we settled on "Override built-in inventory window click handling" and when I toggled that to true, the BASS stuff with click handling worked again, but I still don't know what I was missing for the built-in inventory stuff to work, though I solved the problem my own way.

Here's my script (minus stuff specific to inventory interactions): https://pastebin.com/W4VuUa57

It does have an on_mouse_click function but that function didn't seem to get triggered at all by inventory/GUI stuff until I overrode the default AGS behavior. Can someone explain to me what I was missing so that I know for the future?

RootBound

I have had confusion about this in the past but I have learned a couple of useful things over time.

on_mouse_click does not get called over GUIs (I looked to see if the manual mentions this in the on_mouse_click section, but it appears that it doesn't).

You can, however, use on_event, with eEventGUIMouseDown.

And for the default inventory click handling to work, the mouse mode actually does need to be eModeInteract for a left click to select the item. This is mentioned in the manual section on the General Settings panel, but it is a brief mention that is easy to miss.
They/them. Here are some of my games:

Kara Jo Kalinowski

Thank you for the explanation. It actually does get called for inventory windows if you have "Override built-in inventory window click handling" set to true in your inventory settings. That uses eMouseLeftInv / eMouseRightInv for inventory item clicks. I was just wondering what I was missing regarding the default settings.

SMF spam blocked by CleanTalk