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.
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;