SRL Archive - Research & Development Lounge

LesserDemon finder by n3s...


n3ss3s

2007-10-18 04:02:22

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

2007-10-18 06:38:21

nice one n3ss3s. you're making a lot obj find fucntions atm :p

n3ss3s

2007-10-18 06:40:16

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

2007-10-18 08:40:51

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

2007-10-18 08:43:12

From: King of Knives
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

2007-10-18 09:34:56

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

2007-10-18 12:03:19

:D

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