Code:
procedure InsertDetails;
var
i: Integer;
UB, PB: TBox;
Boxes: TBoxArray;
begin
UB := IntToBox(278, 202 + Y_OFFSET_LOGIN, 487, 222 + Y_OFFSET_LOGIN); // Username
PB := IntToBox(276, 249 + Y_OFFSET_LOGIN, 486, 268 + Y_OFFSET_LOGIN); // Password
Boxes := [UB, PB];
for i:=0 to high(Boxes) do
begin
MouseBox(Boxes[i].X1, Boxes[i].Y1, Boxes[i].X2, Boxes[i].Y2, 1);
Wait(RandomRange(300, 600));
case i of
0: TypeSendEx(Players[CurrentPlayer].Name, False);
1: TypeSend(Players[CurrentPlayer].Pass);
end;
Wait(RandomRange(300, 600));
end;
//Mousebox(306, 292 + Y_OFFSET_LOGIN, 460, 308 + Y_OFFSET_LOGIN, 1); // Login
end;
procedure CloseOneWeekScreen;
var
Lock, X, Y, T: Integer;
begin
Lock := BitmapFromString(25, 16, 'meJzTiyiyaJ5jU9qu3rxEZsVt2RW3LTfccV96BA9Sn3lYFqwSiPQnblOrnunUNssiNM512iagXoi40OTjQNMgSJYQAiqGs4EmpJ5+AXQMUBAXQtOLR5nLhqtA5+FXA/SCdmoNfhuBCOhxPEYBvWkz/aC4giojA4O4vCp+04BGAQMcyOBv3YImBRQBhgAwRoDmABEHGwvQbbhUohmFiYC+85pyQN7QHGgUkIS4CqtKiFFAu7DKQhAwMMOnLgP6Eeg8YBrApYwYo4B+dMoq5ebmBipTmLgbj1HAUMVjFFCB5aLTcA/iMoq3YimQBKZPiFFALiYCGmXYvljLyVvO0BxIAsMKl0qIUXoRRXgUAF0CdDkQAVMXLmXIRuFSAFcG9wgeNTb9qyFG8ZTOpQQhG0UJghsFyV+UI8/elQDhcgZz');
MarkTime(T);
while TimeFromMark(T) < 5000 do
begin
if FindBitmapToleranceIn(Lock, X, Y, 258, 205 + Y_OFFSET_LOGIN, 507, 398 + Y_OFFSET_LOGIN, 20) then
begin
Mousebox(309, 368 + Y_OFFSET_LOGIN, 457, 383 + Y_OFFSET_LOGIN, 1); // close coords
Wait(RandomRange(500, 1000));
break;
end;
Wait(RandomRange(250, 500));
end;
Wait(RandomRange(2000, 3000));
FreeBitmap(Lock);
end;
procedure OpenWorlds;
begin
Mousebox(169, 76 + Y_OFFSET_LOGIN, 264, 97 + Y_OFFSET_LOGIN, 1); // Coords
Wait(RandomRange(1000, 2000));
end;
function FindTheWorld(W: integer): Boolean;
Var
WPos, SPos, CurPos, i, H, CurW, TextColor: integer;
BarHeight, WorldsOnScreen: integer;
p: TPoint;
TPA, TPA2, TPA3: TPointArray;
SP, SB: TBox;
begin
WS_CurrentWorld(CurW);
if (W = CurW) then
begin
Result := True;
WriteLn('Already on world ' + IntToStr(W));
Exit;
end;
if not WorldsOrdered then
begin
if not OrderWorlds('w', True) then
begin
Writeln('FindWorld: Could not order worlds properly.');
Exit;
end;
WorldsOrdered := true;
wait(400+random(200));
end;
FindColorsTolerance(TPA, SRL_WS_SCROLLCOLOR1, 680, 1, 705, 500, 0);//These coords determine the scroll bars general area, it deviates everything.
SB := GetTPABounds(TPA);
With SB do
begin
FindColorsTolerance(TPA2, SRL_WS_SCROLLCOLOR1, x1+3, y1, x1+3, y2, 0);//SRL_WS_SCROLLCOLOR1
FindColorsTolerance(TPA3, SRL_WS_SCROLLCOLOR2, x1+3, y1, x1+3, y2, 0);//SRL_WS_SCROLLCOLOR2
end;
TPA2 := CombineTPA(TPA2, TPA3);
SP := GetTPABounds(TPA2);
BarHeight := (SP.Y2-SP.Y1);
WorldsOnScreen := (SB.y2-SB.y1+32) div 42;//This is HALF of the worlds on screen. I don't use the full amount.
if Length(WorldArray) < 1 then
LoadWorldArrays;
WPos := -1;
H := High(WorldArray);
for i := 0 to H do
if (WorldArray[i].Number = W) then
begin
WPos := i;
if i < (WorldsOnScreen) then
WPos := 0;
if i > (H+1-(WorldsOnScreen)) then
WPos := (H+1);
if WorldArray[i].Members then
TextColor := SRL_WS_YELLOWCOLOR
else
TextColor := SRL_WS_WHITECOLOR;
Break;
end;
if WPos = -1 then
begin
srl_Warn('FindWorld', 'World '+IntToStr(W)+' does not exist in worlds.ini ', warn_AllVersions);
Exit;
end;
SPos := (SB.y1+BarHeight div 2) + (WPos)*(SB.y2-SB.y1-BarHeight) div (H+1-WorldsOnScreen);//need the 0.0 to make it extended inside ()
CurPos := (SP.y1 + BarHeight div 2);
Debugln('SCROLLINFO: CurPos: '+ToStr(CurPos)+' WPos: '+ToStr(WPos)+' H+1: '+ToSTr(H+1)+' SPos: '+ToStr(SPos));
if InRange(SPos, CurPos - BarHeight, CurPos + BarHeight) then
begin//if its too close the scroll bar won't move to correct position
if (CurPos < ((SB.y1+BarHeight/2)+ (SB.y2-SB.y1-BarHeight)/2)) then//half point
Mouse((SB.x1 + (SB.x2-SB.x1)div 2), SB.y2, 0, 0, mouse_left)
else
Mouse((SB.x1 + (SB.x2-SB.x1)div 2), SB.y1, 0, 0, mouse_left);
end;
//Writeln('SPos := '+ToStr(SPos));
Mouse((SB.x1 + (SB.x2-SB.x1)div 2), SPos, 0, 0, mouse_left);
wait(300+Random(100));
Result := IsTextInAreaEx(84, 134, 134, 440, p.X, p.Y, IntToStr(W) + ' ', 0, StatChars, False, False, -1, 2, TextColor);
end;
procedure PlayWorld(W: integer);
var
x, y, xx, yy, CurW: integer;
WRec: TWorld;
begin
WS_CurrentWorld(CurW);
if (W = CurW) then
begin
WriteLn('Already on world ' + IntToStr(W));
Exit;
end;
if FindTheWorld(W) then
begin
wait(200 + random(200));
if GetWorldInfo(W, WRec) then
begin
Writeln('World: '+inttostr(WRec.Number)+', Players: '+inttostr(WRec.PlayerNo)+', Members: '+Booltostr(WRec.Members)+', PvP: '+Booltostr(WRec.PVP));
if FindText(x, y, ' '+inttostr(W)+' ', StatChars, 84, 134, 140, 440) then
begin
MMouse(x, y, 400, 4);
GetMousePos(x, y);
wait(400+random(100));
if FindColor(xx, yy, 6316128, x-20, y-2, x+20, y+2) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, mouse_left);
if FindColor(xx, yy, 19890, x-20, y-2, x+20, y+2) then
Writeln('World '+inttostr(W)+' selected.');
end;
end;
end else
if WRec.PlayerNo = -2 then
WriteLn('World ' + IntToStr(W) + ' is FULL.')
else
WriteLn('World ' + IntToStr(W) + ' is OFFLINE.')
end else
WriteLn('Failed to find World ' + IntToStr(W) + '!');
end;
procedure TalkFast(Text: String; PressEnter: Boolean);
var
i: Integer;
begin
for i:=1 to length(Text) do
SendKeys(Text[i], 50 + Random(50), 50 + Random(50));
if (PressEnter) then
TypeByte(VK_RETURN);
end;
Mainloop something like