# Color Help

## Recommended Posts

So for example, we have color green and yellow, i want to make my script that search the closest yellow point by the green.

Can someone help me cause i really don't know how to begin for that.

Pleas Help thx

##### Share on other sites

As always a picture is worth a thousand words. Based on your description we only have a vague idea of what you are trying to do.

##### Share on other sites

So let's say in x1,y1,x2,y2 you have a green point and sometime yellow's. The code need's to do like this :

- If find yellow point, click to the yellow point that is the closest to the green point.

##### Share on other sites

Picture please. There are too many variations such as:

- Is the green all in one spot? Or groups of green and we need to find largest?

- Does the color vary or is always exactly the same color each time?

- Same questions for yellow.

And so on. If you are going to ask for help at least give us something to go on.

##### Share on other sites

See that ^^. But the green wil move, and sometime yellow's wil appear, and its taken then dissapear. You never playd seafight ?

##### Share on other sites

There are all kinds of ways to do this. Here is one. You will likely need to adjust the colors. I believe SeaFight is notorious for varying colors???

I have not tested this, but it should work.

```const
YellowDot = 62207;   // Color of yellow dots.
YellowDotTol = 5;    // Color tolerance for yellow dots.
GreenDot = 5026082;  // Color of green dots.
GreenDotTol = 5;     // Color tolerance for green dots.

function FindYellowDotNearestGreen(const SearchArea: TBox; out Position: TPoint): Boolean;
var
YellowPts: TPointArray;  // Locations of yellow dots.
GreenPos: TPoint;        // Location of green dot.
begin
Result := False;
Position := Point(0, 0);

// Find yellow dots (if any).
with SearchArea do
if not FindColorTolEx(YellowPts, YellowDot, X1, Y1, X2, Y2, YellowDotTol) then
begin
Writeln('No yellow dots found.');
Exit;
end;
Writeln('Found ' + IntToStr(Length(YellowPts)) + ' pixels matching yellow.');

// Find green dot.
with SearchArea, GreenPos do
if not FindColorTol(X, Y, GreenDot, X1, Y1, X2, Y2, GreenDotTol) then
begin
Writeln('Failed to find green dot.');
SetLength(YellowPts, 0);
Exit;
end;
Writeln(Format('Found green dot at (%d,%d).', [GreenPos.X, GreenPos.Y]));

// Sort yellow by distance from green and return nearest point.
SortTPAEx(YellowPts, GreenPos);
Position := YellowPts[0];
SetLength(YellowPts, 0);
Result := True;
Writeln(Format('Found yellow dot at (%d,%d).', [Position.X, Position.Y]));
end;
```

Edited by Bixby Sayz
##### Share on other sites

I get an error, when i put in the last begin not in that script^^

what to do :

repeat

yellowpoint;

until(false);

end.

i get een error invalid nmbrs of parameters, what need to be added?

##### Share on other sites

You never playd seafight ?

Should of known

##### Share on other sites

Should of known

Do you know why i get that error ?

##### Share on other sites

Hard to diagnose partial code snippets. You are showing an end without a matching begin. Hard to know what you should have without seeing the whole thing.

So the code is :

begin

Repeat

YellowPoint;

Until(false);

end.

##### Share on other sites

" Bump, pleas help pleas.. I tryd all ways, nothing helps..

##### Share on other sites

There is nothing wrong with that particular snippet. Which means there is an extra begin/end/something elsewhere in your script. Which is why I asked to see the whole thing.

##### Share on other sites

Well actually I tried it too. If I put the script, its tells me I'm missing some parameters.

EG:

begin

Repeat

FindYellowDotNearestGreen(**What needs to be in here ? **);

until(false);

end.

##### Share on other sites

