I'm trying to make a custom gui for a.. uh.. game... but I'm failing at one point and one point only. I cannot make Use Inventory 1 with Inventory 2 work. To clarify, using one inventory item with another.
It shows up on the status line, so I think its something to do with the on_mouse_click function... here is my code for on_mouse_click!
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) {
ProcessClick (mouse.x, mouse.y, MODE_WALK);
if(GetGlobalInt (1) == 1) {
ProcessClick (mouse.x, mouse.y, MODE_LOOK);
SetGlobalInt (1, 0);
SetActiveInventory (-1); }
else if ((GetGlobalInt (1) == 2) && (player.activeinv != -1)) {
ProcessClick (mouse.x, mouse.y, MODE_USEINV);
SetGlobalInt (1, 0);
SetActiveInventory (-1); }
else if (GetGlobalInt (1) == 2) {
ProcessClick (mouse.x, mouse.y, MODE_USE);
SetGlobalInt (1, 0);
SetActiveInventory (-1); }
else if (GetGlobalInt (1) == 3) {
ProcessClick (mouse.x, mouse.y, MODE_TALK);
SetGlobalInt (1, 0);
SetActiveInventory (-1); }
}
else if ((button == LEFTINV) && (GetGlobalInt (1) == 2)) {
SetActiveInventory(GetInvAt (mouse.x, mouse.y)); }
else if ((button==LEFTINV) && (GetGlobalInt (1) == 1)) {
RunInventoryInteraction (GetInvAt (mouse.x, mouse.y), MODE_LOOK);
SetGlobalInt (1, 0);
SetActiveInventory (-1); }
else if ((button==LEFTINV) && (GetGlobalInt (1) == 3)) {
RunInventoryInteraction (GetInvAt (mouse.x, mouse.y), MODE_TALK);
SetGlobalInt (1, 0);
SetActiveInventory (-1); }
else if (button == RIGHTINV) {
RunInventoryInteraction (GetInvAt (mouse.x, mouse.y), MODE_LOOK);
SetGlobalInt (1, 0);
SetActiveInventory (-1); }
else { // right-click resets the status bar
SetGlobalInt(1, 0);
}
}
I'm using Global Int 1 for the gui, by the way.
Quoteelse if ((button == LEFTINV) && (GetGlobalInt (1) == 2)) {
SetActiveInventory(GetInvAt (mouse.x, mouse.y)); }
else if ((button==LEFTINV) && (GetGlobalInt (1) == 1)) {
RunInventoryInteraction (GetInvAt (mouse.x, mouse.y), MODE_LOOK);
SetGlobalInt (1, 0);
SetActiveInventory (-1); }
else if ((button==LEFTINV) && (GetGlobalInt (1) == 3)) {
RunInventoryInteraction (GetInvAt (mouse.x, mouse.y), MODE_TALK);
SetGlobalInt (1, 0);
SetActiveInventory (-1); }
You are only running the Look and Talk interactions. You need an additional "else if" to run inventory-on-inventory interactions.