SRL Archive - Help and Support

Need a little function for my tut runner


Pure1993

2008-07-29 08:19:27

Hey
Well, I made my tutorial island runner runner (well, it is no longer an island, but heck) actually create people mostly randomly, but yet with good looks, the only problem now is that the start default haircut is random, so there is no way to predict how often it needs to click the "next" button in order to get to a specific hairstyle. So I was wondering if anyone could make a function (or give me a hint on how to do it), that checks if the person is bald (I would create a little loop that clicks the next haircut until it reaches the bald cut, the same with the facial hair cut). That way I'd have a base haircut from which I can continue clicking through everything. same thing with the facial hair.
Thanks a lot! :)
-Pure1993

Nava2

2008-07-29 09:39:22

Would you use canvas's maybe, doing that whole remove colors thing?

In that way, you could use that to detect whether there is hair or not. Unless the skin colour could be mixed up with the hair, in that case my idea doesn't work.

P.S. I have NO idea how to do that stuff :)

-Nava2

EvilChicken!

2008-07-29 10:36:06

Search for a small bitmap with tolerance at x and y.

Have two bitmaps, one for the white and one for the black skin.

ShowerThoughts

2008-07-29 10:48:17

hmm, tpa?

Pure1993

2008-07-29 12:54:41

@Hermpie: I have already tried TPA's, but the thing is some beards have so many color pixels which are similar to the hair colors, that one big beard would sum up for a medium hairstyle and beard, so no luck there… :(

@Evilchicken: Do you mean bitmaps of the upper and lower head? Well, correct me if I'm wrong, but I think the moving of the head would cause the bitmap to fail, wouldn't it? Because in the new tutorial "island", the head is constantly moving… would high enough tolerance be able to solve that?

@ Nava: I have never looked into canvas before, so I have never used them and have no clue what they are doing, but I guess I'll look into them now. About the Hair and Skin color, if worst came to worst I'll just make it click the black hair color and white skin right at the beginning, and check from that point onwards, the only problem would be that it would probably be way too detectable, but heck, this is the first time ever that I finished a script that actually works and is of some quality, so if finishing my means making the script easy to detect, so be it. :D

ShowerThoughts

2008-07-29 14:47:28

From: Pure1993
@Hermpie: I have already tried TPA's, but the thing is some beards have so many color pixels which are similar to the hair colors, that one big beard would sum up for a medium hairstyle and beard, so no luck there… :(

@Evilchicken: Do you mean bitmaps of the upper and lower head? Well, correct me if I'm wrong, but I think the moving of the head would cause the bitmap to fail, wouldn't it? Because in the new tutorial "island", the head is constantly moving… would high enough tolerance be able to solve that?

@ Nava: I have never looked into canvas before, so I have never used them and have no clue what they are doing, but I guess I'll look into them now. About the Hair and Skin color, if worst came to worst I'll just make it click the black hair color and white skin right at the beginning, and check from that point onwards, the only problem would be that it would probably be way too detectable, but heck, this is the first time ever that I finished a script that actually works and is of some quality, so if finishing my means making the script easy to detect, so be it. :D


It might because beards are low u know ;) the head moves but not THAT much ;)

Pure1993

2008-07-29 16:00:03

Well, I have never worked closely with bitmaps, so I have no clue as to how good their tolerance works. About the Beards and hair style.. do you mean to divide the showing screen into upper and lower half and then search for them? Well, yeah, I thought of that, but… um… I think I had a reason why I didn't try it, I just don't remember it now… or did I just loose my patience and startet playing GTA? ;)
Well, now I am back again and will try out the TPA, then the Bitmap, and then then canvas thing. Wish me luck :D

Pure1993

2008-07-30 03:40:34

Okay hermpie, you get a cookie, it worked with TPA's, and wasn't hard at all, here is the tiny function:

function MakeBald: Boolean;
var
P, Q, R: TPointArray;
c: Integer;
begin
ColorHair([25]);
c:= 0;
repeat
c := c + 1
Wait(350 + random( 120) - random(20));
FindColorsTolerance( P, 2895152, 45, 92, 242, 136, 4);
FindColorsTolerance( Q, 4144964, 45, 92, 242, 136, 10);
FindColorsTolerance( R, 2171172, 45, 92, 242, 136, 10);
if ((High(P) + High(Q) + High(R)) < 100) then
begin
Result := True;
Writeln(' Baldification process successfully finished! :D');
Exit;
end;
MouseBox( 206, 247, 230, 262, 1);
Wait( 620 +random(210) -random(150));
until c > 15;
Writeln(' The bald function failed!');
Result := False;
end;
Well, I am doing a complete rewrite as of now (more randomness, less lagging, safer walking, safer waiting through cut scenes, stuff like that :D). I hope to get it finished today (even though I have only completed all needed functions for walking and such, so I am about 1k lines behind my old script atm, wish me luck ^^).

Edit: oops, sorry for double posting, I fogot that the last post was also from me… :(

Nava2

2008-07-30 08:45:37

You shoulda tried to learn canvas's ;)

Glad you figured it out though :P

Nava2

Pure1993

2008-07-30 15:55:18

Just cause I found out one way doesn't mean I won't touch base on the others ^^. I'll learn about canvas once I got this tut runner up and going, it's a promise ;)

NiCbaZ

2008-07-31 02:11:22

im problay thing about the wrong thing cause it seems so simple if the colrs dont change use this if they do use the one will tol that does the same

function ChangeHairTo(color: integer): boolean;
begin
repeat
if Not GetColor(634, 281) =2369440) then
begin
// stuff to move mouse to next cut
end else
Exit;
until false;
end;


or simplyer

function ChangeHairTo(color: integer): boolean;
begin
repeat
Mouse(kjsksk)
until (GetColor(634, 281) =Color);
end;

that prob doesn't compile tho i thik ive got the wrong thing cause it seems 2 simple