```const
YellowColor = 62207;  // Yellow decimal color
GreenColor = 5026082; // Green decimal color
X1 = 0;               // Left bounds
Y1 = 0;               // Top bounds
X2 = 700;             // Right bounds
Y2 =  700;            // Bottom bounds
Tol = 1;             // Color Tolerance for both green and yellow color finding

function YellowPointClosestToGreen(var P: TPoint): Boolean; // P outputted yellow point, Result true if there is one found
var
gTPA, yTPA: TPointArray;  // gTPA list of green points, yTPA list of yellow points
gH, yH, I, II: Integer;   // gL highest array index of gTPA, yL highest array index of yTPA, I loop 1 index, II loop 2 index
// note that arrays go from 0 to length minus 1. 0 length = -1 high. 5 length = 4 high
D, cD: Extended;          // D distance, cD closest distance
begin
Result := False;                                        // Initate Result
FindColorTolEx(yTPA, YellowColor, X1, Y1, X2, Y2, Tol); // Acquire yTPA
FindColorTolEx(gTPA, GreenColor, X1, Y1, X2, Y2, Tol);  // Acquire gTPA
yH := High(yTPA);                                       // Acquire yH
gH := High(gTPA);                                       // Acquire gH
if ((yH < 0) or (gH < 0)) then                           // If high for either is less than 0 than did not find at least 1
Exit;                                                 // Leave with Result false
Result := True;                                         // Result must be true at this point if we're still here
cD := 9999999;                                          // Initiate cD with an arbitrarily large number (less than MaxInteger 2 Billion)
for I := 0 to yH do                                     // Loop through yTPA with Loop 1 with I Index
for II := 0 to gH do                                  // Loop each yTPA[i] through gTPA with Loop 2 with II Index
begin
D := Distance(yTPA[i].X, yTPA[i].Y, gTPA[iI].X, gTPA[iI].Y); // Acquire distance between [every] green and yellow point
if (D < cD) then                                             // Check to see if it's the shortest one recorded yet
begin
cD := D;                                                   // Since it is record it to cD [closest distance]
P := yTPA[i];                                              // Update this point
end;                                                         // by here we should have the smallest cD recorded and Point output as P
end;
end;

var
P: TPoint;                                              // Declare TPoint to be used with funciton

begin
if (YellowPointClosestToGreen(P)) then                  // Result is True, P recorded
WriteLn('Found');                                     // ^
ClickMouse(P.X, P.Y, True);                             // Use P to click. May consider using OSI etc. for more human like antiban.
end.```

Assuming there is only

1 green and multiple yellows

or

1 yellow and multiple greens

Do something as simple as FindColorSpiral http://wiki.scar-divi.com/FindColorSpiral

```const
YellowColor = 62207;  // Yellow decimal color
GreenColor = 5026082; // Green decimal color
X1 = 0;               // Left bounds
Y1 = 0;               // Top bounds
X2 = 700;             // Right bounds
Y2 =  700;            // Bottom bounds
Tol = 1;             // Color Tolerance for both green and yellow color finding

var
P: TPoint;

begin
if (FindColorTol(P.X, P.Y, GreenColor, X1, Y1, X2, Y2, Tol)) then
FindColorSpiral(P.X, P.Y, P.X, P.Y, YellowColor, X1, Y1, X2, Y2);
ClickMouse(P.X, P.Y, True);
end.```

Edited by Wanted
##### Share on other sites

オンライン カジノは、プレイヤーが自宅にいながらにしてポーカー、ルーレット、ブラックジャック、スロットなどのギャンブル ゲームを楽しむ機会を提供する仮想プラットフォームです。 オンラインカジノは、アクセスのしやすさ、ゲームの種類の多さ、そして大金を獲得する機会があるため、年々人気が高まっています。

オンラインカジノの主な利点は、利便性とアクセスしやすさです。 プレイヤーは、通常のカジノの営業時間に制限されず、いつでもゲームを楽しむことができます。 必要なのは、インターネットにアクセスできるデバイスと、カジノのウェブサイトにアクセスできることだけです。 これにより、プレイヤーは従来のカジノによくありがちなストレスや緊張を感じることなく、快適な環境でプレイすることができます。

オンラインカジノのもう1つの利点は、ゲームの選択肢が豊富なことです。 ユーザーは、それぞれ独自のルールと勝利の機会を提供する何百もの異なるゲームから選択できます。 技術革新のおかげで、オンライン ゲームのグラフィックとサウンドは高品質になり、プレイヤーは興奮と情熱の雰囲気に浸ることができます。

さまざまなゲームに加えて、オンライン カジノはプレーヤーにさまざまなボーナスやプロモーションも提供します。 これらは、スロットのフリースピン、プレイのための追加のお金、または貴重な賞品が得られる特別なトーナメントなどです。 このようなボーナスにより、勝利の可能性が高まり、ゲームがさらに楽しくなります。

もちろん、オンラインカジノでのプレイにはリスクがあります。 ギャンブルには依存性がある可能性があるため、自分の感情を監視し、支出をコントロールすることが重要であることを覚えておくことが重要です。 カジノはまた、責任あるゲーミングをサポートし、自己排除や賭け金制限の機会を提供します pornhub down

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×

×