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();
}
}
Have you enabled 'Handle inventory clicks in script' on the General settings?
??? no.. ???
Welll...? Do it and let us know what happens.
it works fine on inv items.
can i allso make it work on the empty inv space???
Try this:
// 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.
It seems to complicated.. I'll pass