All pastes #30483 Raw Edit

BAI.scar

public text v1 · immutable
#30483 ·published 2005-11-23 03:49 UTC
rendered paste body
Function IsTextAtFromMouse(x, y, Chars: Integer; S: String): Boolean;
var
mx, my: Integer;

begin
  GetMousePos(mx, my);
  Result := IsTextAtEx(mx + x, my + y, S, 0, Chars , False, False, 0, 1, $FFFFFF);
end;

Function IsTextAtEvent(dx, dy, Row, Offset, Chars: Integer; S: String): Boolean;
var
x, y: Integer;

begin
  IsTextInAreaEx(dx div 2, dy - 200, dx, dy, x, y, 'Eve', 0, Chars, False, False, 0, 1, $FFFFFF);
  Result := IsTextAtEx(x + 52 + Offset, y + (Row * 16), S, 0, Chars, False, False, 0, 1, $FFFFFF);
end;

Procedure Init(var dx, dy: Integer; var ErrorMsg: String; var Error: Boolean; Chars: Integer; Client: String);
begin
  if not(GetSCARVersion = 203)then
  begin
    ErrorMsg := 'Error: you do not have the required software, please';
    Error := True;
    exit;
  end else if not(FindWindowTitlePart(Client, True))then
  begin
    ErrorMsg := 'Error: Could not find the client specified.';
    Error := True;
    exit;
  end;
  ActivateClient;
  GetClientDimensions(dx, dy);
  SetMouseMode(False);
  if(IsFontSmoothingEnabled)then SetFontSmoothing(False);
  Chars := LoadCharsFromFont2('Arial', 8, False, False, False, False);
end;

Procedure FindBars(var px, py, nx, ny, fx, fy, wx, wy: Integer; dx, dy: Integer);
begin
  FindColorTolerance(px, py, 2694943, dx div 2, dy - 100, (dx div 2) + 20, dy, 0);
  FindColorTolerance(nx, ny, 3644729 , dx - 200, 0, dx, dy, 5);
  FindColorTolerance(fx, fy, 3043228, dx - 200, 0, dx, dy, 5);
  FindColorTolerance(wx, wy, 10971947, dx - 200, 0, dx, dy, 5);
end;



Procedure FindTile(var TileX, TileY: Integer; dx, dy, Chars: Integer; Tile: String);
var
x, y, rep, n: Integer;
begin
  MoveMouseSmooth(dx div 2, dy div 2);
  while not(IsTextAtFromMouse(15, 4, Chars, Tile))and(rep < 150)do
  begin
    GetMousePos(x, y);
    if(x < 100)or(y < 100)or(x > dx - 200)or(y > dy - 160)or(n > 14)then
    begin
      MoveMouseSmooth(dx div 2 + Random(3), dy div 2 - Random(3));
      GetMousePos(x, y);
      n := 2;
    end;
    MoveMouseSmooth(x + (n * Random(10)), y - (n * Random(10)));
    wait(150);
    if(IsTextAtFromMouse(15, 4, Chars, Tile)) then break;
    GetMousePos(x, y);
    MoveMouseSmooth(x - Random(2), y + (n * Random(15)));
    wait(150);
    if(IsTextAtFromMouse(15, 4, Chars, Tile)) then break;
    GetMousePos(x, y);
    MoveMouseSmooth(x - (n * Random(10)), y + Random(2));
    wait(150);
    if(IsTextAtFromMouse(15, 4, Chars, Tile)) then break;
    GetMousePos(x, y);
    MoveMouseSmooth(x - Random(2), y - (n * Random(10)));
    wait(150);
    if(IsTextAtFromMouse(15, 4, Chars, Tile))then break;
    wait(150);
    rep := rep + 1;
    n := n + 1;
  end;
  GetMousePos(TileX, TileY);
end;
Procedure GetMenu(var ErrorMsg: String; x, y, px, py, nx, ny, Option, SubOption, Chars: Integer; Name: String; Progress, Stamina: Boolean);
var
xx, yy, rep: Integer;

begin
   MoveMouseSmooth(x, y);
   Wait(300);
   if not(IsTextAtFromMouse(15, 4, Chars, Name))then
   begin
     ErrorMsg := 'Error: Could not find Wall! Please edit your constants';
     //Error := True
     exit;
   end;
   while not(IsTextAtFromMouse(-24 ,-6, Chars, Name))do
    begin
      ClickMouse(x, y, False);
      MoveMouseSmooth(x + 20, y);
      Wait(50);
    end;
    while not(IsTextAtFromMouse(-24, 11, Chars, 'Exa'))do Wait(50);
    GetMousePos(x, y);
    MoveMouseSmooth(x, y + (Option * 16));
    Wait(100);
    GetMousePos(x, y);
    if not(SubOption = 0)then
    begin
      SubOption := SubOption - 1;
      MoveMouse(x + 85, y);
      Wait(100);
      GetMousePos(x, y);
      MoveMouseSmooth(x, y + (SubOption * 16));
      Wait(100);
      GetMousePos(x, y);
    end;
    if(Progress)then while(GetColor(px, py) = 13408665)do Wait(100);
    if(Stamina)then while not(FindColorTolerance(xx, yy, 3644729, nx, ny , nx, ny + 10, 50))do Wait(100);
    ClickMouse(x, y, True);
    if(Progress)then
    begin
      while(FindColor(x, y, 2694943, px, py, px, py))and(rep < 10)do
      begin
        wait(500);
        rep := rep + 1;
      end;
    end;
end;

Procedure DoubleClick(x, y: Integer);
begin
MoveMouseSmoothEx(x, y, 2, 4, 51, 18, 9);
Wait(50);
ClickMouse(x, y, True);
Wait(20);
ClickMouse(x, y, True);
end;

Procedure DragMouse(x1, y1, x2, y2: Integer; Left: Boolean);
begin
HoldMouse(x1, y1, Left);
MoveMouseSmoothEx(x2, y2, 2, 4, 51, 18, 9);
Wait(100);
ReleaseMouse(x2, y2, Left);
end;