SRL Archive - OSR Help

InvMouse(x, 2); not working


shebee

2013-02-19 18:48:06

I've been trying to figure this out…
Even made simple scripts to check if it's something in my code, but nothing makes it work, even long Wait();s etc..
I'd paste my code but I'm not on my PC right now but I'm trying to move my mouse to the 2nd inv slot and choose all.
So something like this:

InvMouse(2, 2);
Wait(randomRange(1000, 500)); // just to be sure long wait
ChooseOption('All');

It just won't right click, invmouse with 2, 1 works fine (it left clicks the item).

Le Jingle

2013-02-19 18:55:16

Numbers change? I'd advise using constants, like mouse_right, instead of a number like 2. Thus, you'll know even is the numbers associated to the constants are edited, that the constant input will still result in the desired action.

ex.

{$include_once srl/srl.simba}
begin
SetupSRL;
if InvMouse(2, mouse_right) then
ChooseOption('All');
end.

Also make sure you text is correct, as upper/lower case does matter, well should matter.
-Lj

shebee

2013-02-19 19:16:13

Thanks,
I'll try that once I'm at my computer, however I don't understand what you mean by numbers change in this case, care to elaborate?
Checked the InvMouse procedure but I didn't really understand how it makes a difference.

Also checked simba documentation and found this:
const
mouse_Right = 0
mouse_Left = 1
mouse_Middle = 2

Seems I should use InvMouse(2, 0); not InvMouse(2, 2) correct?

Le Jingle

2013-02-19 19:22:31

From: shebee
Thanks,
I'll try that once I'm at my computer, however I don't understand what you mean by numbers change in this case, care to elaborate?
Checked the InvMouse procedure but I didn't really understand how it makes a difference.


in the includes, or in the simba build, let's say you have 0, 1, or 2 for mouse actions, each representing a way a mouse might click (choices could be left/right/none aka move). We'll, let's say somewhere in the implementation of a mouse method, the old mouse_right was equivalent to 2, but now, it's been changed so mouse_move is currently equivalent to 2. However, if we use the constants, or the Mouse_Left, Mouse_Right, Mouse_Move, we should never encounter a problem with changed implementation, because as we interact with the interface of the InvMouse function, and we say Mouse_Right instead of 2, we should have no doubt that the Mouse_Right will always generate a mouse click for the right button, versus having some doubt that 2, may have changed to a different mouse button. Thus, I'd recommend calling constants instead of hard code, as there should be less errors to deal with.

Cheers,
Lj

shebee

2013-02-19 20:52:03

From: Le Jingle
in the includes, or in the simba build, let's say you have 0, 1, or 2 for mouse actions, each representing a way a mouse might click (choices could be left/right/none aka move). We'll, let's say somewhere in the implementation of a mouse method, the old mouse_right was equivalent to 2, but now, it's been changed so mouse_move is currently equivalent to 2. However, if we use the constants, or the Mouse_Left, Mouse_Right, Mouse_Move, we should never encounter a problem with changed implementation, because as we interact with the interface of the InvMouse function, and we say Mouse_Right instead of 2, we should have no doubt that the Mouse_Right will always generate a mouse click for the right button, versus having some doubt that 2, may have changed to a different mouse button. Thus, I'd recommend calling constants instead of hard code, as there should be less errors to deal with.

Cheers,
Lj


Thanks, I suspected something like that.
Very good explanation, really appreciate it!