SRL Archive - SRL Archives

SetGraphics (while logged in)


Sir R. M8gic1an

2009-09-02 22:53:17

I have already fixed this, but i haven't commited it yet. I'll commit it when the one that fixes the graphics while not loggedin is ready.

This is very rudimentary, but it gets the job done right.


const
SD_Color = 3721541;
Fixed_Color = 8388607;
ScreenSize_Color = 2070783;
ScreenSize_Count = 142;
//ScreenSize_Box = IntToBox(403, 163, 459, 176);
ScreenSize_Box_x1 = 403;
ScreenSize_Box_y1 = 163;
ScreenSize_Box_x2 = 459;
ScreenSize_Box_y2 = 176;
Bright_Color = 15802143;
WhiteText_Color = 16777215;
YellowText_Color = 2070783;
MenuYellow_Color = 8388607;
MenuBrown_Color = 468031;

{*******************************************************************************
Procedure FixGraphics;
By: Rasta Magician
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(2070753, 0, MSX1, MSY1, MSX2, MSY2, 'Graphics Options', UpChars, Nothing)) and (LoggedIn) do
begin
GameTab(tab_Options);
MouseBox(605, 258, 623, 277, 1);
Wait(500 + Random(200));
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(219, 85) = SD_Color) then
begin
//Checks for the green arrow, clicks middle of box
Mouse(219, 85, 5, 5, True);
if not WaitColor(219, 85, SD_Color, 0, 2000) then
FixGraphics;
end;

if not (GetColor(157, 174) = 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(234, 214) = Bright_Color) then
begin
//checks for blue ball, clicks Max Brightness
Mouse(232, 219, 3, 3, True);
if not WaitColor(234, 214, 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(Length(TPA));
DebugTPA(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;

~RM

spicynachos2

2009-09-03 04:03:40

I tried reviewing that and it looks fairly well done. I am not sure though, isn't setgraphix the procedure that sets all of the advanced options? or am i wrong. judging by the length i would figure that yours does not do the advanced options but i am not sure about that.