SRL Archive - SRL Archives

FindGas, Findwhirlpool and those...


JuKKa

2008-07-22 20:26:59

I have noticed that people have a hard time using these function, alot of the times where they FAIL because of that they want a exact location WHERE it should search… ( they ask for (X, Y)) Most of the times where you are not standing exactly by the rock or fishing hole. findgas or findwhirlpool wont simply work, because of when clicking it will move and then the X, Y Values wont represent the place where you clicked. This edit or.. remake of the Whirlpool function shows exactly how we SHOULD make these functions.. By using DISTANCE! It finds all whirlpool on screen, then if one is close enough to be possible that you are fishing or standing close to that one, it will return TRUE. By making these functions use distance we would save alot of nets and pickaxes.

What i have noticed is that alot of NEW scripters have a hardtime understanding this, and it would help ALOT!

Function FindWhirlPool: Boolean;
Var
CTS, I, X, Y: Integer;
TPA: TPointArray;
aTPA: T2DPointArray;
arC: TIntegerArray;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.78, 0.16);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 10524060, MSX1, MSY1, MSX2, MSY2, 26);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
aTPA := TPAtoATPAEx(TPA, 40, 40);
For I:= 0 To High(aTPA) Do
Begin
arC := GetColors(aTPA[I]);
ClearSameIntegers(arC);
MiddleTPAEx(aTPA[I], X, Y);
Result := (High(arC) < 80)And(Distance(X, Y, MSCX, MSCY) > 60);
If(Result)Then
Begin
Writeln('Whirlpool!');
Inc(WhirlPools);
Break;
End;
End;
End;

If you didnt undetstand what i meant…please post

Claymore

2008-07-22 20:45:03

I know what you mean. Like when woodcutting, you click on a tree that is in a far distance, and you try to wait for the tree to comedown using (not (IsUpText)) but the problem is the mouse moves away from the tree because you moved.

So your saying we should alter those functions by making it search around the character rather than search in one specific point? If so, then go ahead =3 I thought of that idea before but i did not know how to do it. FINALLY someone who has the idea that i had =3 High five!

Renax

2008-07-22 20:51:05

I've been out of the loop for quite awhile at this point, but searching the entire screen constantly sounds horrible inefficient. I can also imagine the distance parameter not being very reliable at all due the proximity of other fishing spots.

HyperSecret

2008-07-22 20:58:47

From: Renax
I've been out of the loop for quite awhile at this point, but searching the entire screen constantly sounds horrible inefficient. I can also imagine the distance parameter not being very reliable at all due the proximity of other fishing spots.


nice to see your back, well mostly nice to meet you too :P

and possibly try the new one in rev 20? handleWhirlPool?

Renax

2008-07-22 21:06:01

again wizzup's function searches the entire screen, leaving alot of false positives. In my opinion the whirlpool isn't worthwhile in identifying, a good function to retrieve lost equipment is much more important. considering the value of fishing equipment having to retrieve an item from the bank isn't all that big a deal.

tarajunky

2008-07-22 22:07:32

Renax, using TPAs makes searching the whole screen fast. It's pretty much one big color search and then all the rest is computational calculations that SCAR can breeze through in no time.

Most new functions use TPAs, and are usually fast enough not to bother optimizing them further, since they would cause a negligible amount of lag in a script.

Harry

2008-07-22 22:12:07

From: Renax
I've been out of the loop for quite awhile at this point, but searching the entire screen constantly sounds horrible inefficient. I can also imagine the distance parameter not being very reliable at all due the proximity of other fishing spots.


Welcome back :)

And make it scan 4 tiles around your char from the centre point. Will work the best.