Results 1 to 23 of 23

Thread: FixGraphics fix

  1. #1
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default FixGraphics fix

    I believe everything is changed that needs to be. I tested and it worked fine.

    This sets the graphics mode to "Safe mode" as described by RS mods, Safe Mode is like the old Standard detail mode.


    SCAR Code:
    {*******************************************************************************
    Procedure FixGraphics;
    By: Rasta Magician fixed by TRiLeZ
    Rev: 224
    Date: 02 Sep 09
    Description: Fixes the Graphic Options if LoggedIn
    *******************************************************************************}

    Procedure FixGraphics;
    var
      TPA: TPointArray;
      TB: TBox;
      TP, TP2: TPoint;
      i, x, y: integer;
    begin
    //This procedure is not versatile, just gets the needed job done
      if (not LoggedIn) then exit;
      CloseWindow;

      if (not FindColor(x, y, 0, 7, 460, 69, 474)) then
        if (not ClickContinue(True, True)) then
          Mouse(MMCX, MMCY, 2, 2, True);

      i := 0;
      while (not FindTextTPA(2071039, 0, MSX1, MSY1, MSX2, MSY2, 'Graphics Settings', UpChars, Nothing)) and (LoggedIn) do
      begin
        GameTab(tab_Options);
        MouseBox(605, 258, 623, 277, 1);
        Wait(1000 + Random(500));
        Inc(i);
        if (i > 3) then
        begin
          srl_Warn('SetGraphics', 'Could not open Graphics Options screen', warn_Warning);
          CloseWindow;
          Exit;
        end;
      end;

      if not (GetColor(160, 82) = SD_Color) then
      begin
        //Checks for the green arrow, clicks middle of box
        Mouse(138, 68, 5, 5, True);
        if not WaitColor(160, 82, SD_Color, 0, 2000) then
          FixGraphics;
      end;

      if not (GetColor(157, 156) = Fixed_Color) then
      begin
        //checks for the yellow color in Fixed Screen sizing
        //clicks middle of box
        Mouse(168, 138, 5, 5, True);
        if not WaitColor(157, 174, Fixed_Color, 0, 2000) then
          FixGraphics;
      end;

      {FindColors(TPA, ScreenSize_Color, ScreenSize_Box_x1,
                 ScreenSize_Box_y1, ScreenSize_Box_x2,
                 ScreenSize_Box_y2);

      if not (Length(TPA) = ScreenSize_Count) then
      begin
        //clicks middle of box
        Mouse(433, 170, 7, 2, True);
        //waits for menu
        if WaitColor(475, 162, 8388607, 0, 500) then
          Mouse(431, 185, 7, 2, True); //clicks 800x600
      end;}


      if not (GetColor(235, 199) = Bright_Color) then
      begin
        //checks for blue ball, clicks Max Brightness
        Mouse(235, 199, 3, 3, True);
        if not WaitColor(235, 199, Bright_Color, 0, 3000) then
          FixGraphics;
      end;

      //now onto the advanced options
      //each box is 15px vertically
      //counting from the first layer of brown on top
      //and first layer of brown on bottom

      for i:= 0 to 5 do //6 options on left column
      begin
        if FindColor(x, y, WhiteText_Color, 188, 224+16*i, 219, 239+16*i) then
        begin
          Mouse(188, 224+15*i+7, 40, 3, True); //click middle of box
          if WaitColor(188, 224+(16*i), MenuYellow_Color, 0, 1000) then
          begin
            FindColors(TPA, MenuYellow_Color, 172, 224+16*i, 248, 224+16*i+16*2);
            //x - 172 = start of menu ; x - 248 = end of menu
            //224+15*i+15*2 = start of menu + 2 options
            TB := GetTPABounds(TPA);  //--> scar fuck up
            if not FindColors(TPA, YellowText_Color, TB.x1, TB.y1, TB.x2, TB.y2) then
            writeln(inttostr(Length(TPA)));
            TP := MiddleTPA(TPA);
            Mouse(TP.x, TP.y, 3, 3, True);
            if not WaitColor(188, 224+16*i, MenuBrown_Color, 0, 500+Integer(i=4)*3000) then
              FixGraphics;
          end else
            FixGraphics;
        end;
        wait(random(500));
      end;

      for i := 0 to 5 do //6 options on right column
      begin
        if FindColor(x, y, WhiteText_Color, 437, 208+16*i, 460, 223+16*i) then
        begin
          Mouse(437, 208+16*i+7, 40, 3, True); //click middle of box
          if WaitColor(437, 208+16*i, MenuYellow_Color, 0, 500) then
          begin
            FindColors(TPA, MenuYellow_Color, 418, 208+16*i, 494, 208+16*i+16*3)
            //x - 418 = start of menu ; x - 494 = end of menu
            //208+15*i+15*3 = start of menu + 3 options
            TB := GetTPABounds(TPA);   // --> Scar fuck up.
            //TB := IntToBox(418, 208+15*i, 494, 208+15*i+15*2);
            FindColors(TPA, YellowText_Color, TB.x1, TB.y1, TB.x2, TB.y2);
            TP := Point(418, 208+16*i);
            SortTPAFrom(TPA, TP);     //all this TPA manipulation is needed because
            TP := TPA[0];             //animations have 3 options, while the others have 2
            TP2 := MiddleTPA(TPA);
            Mouse(TP2.x, TP.y+3, 3, 3, True);
            if not WaitColor(188, 224+15*i, MenuBrown_Color, 0, 5000) then
              FixGraphics;
          end else FixGraphics;
          wait(random(500));
        end;
      end;
      Mouse(491, 22, 2, 2, True); //CloseWindow;
    end;
    I just needed to update some coords in the one above.


    This should be placed in Gametab.scar as the color when logged out is different than the color when logged in for the green check mark.
    SCAR Code:
    SM_Color = 3721285;
    and this would be the new Login_SetGraphics located in Login.scar:
    SCAR Code:
    procedure Login_SetGraphics(Brightness: Integer);
    var
      T, x, y, tx, ty, GraphicsMask, i: Integer;
      P: TPoint;
    begin
      if (LoggedIn) then Exit;
      GraphicsMask := BitmapFromString(20, 8, 'beNpjYPiPBBiQwH9UgFUcmYumA' +
           'JOLJoipGNMNuMwkQy8eR+LRi1U7JhuPdvx2YXUYZvgQExdYtTAAAF' +
           'Km3SM=');
      TypeByte(vk_Escape);                                //347, 273, 393, 292
      T := GetSystemTime;
      while (not(FindBitmapMaskTolerance(GraphicsMask, X, Y, 279, 272, 483, 352, 0, 0))) and (GetSystemTime - T < 5000) do
        Wait(100);
      if (FindBitmapMaskTolerance(GraphicsMask, X, Y, 279, 272, 483, 352, 0, 0)) then
        Mouse(X - 20, Y + 3, 50, 5, True)
      else
      begin
        FreeBitmap(GraphicsMask);
        Exit;
      end;
      Wait(100);
      if not (GetColor(282, 177) = SM_Color) then
      for i := 0 to 2 do
      begin
        //Checks for the green arrow, clicks middle of box
        Mouse(260, 162, 5, 5, True);
        if WaitColor(282, 177, SM_Color, 0, 2000) then
          Break;
        if i = 2 then
        begin
          srl_Warn('SetGraphics', 'Failed to select Safe Mode', warn_Warning);
          Exit;
        end;
      end;
      if (Brightness > 4) then
        srl_Warn('Login_SetGraphics', 'Brightness must be between 0 and 4', warn_AllVersions)
      else
      if (Brightness <> 0) then
      begin
        x := 0;
        repeat
          P := Point(262 + (Brightness - 1) * 32, 310);
          if (GetColor(P.x, P.y) <> 16683152) then
          begin
            Mouse(P.x - 2, P.y, 3, 3, True);
            if WaitColor(P.x, P.Y, 16683152, 1, 1000) then
              break;
            Inc(x);
          end else
            break;
        until(x >= 5)
      end;
      repeat
        if FindColor(x, y, 16777215, 143, 287, 621, 429) then
        begin
          Mouse(x + 10, y + 3, 10, 7, True);
          getmousepos(tx, ty);
          mouse(tx, ty + 10, 4, 4, true);
          wait(300);
        end;
      until(not(FindColor(x, y, 16777215, 143, 287, 621, 429)));
      Wait(100);
      TypeByte(vk_Escape);
      FreeBitmap(GraphicsMask);
    end;

    Like I said, currently this is only good for making sure you are in Safe mode before starting a script. If you aren't, and the script has to select safe mode for you, it will lose the Client.
    Last edited by NCDS; 02-09-2010 at 02:36 AM.

  2. #2
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    The only problem is that, are you sure that it still works after setting safe-mode, as the runescape handle could change, causing you to lose active 'ness' of the client.

    Looks good btw

  3. #3
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    I only tested the function it self, not inside another script or anything.

    I will, then I'll post what if it still works or not..

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

    Default

    You would want to set it to Safe Mode by the way. Check the thread in RS has been updated for the differences

  5. #5
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Zyt3x View Post
    You would want to set it to Safe Mode by the way. Check the thread in RS has been updated for the differences
    That's what this update is
    It does set/make sure you are set to SafeMode.

    However, as Naum posted the RS handle changes when you switch to SafeMode so you will need to already be in safemode to be able to auto. This will just make sure you are.

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

    Default

    Quote Originally Posted by NCDS View Post
    That's what this update is
    It does set/make sure you are set to SafeMode.

    However, as Naum posted the RS handle changes when you switch to SafeMode so you will need to already be in safemode to be able to auto. This will just make sure you are.
    Ah, okay
    Just making sure

  7. #7
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    This only works if it's already in safe mode.

  8. #8
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by IceFire908 View Post
    This only works if it's already in safe mode.
    Quote Originally Posted by NCDS View Post
    That's what this update is
    It does set/make sure you are set to SafeMode.

    However, as Naum posted the RS handle changes when you switch to SafeMode so you will need to already be in safemode to be able to auto. This will just make sure you are.


    There's really no other way to do it that I know of..?

  9. #9
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by NCDS View Post


    There's really no other way to do it that I know of..?
    SCAR Code:
    {$IFNDEF SRL_SMART}
        FindWindowBySize(766, 504);
        Wait(500 + Random(250));
        ActivateClient;
        Wait(500 + Random(250));
      {$ENDIF}

    Would be good if this could at least switch from standard and HD (fixed) to safe mode, though I'm not exactly how sure all this would work.

  10. #10
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by IceFire908 View Post
    SCAR Code:
    {$IFNDEF SRL_SMART}
        FindWindowBySize(766, 504);
        Wait(500 + Random(250));
        ActivateClient;
        Wait(500 + Random(250));
      {$ENDIF}

    Would be good if this could at least switch from standard and HD (fixed) to safe mode, though I'm not exactly how sure all this would work.
    It switches it fine (unless something has changed since this morning, which I will look into right now) the only problem was losing the client after switching.

    I don't know about the bit you posted however, I tried a simple ActivateClient earlier and it hadn't worked but I'll mess with it a little now.



    Edit: yeah it still sets Safe mode fine for me, just then loses the client still ofc.
    Last edited by NCDS; 02-09-2010 at 01:00 AM.

  11. #11
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    It switches it fine (unless something has changed since this morning, which I will look into right now) the only problem was losing the client after switching.

    I don't know about the bit you posted however, I tried a simple ActivateClient earlier and it hadn't worked but I'll mess with it a little now.
    ActivateClient alone would not work because

    1) You could be using SMART, and it's unneeded alltogether.
    2) You loose the current handle, so it doesn't know what to activate.

    So you need {$DEFINE ect... and FindWindowBySize to get the new handle and activate (if not smart) I'm guessing the reason it doesn't work atm with switching is because the colors are different in SM, SD, and HD for the cords you are using.

  12. #12
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by IceFire908 View Post
    ActivateClient alone would not work because

    1) You could be using SMART, and it's unneeded alltogether.
    2) You loose the current handle, so it doesn't know what to activate.

    So you need {$DEFINE ect... and FindWindowBySize to get the new handle and activate (if not smart) I'm guessing the reason it doesn't work atm with switching is because the colors are different in SM, SD, and HD for the cords you are using.
    I just tried it in Standard Detail and it switched to Safe mode perfectly fine.

    I'll start messing with ways to find the client again I suppose..

  13. #13
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Ok I have the Login_SetGraphics working fine now and am starting to work with re-activating the client now. However, when using SMART if you are not already in Safe mode, nothing works therefor I believe if you plan to use SMART you will need to set Safe mode before hand.

    I'll continue messing with a non SMART fix now..

  14. #14
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    Ok I have the Login_SetGraphics working fine now and am starting to work with re-activating the client now. However, when using SMART if you are not already in Safe mode, nothing works therefor I believe if you plan to use SMART you will need to set Safe mode before hand.

    I'll continue messing with a non SMART fix now..
    Hmmm....

    For SMART it might just be best to do

    SCAR Code:
    {$IFNDEF SRL_SMART}
        FindWindowBySize(766, 504);
        Wait(500 + Random(250));
        ActivateClient;
        Wait(500 + Random(250));
      {$ELSE}
        WriteLn('Warning! Please restart SMART in RuneScape Safe Mode!');
        TerminateScript;
      {$ENDIF}

  15. #15
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    SCAR Code:
    GetClientDimensions(x, y);
    if (x = HD_X)and(y = HD_Y) then
      Mode := HD
    else if (x = SM_X)and(y = SM_Y) then
      Mode := SM
    else
      Mode := SD;

    case Mode of
      HD: Params := [.......];
      SD: Params := [.......];
      SM: Params := [.......];
    end;

    About how to refind it... Icefire's way seems to be the best so far, can't really think of any other atm.

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  16. #16
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Rasta Magician View Post
    SCAR Code:
    GetClientDimensions(x, y);
    if (x = HD_X)and(y = HD_Y) then
      Mode := HD
    else if (x = SM_X)and(y = SM_Y) then
      Mode := SM
    else
      Mode := SD;

    case Mode of
      HD: Params := [.......];
      SD: Params := [.......];
      SM: Params := [.......];
    end;
    So you want it to be able to select any Graphics level? I was under the impression that we were just going to use Safe mode for autoing?

    About how to refind it... Icefire's way seems to be the best so far, can't really think of any other atm.
    I'm still working on that :/

    Edit: I don't think loading any other Graphics level in SMART is going to work even if we try and change the setting at login. The screen stays flashing and SCAR can't seem to do anything about it :/

    I'm going to update the first post with what I have right now which is everything working except for re-targeting the client.
    Last edited by NCDS; 02-09-2010 at 02:26 AM.

  17. #17
    Join Date
    Feb 2009
    Location
    Hungary (GMT + 1)
    Posts
    1,774
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    When I start smart not in sd(or sm now) I can do whatever I want. It's just flashing a bit but you can set the graphics to sm. I haven't tried it with a script just by hand however. So maybe blind coordinate clicking? Or smart not even works when flashing? I never had those problems but I read that mouse not working in it(by script).

  18. #18
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Sabzi View Post
    When I start smart not in sd(or sm now) I can do whatever I want. It's just flashing a bit but you can set the graphics to sm. I haven't tried it with a script just by hand however. So maybe blind coordinate clicking? Or smart not even works when flashing? I never had those problems but I read that mouse not working in it(by script).
    That's what I meant was that because of the flashing the script wouldn't work. Me and Icefire have been discussing alternatives and I'll try and see what I can do today.

  19. #19
    Join Date
    Dec 2009
    Location
    Newcastle, Australia
    Posts
    888
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    now whilst I am not an expert on SMART, what about restarting Smart, after we set it to safe mode, that would at least get smart working...

  20. #20
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Bad Boy JH View Post
    now whilst I am not an expert on SMART, what about restarting Smart, after we set it to safe mode, that would at least get smart working...
    Hmm.. I will mess with that idea and see what happens.

    Thanks for the suggestion. Though, I'm not sure how that would sit with the Dev's, having to load SMART twice..

  21. #21
    Join Date
    Dec 2009
    Location
    Newcastle, Australia
    Posts
    888
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Until such a time as we have an alternate solution, I think its a good idea...

  22. #22
    Join Date
    Feb 2009
    Location
    Hungary (GMT + 1)
    Posts
    1,774
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Bad Boy JH View Post
    Until such a time as we have an alternate solution, I think its a good idea...
    Much better then just terminating the script. So I would say do that.

  23. #23
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    I will talk with Dev's about it but for now, just make sure your in Safemode beforehand if you plan to auto.

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
  •