SRL Archive - OSR Help

GetMousePos returns wrong value


botte

2013-04-01 11:30:29

Hi there,

I just started learning to script in Simba using YoHoJo's video tutorials and some reference scripts.
However, I have come across a slightly annoying problem. The main thing is that the y-value of GetMousePos and MoveMouse is off with 22 pixels.

I used the following script to output the mouse positions with a 2sec-interval. I don't think the problem is in there, but I'll post it anyway:
program Tester;

{$I SRL/SRL.Simba}

var x, y: integer;

begin
SetupSRL;
Repeat
GetMousePos(x, y);
SendKeys('(' + IntToStr(x) + ', ' + IntToStr(y) + ')', 10, 0);
TypeByte(VK_ENTER);
Wait(2000);
Until(false);
end.
(Don't worry, I did not execute it in Runescape)

Basically the script shows the position of the mouse every 2 seconds. If I move my mouse to the top left corner it should show (0, 0) right? Well, it doesn't, it shows (0, -22). In fact for every point it is misaligned by -22px. The built-in Simba coordviewer (on the bottom) shows it correctly (that one returns (0, 0)). I did another test using the MoveMouse-function, which happened to be misaligned with the same magnitude. So to move my mouse to the top left corner, I had to input the coords (0, -22) instead of the expected (0, 0). I haven't tried the colour finding function yet, but I assume those will be wrong as well.

Of course it's possible to take it into account in my scripts and work my way around it. But it's probably a problem on my side, and if I ever was to share it with others they would not be able to use my scripts as they don't have that problem. And also it's something annoying I want to get fixed.

I have Simba 0.99 installed with version 992. I followed YoHoJo's video installing guides. Everything is running on a 64-bit Win7 Home Premium.

I hope someone recognized my problem and can help me with it.
Thanks in advance!

Justin

2013-04-01 11:34:23

Calling 'SetupSRL;' will add the offsets for the Login NavBar and the In-Game NavBar. If you remove your SetupSRL it should return the correct values.

botte

2013-04-01 11:48:04

Ah thanks, that worked :)

But what does SetupSRL do then? I thought it was necessary to let the script work :/

Gu3st...

2013-04-01 14:10:14

Only if you actually use SRL. Calling SetupSRL; will just initialize all of it's functions; you can still use the functions, but be aware that some of them will not work as intended without calling SetupSRL;

botte

2013-04-02 12:21:13

Okay thanks for that clarification. If I wanted to use some of those 'SRL-functions', for example MMouse, they won't work properly (work very, very slow) if I haven't called SetupSRL;. And now again the problem of the misaligned y-values appears, as I called SetupSRL to get the MMouse working.

So is there any fix for that problem (the initial problem), while keeping SetupSRL?

wthomas

2013-04-02 16:58:22

From: botte
Okay thanks for that clarification. If I wanted to use some of those 'SRL-functions', for example MMouse, they won't work properly (work very, very slow) if I haven't called SetupSRL;. And now again the problem of the misaligned y-values appears, as I called SetupSRL to get the MMouse working.

So is there any fix for that problem (the initial problem), while keeping SetupSRL?


Use SRL-OSR for 07scape SRL is designed for eoc :)

The Killer

2013-04-02 17:29:35

From: wthomas
Use SRL-OSR for 07scape SRL is designed for eoc :)


^this :), also if you find mousemovement slow then change the mouse speed like so:
MouseSpeed := 15;

botte

2013-04-02 17:55:31

Hmm, I think it's solved. What I've done:

After having followed YoHoJo's video installing guides, I downloaded the following the SRL-OSR-folder as zip from https://github.com/SRL/SRL-OSR. Paste it in C:\Simba\Includes, and change the name of the folder from SRL-OSR-master to SRL-OSR. In the script itself:

{$I SRL/SRL.Simba}

Change it to:

{$I SRL-OSR/SRL.Simba}

Credits to The Mayor for this insight!

I didn't have to include the files of DannyRS (P07Includes) as SRL-OSR does the same job. Of course, correct me if I'm wrong.