Results 1 to 8 of 8

Thread: GetMousePos returns wrong value

  1. #1
    Join Date
    Mar 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default GetMousePos returns wrong value

    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:
    Simba Code:
    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!

  2. #2
    Join Date
    Mar 2007
    Posts
    5,125
    Mentioned
    275 Post(s)
    Quoted
    901 Post(s)

    Default

    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.

    Forum account issues? Please send me a PM

  3. #3
    Join Date
    Mar 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Ah thanks, that worked

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

  4. #4
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    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;

  5. #5
    Join Date
    Mar 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    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?

  6. #6
    Join Date
    Feb 2013
    Posts
    465
    Mentioned
    6 Post(s)
    Quoted
    221 Post(s)

    Default

    Quote Originally Posted by botte View Post
    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

  7. #7
    Join Date
    Feb 2012
    Location
    Discord
    Posts
    3,114
    Mentioned
    37 Post(s)
    Quoted
    538 Post(s)

    Default

    Quote Originally Posted by wthomas View Post
    Use SRL-OSR for 07scape SRL is designed for eoc
    ^this , also if you find mousemovement slow then change the mouse speed like so:
    Simba Code:
    MouseSpeed := 15;

  8. #8
    Join Date
    Mar 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    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:

    Simba Code:
    {$I SRL/SRL.Simba}

    Change it to:

    Simba Code:
    {$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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •