Home Artists Posts Import Register
The Offical Matrix Groupchat is online! >>CLICK HERE<<

Content

This one is taking me a little while! There's quick and dirty ways I've written this before but given how clean our base inventory was I wanted to write something good/generic to match it with the mouse control.

I opted for a state machine controlled 'mouse' object that deals with all mouse operations on the inventory. I like this because it very cleanly separates the different states the mouse can be in and gives you room to keep this apart from any other UI interactions without running a thousand conditional checks on every mouse check/click.

While you wait for the video (maybe next week... sorry!) here's a paste of the code from the mouse object create event that gives you most of what you need.

https://pastebin.com/7himfAFG

The visual elements then take place in some light adjustments to the draw event of oInventory by checking the variables in oMouse and drawing slots slightly differently.

of course actually running the state machine is as simple as writing state(); in the step event of oMouse.

Hope this is helpful in the meanwhile! I think my recent videos are some of my best work personally and I want to thank you all once again for your vital role in getting them made.

-S

Files

Comments

Eben Sullivan

Thanks, Shaun! I've been fumbling around with mouse related issues lately and having a look through your code has helped me figure a few things out (as usual).