Sir R. M8gic1an
09-13-2007, 05:57 AM
hi, i made this function for my auto p to p merchant, it'll check if your in trade screen by looking for the green from accept, for the red from decline (both with tol) and for the lack of game tabs. if you set extraSure to true it'll move to the accept button and look for the uptext. have fun and please rate :)
UPDATE: ok so i re-did a little bit of this and added in some stuff.
now you can use it for both the first trade screen SuperTradeScreen(1) and for the second SuperTradeScreen(2). there no longer is the extra sure option, i thought it was just too much.
Thank you everybody for your contributions and comments, and althought these colors don't change or move around i still preffered to use findcolortol to be sure that this function will resist any minor runescape changes :)
{************************************************* ******************************
function SuperTradeScreen(screen: integer): Boolean;
By: Rasta Magician
Description: Returns true if you're in trade screen. 1 for first screen, 2
for 2nd screen
eg: SuperTradeScreen(2) will return true if you're in the second trade screen
************************************************** *****************************}
function SuperTradeScreen(screen: integer): Boolean;
var
foundGreen, foundRed, foundBlue :boolean;
a, b:integer;
begin
if screen = 1 then
begin
if (TabExists(2))and(TabExists(3))and(TabExists(8)) then
begin
writeln('tabs still there, we are not in trade')
Result := False;
end else
begin
writeln('no tabs');
foundGreen := FindColorTolerance(a, b, 49152, 218, 168, 297, 212, 5);
foundRed := FindColorTolerance(a, b, 192, 222, 248, 294, 286, 5);
if (foundGreen)and(foundRed) then
begin
Result:= True;
writeln('we are in trade screen 1');
end else
Result := False;
end;
end;
if screen = 2 then
begin
foundGreen := FindColorTolerance(a, b, 49152, 195, 305, 250, 320, 5);
foundRed := FindColorTolerance(a, b, 192, 268, 305, 321, 320, 5);
foundBlue := FindColorTolerance(a, b, 16776960, 369, 285, 458, 315, 5);
if (foundGreen)and(foundRed)and(foundBlue) then
begin
Result:= True;
writeln('we are in trade screen 2');
end else
Result := False;
end;
end;
UPDATE: ok so i re-did a little bit of this and added in some stuff.
now you can use it for both the first trade screen SuperTradeScreen(1) and for the second SuperTradeScreen(2). there no longer is the extra sure option, i thought it was just too much.
Thank you everybody for your contributions and comments, and althought these colors don't change or move around i still preffered to use findcolortol to be sure that this function will resist any minor runescape changes :)
{************************************************* ******************************
function SuperTradeScreen(screen: integer): Boolean;
By: Rasta Magician
Description: Returns true if you're in trade screen. 1 for first screen, 2
for 2nd screen
eg: SuperTradeScreen(2) will return true if you're in the second trade screen
************************************************** *****************************}
function SuperTradeScreen(screen: integer): Boolean;
var
foundGreen, foundRed, foundBlue :boolean;
a, b:integer;
begin
if screen = 1 then
begin
if (TabExists(2))and(TabExists(3))and(TabExists(8)) then
begin
writeln('tabs still there, we are not in trade')
Result := False;
end else
begin
writeln('no tabs');
foundGreen := FindColorTolerance(a, b, 49152, 218, 168, 297, 212, 5);
foundRed := FindColorTolerance(a, b, 192, 222, 248, 294, 286, 5);
if (foundGreen)and(foundRed) then
begin
Result:= True;
writeln('we are in trade screen 1');
end else
Result := False;
end;
end;
if screen = 2 then
begin
foundGreen := FindColorTolerance(a, b, 49152, 195, 305, 250, 320, 5);
foundRed := FindColorTolerance(a, b, 192, 268, 305, 321, 320, 5);
foundBlue := FindColorTolerance(a, b, 16776960, 369, 285, 458, 315, 5);
if (foundGreen)and(foundRed)and(foundBlue) then
begin
Result:= True;
writeln('we are in trade screen 2');
end else
Result := False;
end;
end;