PDA

View Full Version : Function - SuperTradeScreen



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;

elementalelf
09-13-2007, 06:17 AM
pretty good! simple, yet effective.

its a good thing you didnt use bitmaps... there are enough of them around to crash any <1.6ghz computer already when you load up SRL.

Santa_Clause
09-13-2007, 07:40 AM
Ooo, I'm making a merchanter too. A little competition couldn't hurt I guess.

Sir R. M8gic1an
09-13-2007, 07:47 AM
Ooo, I'm making a merchanter too. A little competition couldn't hurt I guess.

if you use my function i get extra points towards the win ;)

thank you elf, glad to hear you liked it :)

n3ss3s
09-13-2007, 08:18 AM
I dont like shortening functions, but sorry, it exists in amount.scar
and you could do just "result := FindText(x, y, 'Trading with', UpChars, MSX1, MSY1, MSX2, MSY2);"

Santa_Clause
09-13-2007, 10:42 AM
At the moment, I don't trust all the SRL Functions much because I don't know if they've been updated or not.

Zyt3x
09-13-2007, 12:12 PM
Agred ^^

Wizzup?
09-13-2007, 12:58 PM
Nice, but you don't need the tolerance, the colors are stable.
Like this:

Function wTradeScreen(First: Boolean): Boolean;

Begin
If First Then
Begin
if (GetColor(249, 194) = 49152) then
Result := True;
End
Else
if (GetColor(214, 313) = 49152) And (GetColor(306, 36) = 16776960) then
Result := True;
If Result Then WriteLn('wTradeScreen ' + BoolToStr(First) + ' gave True');
End;

Sir R. M8gic1an
09-13-2007, 05:52 PM
wow, thanks for all the feedback people :D

n3ss3s: i know there is TradeScreen n TradeScreen2 in amount.scar, but it only checks for one colour and i thought the colours weren't stable. :p i'll try out your 'trading with' idea tho, it looks good.

wizzup?: thank you for the info on the colour, and the re-writtign of the script :)

what did you guys think about the tab n the "extrasure" part? a little too much? would anyone actually use this function?

~RMagician

MasterKill
09-13-2007, 05:55 PM
Nice :) combenate it with my trader and all those noobs never beleve we're bots ;)

good job

Sir R. M8gic1an
10-04-2007, 04:32 PM
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 although these colors don't change or move around i still preferred to use findcolortol to be sure that this function will resist any minor runescape changes :)