Issue: Mouse() then isMouseOverText

  1. issueid=441 06-24-2015 04:42 AM
    SRL Member
    Mouse() then isMouseOverText

    So I've been running this code, with different x's and y's that are 2-3 pixels on/off my intended target which was a bank chest. Trying to figure out why sometimes isMouseOverText would give me a True result even tho the TPoint I set was OFF my intended target, or a false result even tho the TPoint I set was ON my intended target
    Simba Code:
    test.start;
      mouse(point(x,y));
      if isMouseOverText(['ank chest'],20) then
        writeLn('Got it!!!!!')
      else
        writeLn('NOPE!!!!');
      writeln(test.getTime);

    I have come to a conclusion that either the mouse() function moves on to the following function before the mouse has completely stopped moving, or there is a slight delay in the game between the moment the mouse move on/off the object and the appearance/disappearance of the mouse over text. I've been testing this and finding out how much time it takes, and whether or not I get a wrong result. I concluded that the difference between a right and a wrong result varied from a difference of 10ms to upto 35ms.

    I was unable to figure out which of these was the problem.

    Anyway why I'm posting this on the SRL bug report forums, is because the functions mainscreen.findObject and bankScreen.open among other built in functions, all implement it the same way.
    Simba Code:
    Mouse(TPoint);   //Whichever TPoint it is for that function
      if isMouseOverText([OverText]) then   //Followed directly by isMouseOverText
        {Do Stuff}
    Which sometimes would cause a false positive result if the obtained TPoint is as little as 1-4 pixels off the object.

    The solution I thought of for this would be to add a small wait maybe randomRange(30,60); between both functions to counteract either of those two problems (waits for the mouse to stop moving completely) or (waits for the over text to disappear).

    I apologize if my English was not clear. If there are any points which you guys would like me to elaborate on, I shall try my best to do a better job at conveying my thoughts.


    EDIT: So I've been running a variation of the previous.
    Simba Code:
    repeat
    //tests the appearance of the over text
        mouse(point(273,147));      //cords 1 pixel on the bank chest
        wait(62);
        if isMouseOverText(['ank chest'],1) then   //set the time to 1 so the wait only comes from the wait function
          inc(p)          //positive result
        else
          inc(fn);        //false negative
    //tests the disappearance of the over text
        mouse(point(274,147));   //cords 1 pixel off the bank chest
        wait(52);
        if isMouseOverText(['ank chest'],1) then
          inc(fp)         //false positive
        else
          inc(n);         //false negative
        inc(runs);
      until runs = 500;
      writeLn(p);
      writeLn(fn);
      writeLn(n);
      writeLn(fp);

    The results I obtained were
    497 true positives
    3 false negatives
    500 true negatives
    0 false positives

    at wait times between 60-50 for the appearance and 50-40 for the disappearance, I obtained stable-ish results where it was around 93-78% for the appearance and 97-85% for the disappearance. lower than those ranges the results were false more than 50% of the time. The difference in results between the test for the appearance and test of the disappearance has led me to believe that the issue is caused by the delay in appearance/disappearance of the over text window, and not mouse() ending prematurely.
Issue Details
Issue Number 441
Project SRL Bugs and Suggestions
Status Resolved
Users able to reproduce bug 0
Users unable to reproduce bug 1
Assigned Users (none)
Tags (none)




  1. 06-26-2015 06:47 PM
    Issue Changed by The Mayor
    • Status changed from Unconfirmed to Resolved
+ Reply