SRL Archive - Test corner

Function FindTrade: Boolean;


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.

[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]

Renax

2006-03-15 18:21:42

hmmm…intresting could be useful.

OFF-TOPIC fawki if your online can you go on msn please and thank you.

Dankness

2006-03-15 18:31:56

it could used as a sweet antiban procedure, i know some noobs try to trade you to see if your a bot or not, ill try to add it to a script to test the idea….

Krazy_Meerkat

2006-03-18 16:10:28

Nice work. It appears to just accept empty trades and trades which the other player gives you something. I'm thinking this could be a new random :D I'm putting it into the random script as we speak ;)

WT-Fakawi

2006-03-18 16:17:52

it does.

I have tried it last night. 7 succesful trades in my report!
Haven't got a clue what they gave me though :)


And yes it clicks on accept if the other player accepts, doesn't check at all if there is anything in the accept window….

Krazy_Meerkat

2006-03-18 16:28:06

I put it into the random script and was going to make it set chat back to off (from hide at that point) but your FixChat; doesn't appear to work. I tried it just then by itself to see if it would do anything but it didn't do a thing :/

WT-Fakawi

2006-03-18 16:29:58

FixChat scrolls the chat window down, just like FixBank scrolls the bank up, and FixMage scrolls the mage window

Krazy_Meerkat

2006-03-18 17:06:52

Ok thanks ;)
Is there a procedure I can call to fix the chat?

WT-Fakawi

2006-03-18 17:11:08

SetChat …

Krazy_Meerkat

2006-03-18 17:44:28

Thanks Fakawi :)
The SetChat command may need to be a little more random with waiting times but thanks a lot :D