Right Click Cycle in inv?? [ABANDONED]

Started by YotamElal, Sat 05/03/2005 14:34:18

Previous topic - Next topic

YotamElal

Y isn't this working???

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, GetCursorMode() );
}

  else if (button == RIGHTINV) {
    DisableCursorMode(MODE_WALK);
    SetNextCursorMode();
    EnableCursorMode(MODE_WALK);
  }
  else {   // right-click, so cycle cursor
    SetNextCursorMode();
  }
}

Ashen

Have you enabled 'Handle inventory clicks in script' on the General settings?
I know what you're thinking ... Don't think that.


TerranRich

Welll...? Do it and let us know what happens.
Status: Trying to come up with some ideas...

YotamElal

it works fine on inv items.

can i allso make it work on the empty inv space???

strazer

Try this:

Code: ags

// main global script file

int guimb; // stores mouse button clicked on gui

function on_event(int event, int data) {
  //...

  if (event == GUI_MDOWN) { // if mouse clicked over a gui
    if (IsButtonDown(LEFT)) guimb = LEFT; // if left mouse button pressed, store it in variable
    else if (IsButtonDown(RIGHT)) guimb = RIGHT; // if right mouse button pressed, store it in variable
    else guimb = 0; // if pressed any other buttons, reset variable
  }

  //...
}

function interface_click(int interface, int button) {
  //...

  if (interface == NAMEOFGUITHEINVENTORYISON) {
    if (button == NUMBEROFTHEINVENTORYCONTROL) {
      if (guimb == RIGHT) // if right mouse button was pressed
        on_mouse_click(RIGHTINV); // call on_mouse_click function for RIGHTINV action
    }
  }

  //...
}


Note that for this particular script to work, the on_mouse_click function has to be located before the interface_click function in the global script so that the latter can call the former.
Or you can define a custom function that you can call from both on_mouse_click and interface_click. That is in fact the safest and recommended way.

YotamElal

It seems to complicated.. I'll pass

SMF spam blocked by CleanTalk