WT-Fakawi
2006-03-15 17:03:17
A simple function to handle Trade. Simple Pixel & Color based. Works AFAIK flawless.
Feature: It remembers the Name of the legit Player, and interacts with it after the trade's complete.
Breaks out of FindTrade after 20 seconds. Returns True if tradetext is found.
Feature: It remembers the Name of the legit Player, and interacts with it after the trade's complete.
Breaks out of FindTrade after 20 seconds. Returns True if tradetext is found.
[FONT="Courier New"]//----------------------------------------------------------------------------//
Function FindTrade: Boolean;
var Fx, Fy:integer;
var Trader:string;
begin
if FindColor(Fx, Fy, 8388736, 21, 416, 29, 425) then
begin
Result := True;
Trader := lowercase(trim(GetTextAtEx(20, 415, 45, SmallChars, False, False, 0, 2, 8388736, 5, True, tr_NormalChars)));
if FindColor(Fx, Fy, 8388736, MCX1, MCY1, MCX1+20, MCY2) then
begin
Mouse(Fx + 2, Fy + 2, 0, 0, True);
MarkTime(Mark);
repeat
Wait(1000);
if TimeFromMark(Mark) > 20000 then break;
until ( (GetColor(246, 187) = 49152) and (GetColor(246, 261) = 192) );
Repeat
Wait(1000);
if TimeFromMark(Mark) > 20000 then break;
until (GetColor(336, 312) = 16777215);
ClickMSColor(49152,True); // CLICK FIRST ACCEPT
repeat
Wait(1000);
if TimeFromMark(Mark) > 20000 then break;
until ( (GetColor(208, 312) = 49152) and (GetColor(279, 312) = 192) );
Repeat
Wait(1000);
if TimeFromMark(Mark) > 20000 then break;
until ( GetColor(190, 42) = 16776960);
ClickMSColor(49152,True); // CLICK SECOND ACCEPT
Wait(2000);
if ((GetColor(208, 312) = 49152) and (GetColor(279, 312) = 192)) then
begin
ClickMSColor(192, True);
Typesend('nvm ' + Trader);
end
else
TypeSend('tyvm bye.' + Trader);
end;
end;
end;[/FONT]