Just a quick one.
I'm using the classic sierra KQ5 type interface, where the cursor cycles from one action to another every time the right button is clicked.
That works fine everywhere on screen, except when over the inventory area (which I have at the bottom of the screen, much like Monkey Island and the other LucasArts games).
What basically happens is that when the cursor is over the inventory area, it won't recognise the right mouse button, althought it does recognise the left one. Thus, every time the player wants to look at an inventory object, he needs to drag the mouse outside the inventory, cycle until he gets to the "eye" icon and then drag back into the inventory area and left click on the object.
I'm sure there is a way to cycle the cursor inside the inventory, I just can't find it at the moment. Help anyone?
Thanks.
You may need to experiment with scripts, having the "handle inventory clicks with scripts" option checked, I'm too busy (lazy) to try at the moment, maybe I'll try mocking up some codes when I have time.
I think I've already tried that, but I'll give it another go.
have you tried having 'handle inventory clicks in script' checked, and then add in the mouse_click function something like:
if (button==LEFT){
...
} else if (button==RIGHT){
...
} else if (button==RIGHTINV){ //the one that handles right clicks in inventory
SetNextCursorMode(); //or whatever it is
}...
//being LEFTINV for left inventory clicks
One way to do it:
Place in the start of global script:
int rmbpressed;
and into the repeadetly_execute:
if (IsButtonDown(RIGHT)) {
if (rmbpressed == 0) {
SetNextCursorMode();
rmbpressed = 1;
}else {
rmbpressed = 0;
}
}
Proskrito,
You solution works fine, except the cursor has to be over an inventory item for it to cycle. When the game begins, and there's just one big empty black square down the bottom of the screen, the curson won't cycle in that area. It only starts to do so when you have inventory items.
TK,
You solution overcomes that problem, but sometimes it cycles two or three operations at a time, thus jumping over some.
Thanks anyway, you've set me on the right track. If you have any more ideas just give us a tick.
I think you can use the GUI_MDOWN and GUI_MUP events of on_event(int event, int data);
Inside, you can use IsButtonDown(RIGHT).
Quote from: Barcik on Fri 09/01/2004 14:33:41
I think you can use the GUI_MDOWN and GUI_MUP events of on_event(int event, int data);
Inside, you can use IsButtonDown(RIGHT).
Yeap, you can set it like:
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) {
// on left click
} else if (button==RIGHT)
// on right click
} else if (button == LEFTINV) {
// on left click on inv
} else if (button == RIGHTINV) {
// on right click on int
}
}
//returns the button is down
function GetMouseButtonDown() {
if (IsButtonDown (LEFT)) return LEFT;
else if (IsButtonDown (RIGHT)) return RIGHT;
}
function on_event (int event, int data) {
if (event == GUI_MDOWN && GetInvAt(mouse.x, mouse.y)==-1) on_mouse_click(GetMouseButtonDown());
}
ps. make sure the inv gui has a visible option set to normal or alternativity, adjust the on_mouse_click the way that it would work when the game is paused.
~Cheers