SRL Archive - Research & Development Lounge

Custom Find(DTM)Symbol !


Floor66

2008-02-29 05:47:46

Please rate it 1/10 for 2nd function ever

This is my 2nd function.
Its an alternative to FindSymbol.
Plz dont be too hard on me :)

I wont add AntiRandom, seen i'd use it as walking.
If you want it, just add it urself. Without declareplayers, the randoms wont work, thats why i dont use it atm.


If you want them, you need multiplayer, cuz u need a Nick for it.
I commented the randoms.

If you use it (what i -imo- not think :P) please CREDIT!

The function:

UPDATED!

{*******************************************************************************
function FindDTMSymbol(Color, Tol, Rand : Integer; Click : Boolean): Boolean;

Author : Floor66
Description : Custom Symbol finder, uses DTMs and toleranced colors.
HowTo : Set color and tol. True for click, False for no click.
You can also set the amount of randomness when clicking.
___________________________
------------------------------------>>>>>>> Created & Tested by Floor66
*******************************************************************************}

function FindDTMSymbol(Color, Tol, Rand : Integer; Click : Boolean): Boolean;
var U, X, Y, C, SymbolDTM : Integer;
begin
begin
SymbolDTM := DTMFromString('78DA63EC606260706740012AFE8F18FE03694' +
'620FE0F048C7D4035CEA86A18191919B8A06AC0FC16A01A47026A' +
'1A31EDC250D30654E347400DC83DDE04D4F403D5B8E1570300CA5' +
'E0C6A');
end;
MarkTime(U);
if (DTMRotated(SymbolDTM, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
C := GetColor(x, y);
if (SimilarColors(C, Color, Tol)) then
begin
if (Click = True) then
begin
// FindNormalRandoms;
Mouse(x, y, Rand, Rand, True);
Writeln('Found Symbol');
Result := True;
Writeln('Took : '+IntToStr(TimeFromMark(U))+' msec');
Writeln('Symbol is located at : '+IntToStr(X)+', '+IntToStr(Y)+'.');
end else
begin
Writeln('Found Symbol');
Result := True;
Writeln('Took : '+IntToStr(TimeFromMark(U))+' msec');
Writeln('Symbol is located at : '+IntToStr(X)+', '+IntToStr(Y)+'.');
end;
end;
end;
FreeDTM(SymbolDTM);
end;


{*******************************************************************************
^^©Floor 66^^
*******************************************************************************}


Here its used: (just made these consts for handy-ness)
program SymbolCustom;
{.include srl\srl.scar}

const
SColor = 2893864; //Symbol Color
STol = 25;//Symbol tolerance (15~25 advised)
Rndm = 5;//Amount of randomness if clicking
Speed = 16;//Mouse speed
Yes = False; //Use consts or fill color, tol in at mainloop!

{*******************************************************************************
function FindDTMSymbol(Color, Tol, Rand : Integer; Click : Boolean): Boolean;

Author : Floor66
Description : Custom Symbol finder, uses DTMs and toleranced colors.
HowTo : Set color and tol. True for click, False for no click.
You can also set the amount of randomness when clicking.
___________________________
------------------------------------>>>>>>> Created & Tested by Floor66
*******************************************************************************}

function FindDTMSymbol(Color, Tol, Rand : Integer; Click : Boolean): Boolean;
var U, X, Y, C, SymbolDTM : Integer;
begin
begin
SymbolDTM := DTMFromString('78DA63EC606260706740012AFE8F18FE03694' +
'620FE0F048C7D4035CEA86A18191919B8A06AC0FC16A01A47026A' +
'1A31EDC250D30654E347400DC83DDE04D4F403D5B8E1570300CA5' +
'E0C6A');
end;
MarkTime(U);
if (DTMRotated(SymbolDTM, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
C := GetColor(x, y);
if (SimilarColors(C, Color, Tol)) then
begin
if (Click = True) then
begin
// FindNormalRandoms;
Mouse(x, y, Rand, Rand, True);
Writeln('Found Symbol');
Result := True;
Writeln('Took : '+IntToStr(TimeFromMark(U))+' msec');
Writeln('Symbol is located at : '+IntToStr(X)+', '+IntToStr(Y)+'.');
end else
begin
Writeln('Found Symbol');
Result := True;
Writeln('Took : '+IntToStr(TimeFromMark(U))+' msec');
Writeln('Symbol is located at : '+IntToStr(X)+', '+IntToStr(Y)+'.');
end;
end;
end;
FreeDTM(SymbolDTM);
end;


{*******************************************************************************
^^©Floor 66^^
*******************************************************************************}

begin
SetUpSRL;
MouseSpeed := Speed;
ActivateClient;
if (Yes = True) then
begin
FindDTMSymbol(SColor, STol, Rndm, False);
end else
FindDTMSymbol(16016699, 25, 5, False);
end.

Please give Positive Criticism.
But not too much .. i am so proud :)


–
Offtopic:

I wanna learn arrays, like u can put 3 colors, and just 1 var to call em all..

Tootoot222

2008-02-29 09:40:06

arrays are easy, you just delcare them like
var
x: Array [1..3] of Integer; // this will give you 3 varables
then call it later like
  x[1]:= 5;
Writeln(IntToStr(x[1]));
or

for i:= 1 to 3 do
begin
x[i]:= 100;
Writeln(IntToStr(x[i]));
end;


although that's only 1 of the 2 types of arrays, you could also do
program New;
var
x: Array of Integer; // this will give you unlimited varables, as long as you keep adding more to the array
i: Integer;
begin
for i:= 0 to 10 do
begin
SetArrayLength(x,Length(x)+1);
x[i]:= Random(100);
Writeln(IntToStr(x[i]));
end;
end.

Cazax

2008-02-29 09:47:27

You called your function as "FindDTMSymbol" and your function clicks on it. The name should be "FindAndClickDTMSymbol".

Tootoot222

2008-02-29 09:54:05

From: cazax
You called your function as "FindDTMSymbol" and your function clicks on it. The name should be "FindAndClickDTMSymbol".


or have a boolean for clicking on it or not

Floor66

2008-02-29 10:44:09

You mean this :P :

{*******************************************************************************
function FindDTMSymbol(Color, Tol : Integer; Click : Boolean): Boolean;

Author : Floor66
Description : Custom Symbol finder, uses DTMs and toleranced colors.
HowTo : Set color and tol. True for click. ______________________________
False for no click Tested and Created by ©Floor66
*******************************************************************************}

function FindDTMSymbol(Color, Tol : Integer; Click : Boolean): Boolean;
var U, X, Y, C, SymbolDTM : Integer;
begin
begin
SymbolDTM := DTMFromString('78DA63EC606260706740012AFE8F18FE03694' +
'620FE0F048C7D4035CEA86A18191919B8A06AC0FC16A01A47026A' +
'1A31EDC250D30654E347400DC83DDE04D4F403D5B8E1570300CA5' +
'E0C6A');
end;
MarkTime(U);
if (DTMRotated(SymbolDTM, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
C := GetColor(x, y);
if (SimilarColors(C, Color, Tol)) then
begin
if (Click = True) then
begin
Mouse(x, y, 5, 5, True);
Writeln('Found Symbol');
Result := True;
Writeln('Took : '+IntToStr(TimeFromMark(U))+' msec');
end else
begin
Writeln('Found Symbol');
Result := True;
Writeln('Took : '+IntToStr(TimeFromMark(U))+' msec');
end;
end;
end;
FreeDTM(SymbolDTM);
end;


{*******************************************************************************
^^©Floor 66^^
*******************************************************************************}

Tootoot222

2008-02-29 10:52:22

ya or, change the params to "(var x,y: Integer; Color, Tol : Integer; Click : Boolean)"

then take your x&y out so that if it doesnt' click now, it can click later (because you put the loc of the symbol into x&y)

Floor66

2008-02-29 10:58:28

If i'd do that i'd get a Variable Expected error

Idk, this'd work? :

{*******************************************************************************
function FindDTMSymbol(Color, Tol : Integer; Click : Boolean): Boolean;

Author : Floor66
Description : Custom Symbol finder, uses DTMs and toleranced colors.
HowTo : Set color and tol. True for click. ______________________________
False for no click Tested and Created by ©Floor66
*******************************************************************************}

function FindDTMSymbol(Color, Tol : Integer; Click : Boolean): Boolean;
var U, X, Y, C, SymbolDTM, SaveX, SaveY : Integer;
begin
begin
SymbolDTM := DTMFromString('78DA63EC606260706740012AFE8F18FE03694' +
'620FE0F048C7D4035CEA86A18191919B8A06AC0FC16A01A47026A' +
'1A31EDC250D30654E347400DC83DDE04D4F403D5B8E1570300CA5' +
'E0C6A');
end;
MarkTime(U);
if (DTMRotated(SymbolDTM, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
C := GetColor(x, y);
if (SimilarColors(C, Color, Tol)) then
begin
if (Click = True) then
begin
Mouse(x, y, 5, 5, True);
Writeln('Found Symbol');
Result := True;
Writeln('Took : '+IntToStr(TimeFromMark(U))+' msec');
end else
begin
Writeln('Found Symbol');
Result := True;
Writeln('Took : '+IntToStr(TimeFromMark(U))+' msec');
SaveX := X;
SaveY := Y;
Writeln('Symbol is located at : '+IntToStr(SaveX)+', '+IntToStr(SaveY)+'.');
end;
end;
end;
FreeDTM(SymbolDTM);
end;


{*******************************************************************************
^^©Floor 66^^
*******************************************************************************}

Tootoot222

2008-02-29 11:08:27

you'd have to enter a variable that you declare before, otherwise you will get that error

and no, that wouldn't work because all of the var's that you declare get erased after the procedure/function is over

it'd have to look something like this:

program Whatever;
var
BlahX,BlahY: Integer;// call these what ever you want to

function FindDTMSymbol(var x,y: Integer; Color, Tol : Integer; Click : Boolean): Boolean;
var
U, C, SymbolDTM : Integer;

begin
///blah blah, procedure code here
end;

begin
FindDTMSymbol(BlahX,BlahY,16777215,10,False);
Wait(2000);
MMouse(BlahX,BlahY,5,5);
end.


or something like that

Floor66

2008-02-29 11:13:36

This is it atm:

{*******************************************************************************
function FindDTMSymbol(Color, Tol : Integer; Click : Boolean): Boolean;

Author : Floor66
Description : Custom Symbol finder, uses DTMs and toleranced colors.
HowTo : Set color and tol. True for click. ______________________________
False for no click Tested and Created by ©Floor66
*******************************************************************************}

function FindDTMSymbol(Color, Tol : Integer; Click : Boolean): Boolean;
var U, X, Y, C, SymbolDTM : Integer;
begin
begin
SymbolDTM := DTMFromString('78DA63EC606260706740012AFE8F18FE03694' +
'620FE0F048C7D4035CEA86A18191919B8A06AC0FC16A01A47026A' +
'1A31EDC250D30654E347400DC83DDE04D4F403D5B8E1570300CA5' +
'E0C6A');
end;
MarkTime(U);
if (DTMRotated(SymbolDTM, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
C := GetColor(x, y);
if (SimilarColors(C, Color, Tol)) then
begin
if (Click = True) then
begin
Mouse(x, y, 5, 5, True);
Writeln('Found Symbol');
Result := True;
Writeln('Took : '+IntToStr(TimeFromMark(U))+' msec');
end else
begin
Writeln('Found Symbol');
Result := True;
Writeln('Took : '+IntToStr(TimeFromMark(U))+' msec');
Writeln('Symbol is located at : '+IntToStr(X)+', '+IntToStr(Y)+'.');
end;
end;
end;
FreeDTM(SymbolDTM);
end;


{*******************************************************************************
^^©Floor 66^^
*******************************************************************************}

Why'd u actually want to store the x, y.
U'd have to stand is the exact same spot where you ran the script..
I think imma keep it like this, unless there is GREAT improvement or so.

Tootoot222

2008-02-29 11:20:07

you could do a random check between finding and clicking, or make a "mistake" (click away from the symbol) for antiban, things like that

EDIT:
 begin  // why do you have a begin here? you don't need it
SymbolDTM := DTMFromString('78DA63EC606260706740012AFE8F18FE03694' +
'620FE0F048C7D4035CEA86A18191919B8A06AC0FC16A01A47026A' +
'1A31EDC250D30654E347400DC83DDE04D4F403D5B8E1570300CA5' +
'E0C6A');
end; // same with this end, it's unneeded

Floor66

2008-02-29 11:21:49

Maybe..
But just like findsymbol, this is for walking mostly.. so maybe not much randoms occur.. ill see :P
Maybe i can add a possibilty to set the amount of randomness when clickin?

Tootoot222

2008-02-29 11:25:14

work on your standers too, it looks kind of… unnatural the way you have it.

EDIT: here's a fixed up (standerd wise) version

function FindDTMSymbol(Color, Tol : Integer; Click : Boolean): Boolean;
var U, X, Y, C, SymbolDTM : Integer;
begin
SymbolDTM := DTMFromString('78DA63EC606260706740012AFE8F18FE03694' +
'620FE0F048C7D4035CEA86A18191919B8A06AC0FC16A01A47026A' +
'1A31EDC250D30654E347400DC83DDE04D4F403D5B8E1570300CA5' +
'E0C6A');
MarkTime(U);
if (DTMRotated(SymbolDTM, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
C := GetColor(x, y);
if (SimilarColors(C, Color, Tol)) then
begin
if (Click = True) then
begin
Mouse(x, y, 5, 5, True);
Writeln('Found Symbol');
Result := True;
Writeln('Took : '+IntToStr(TimeFromMark(U))+' msec');
end else
begin
Writeln('Found Symbol');
Result := True;
Writeln('Took : '+IntToStr(TimeFromMark(U))+' msec');
Writeln('Symbol is located at : '+IntToStr(X)+', '+IntToStr(Y)+'.');
end;
end;
end;
FreeDTM(SymbolDTM);
end;

Floor66

2008-02-29 11:30:09

Thx, but i like my own standards :P
Heres a version where you can decide how much randomness you click with:

{*******************************************************************************
function FindDTMSymbol(Color, Tol, Rand : Integer; Click : Boolean): Boolean;

Author : Floor66
Description : Custom Symbol finder, uses DTMs and toleranced colors.
HowTo : Set color and tol. True for click, False for no click.
You can also set the amount of randomness when clicking.
___________________________
------------------------------------>>>>>>> Created & Tested by Floor66
*******************************************************************************}

function FindDTMSymbol(Color, Tol, Rand : Integer; Click : Boolean): Boolean;
var U, X, Y, C, SymbolDTM : Integer;
begin
begin
SymbolDTM := DTMFromString('78DA63EC606260706740012AFE8F18FE03694' +
'620FE0F048C7D4035CEA86A18191919B8A06AC0FC16A01A47026A' +
'1A31EDC250D30654E347400DC83DDE04D4F403D5B8E1570300CA5' +
'E0C6A');
end;
MarkTime(U);
if (DTMRotated(SymbolDTM, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
C := GetColor(x, y);
if (SimilarColors(C, Color, Tol)) then
begin
if (Click = True) then
begin
// FindNormalRandoms;
Mouse(x, y, Rand, Rand, True);
Writeln('Found Symbol');
Result := True;
Writeln('Took : '+IntToStr(TimeFromMark(U))+' msec');
Writeln('Symbol is located at : '+IntToStr(X)+', '+IntToStr(Y)+'.');
end else
begin
Writeln('Found Symbol');
Result := True;
Writeln('Took : '+IntToStr(TimeFromMark(U))+' msec');
Writeln('Symbol is located at : '+IntToStr(X)+', '+IntToStr(Y)+'.');
end;
end;
end;
FreeDTM(SymbolDTM);
end;


{*******************************************************************************
^^©Floor 66^^
*******************************************************************************}

Floor66

2008-02-29 11:48:19

WOw, u made some edits :P
So sorry for DP, but i just need to reply.

–
Imma leave the coord saving.
–
extra begin and end kinda make you see that the SymbolDTM is declared there.

^^Yeah, kinda also didnt understand what i said there :P

Tootoot222

2008-03-01 01:25:40

if you have

begin
// FindNormalRandoms;
Mouse(x, y, Rand, Rand, True);

let's just say that it did find a random, and it takes some time for it to solve, but in that time the symbol moves, so i think you should have it relocate the symbol if it finds a random, like:

     begin
{ if(FindNormalRandoms) then
FindDTMSymbol(Color,Tol,Rand,Click);}// neat little trick, you're just using the same var's ;)
//blah blah, rest of code here
Mouse(x, y, Rand, Rand, True);

Floor66

2008-03-01 02:53:31

People who make a script shud input that then, i think.

If people are able to make a devent script, then they could edit this to their liking a bit, but just credit.