A bit of a problem, as all these click-processing things are confusing to me. What I want:
The left mouse click should do this:
- Walking and Looking, depending on where you click. (Working)
- Selecting an inventory item. (Not working)
The right mouse button should do this:
- Interacting with the environment. (Working)
- Looking at an inventory item. (Not working)
To handle the first action (Walking and Looking & Interacting) I use the following global script:
================================
Global Script:
function on_mouse_click(int button) {
// called when a mouse button is clicked. button is either LEFT or RIGHT
if (IsGamePaused() == 1) {
// Game is paused, so do nothing (ie. don't allow mouse click)
}
else if (button==LEFT)
{
if (GetCursorMode() == 4) {
ProcessClick(mouse.x, mouse.y, MODE_USEINV);
}
if (GetCursorMode() == 6) {
ProcessClick(mouse.x, mouse.y, MODE_WALK );
ProcessClick(mouse.x, mouse.y, MODE_LOOK );
}
}
else if (button==RIGHT)
{
if (GetCursorMode() == 4) {
SetCursorMode(6);
}
else {
ProcessClick(mouse.x, mouse.y, MODE_USE );
}
}
}
================================
My normal cursor is CursorMode6, which gets set as the game starts. This works fine for me. The characters walks and looks when I want it to.
Now, I have a GUI in the bottom of the screen which is always visible. The only thing it has is an inventory-screen. I don't have any additional scripts in place. However, I can click all I want with the left mouse button, but I can't select an inventory item. This isn't so surprising, because that requires CursorMode #2, the Interact mode. However, if I set my cursor to Interact, I can't walk anywhere anymore.
Needless to say, I'm a bit stumped. I've tried playing with the script a bit, but I'm afraid of messing it up entirely. I have "Handle inv. clicks in script" set to Disabled. Maybe that's something to work with?
Uh, never mind.
I set my default cursor mode to 2 instead of 6. So now everything is working just fine... :)
:)
For future reference, the "Handle inv clicks in script" allows you to customize the inventory to handle clicks how you want in any mouse cursor mode.
Ah, yes. I can see how that would have helped. ;)
I'll indeed keep that in mind... I may decide to do an Interface-overhaul before the game is completed. :)