PDA

View Full Version : LesserDemon finder by n3s...



n3ss3s
10-18-2007, 08:02 AM
Yeh, Im trying to do lil mage tower demon caster as a side project, but its not very interesting so I thought I just release the finder...

I left the function that got me the good color instead of just putting the color there if someone wants to find out how to get very good middle of light and dark ;)

Umm finding the demon takes 78 milliseconds (time of one FindColors), so use this baby with health and care ;)


Function GetRed: Integer; // Very useful for getting middle of light and dark
Var
HSL: Array of Array of Extended;
Var
H, S, L: Extended;
Var
Colors: TIntegerArray;
Var
C: Integer;
Begin
Colors := [3162500, 5700];
SetArrayLength(HSL, 2);
SetArrayLength(HSL[0], 3);
SetArrayLength(HSL[1], 3);
For C := 0 To 1 Do
Begin
ColorToHSL(Colors[c], HSL[c][0], HSL[c][1], HSL[c][2]);
End;
H := HSL[1][0] - ((HSL[1][0] - HSL[0][0])/4);
S := HSL[1][1] - ((HSL[1][1] - HSL[0][1])/4);
L := HSL[1][2] - ((HSL[1][2] - HSL[0][2])/2);
Result := HSLToColor(H, S, L);
End;

Function FindLDemon(Var GDX, GDY: Integer): Boolean;
Var
X, Y, I, C, CTS, D: Integer;
Var
TPA: TPointArray;
Begin
If(Not(LoggedIn))Then Exit;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
D := GetRed;
FindColorsTolerance(TPA, D, MSX1, MSY1, MSX2, MSY2, 20);
MiddleTPAEx(TPA, X, Y);
FindColorsTolerance(TPA, D, X - 20, Y - 20, X + 20, Y + 20, 15);
If(GetArrayLength(TPA) >= 20)Then
Begin
MiddleTPAEx(TPA, GDX, GDY);
Result := True;
End Else
Begin
GDX := 0;
GDY := 0;
End;
ColorToleranceSpeed(CTS);
End;
End;


Enjoy!


You may use these but only if you credit me ;)

Rikje
10-18-2007, 10:38 AM
nice one n3ss3s. you're making a lot obj find fucntions atm :p

n3ss3s
10-18-2007, 10:40 AM
Yes, object finding is stealing my soul, but actually Im selling it xD

Its just too fun to be true :p

and dont think you people get away this easy, atleast one more coming today ;)


EDIT: + listening to DevilDriver's new album, having a sugar overload gets brain and fingers work faster :p

EDIT EDIT: Sugar rush also gives nice reflexs for cs :p

King of Knives
10-18-2007, 12:40 PM
n3sses, you're weird, I'm weird. What do you say: We make a kickass project together? One rule: It has to be weird.

-Knives

ZephyrsFury
10-18-2007, 12:43 PM
n3sses, you're weird, I'm weird. What do you say: We make a kickass project together? One rule: It has to be weird.

-Knives

He's not weird... just high on sugar...

King of Knives
10-18-2007, 01:34 PM
I think he's weird, but in a good way :D

Right now he's high on sugar, yes, but also weird :D

-Knives

n3ss3s
10-18-2007, 04:03 PM
:D

I ate salty food (spaghetti) and drank water, went out... Now Im only 1/4 of the 5 hours ago xD