Heya.
Is there an easy way, to make Functions like
FindBitmapToleranceIn,
FindColor and
FindColorTolerance
to search from the lower right corner to the upper left corner ?
~caused
Heya.
Is there an easy way, to make Functions like
FindBitmapToleranceIn,
FindColor and
FindColorTolerance
to search from the lower right corner to the upper left corner ?
~caused
For the last onePHP Code:function FindColorSpiral(var x, y: Integer; color, xs, ys, xe, ye: Integer): Boolean;
Find color in box specified by xs, ys, xe, ye but start from x,y.
function FindColorSpiralTolerance(var x, y: Integer; color, xs, ys, xe, ye: Integer; Tolerance: Integer): Boolean;
Works like the regular FindColorSpiral but with a tolerance parameter for finding any similar color. Tolerance is used to find a color in range of the color you are looking for. The greater color range you want, the higher the tolerance parameter should be.
PHP Code:function FindBitmapSpiral(bitmap: Integer; var x, y: Integer; x1, y1, x2, y2: Integer): Boolean;
Search for the bitmap in coordinates specified by x1, y1, x2, y2 starting from x, y. Bitmap contains handle to bitmap generated by LoadBitmap.
Thanks Nauman, but i would need a function that works like the functions i mentioned, not scanning in a spirals, but vertically.
Yeah, so if you wanted to start from the lower right corner, then you would use a cord in the lower right corner, as it starts from that point.
If your not happy with that then the answer is no.
But it searches in spirals, doesnt it ?_?.
I'd need to search like that:
x= pixel o= searched
xxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxx
xxxxxxxxooooooooo
I think find spiral color does something like:
xxxxxxxxxxxxxxxoo
xxxxxxxxxxxxooooo
xxxxxxxxxxooooooo
xxxxxxxxooooooooo
~caused
function FindColorSpiral(var x, y: Integer; color, xs, ys, xe, ye: Integer): Boolean;
notice the xs, ys, we, ye? this is where you can edit to create a box on the screen for you to search.
to make it search from one side to the other you can simply start the search at the farthest left point by adjusting the x and y value.
“Ignorance, the root and the stem of every evil.”
No, I dont think you understood me yet xD....
so...
Example 100x100 image.
I need a function that first scans from:
-- x cord ---- y cord
1. 100to0 | 100
2. 100to0 | 99
3. 100to0 | 98
4. 100to0 | 97
...
100. 100to0 | 1
Hope that makes it clear =).
~caused
Not possible with bitmapfinding..
With color finding you can just do FindColorsTolerance, and after that ReverseTPA(TPA); Should do the trick.
Verrekte Koekwous
Unless he doesn't mind slowdowns.
In theory, repeatedly searching from the point found onwards until it didn't find anything would result in finding the last bitmap.
Alternatively, setting search area to very bottom right then incrementing it after each unsuccessful search should do it.
Then the only problem exists in that if there are two on the same line, it may miss the latter one. This would depend on if the search area was expanded by 1 horizontally each time then one vertically and resets the x search area (for second option). For the first option, since there's no FindBitmapSkipBox or the like, you would have to each drop down a line after finding one to ensure it doesn't re-find the same one, thus possibly missing one further to the right of it. The way around this would be to perform a search for the rest of that line first then go onto the next line, but unsure as to the success of this.
By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.
Why don't you just create a downto loop and enter coords starting from lower right decreasing to top left?
~NS
just whiped this up
try it
SCAR Code:FindColorReverse(var x, y: Integer; Color: Integer): Boolean;
var
i, j: Integer;
begin
for i:=MSY2-1 downto MSY1 do
begin
for j:=MSX2-1 downto MSX1 do
begin
Result:= FindColor(x, y, Color, j, i, MSX2, MSY2);
if Result then break;
end;
if Result then break;
end;
end;
~shut
All my scripts are held on Googlecode git, so if you ever see a problem, fork it and send me a pull request
If a script is grey, it doesn't work, if it's colour then it does!
My Tutorials:-
Everything you need to know about setting up Simba, SRL and Reflection!, How to sort out the MSVCR71.dll error
How to set up players for autoing with Simba, SRL/Simba Standards (with examples), Defines
Auto Updater and Git, Using a testing branch for git, Adding SRL Stats to your script
Creating your own font set for Simba, Guide to Cups, How to make 1.45M (RSGP) a day (not really my tut)
Download a image and set it as your Desktop Wallpaper in C#, How to make your first PHP file uploader
<Coh3n> Shuttleu, fuck I love you right now
Thanks shuttle U. I Saved that to my include files i made for "advanced" colorfinding.
It's slow, but does the job : ). Though, for my purpose i can skip 10 pixels all the time, to make it faster, that way i got the function i have made pretty fast.
I'll try yours later =). Thanks again!
~caused
/E: I Think you could make it more efficient, if you'd count MSX2 -1, after every loop, that way, it would only search 1 pixel a time, not the whole row from "current position" to end.
Last edited by caused; 07-04-2009 at 06:11 AM.
if you want it to skip 10 at a time then do this
SCAR Code:FindColorReverse(var x, y: Integer; Color: Integer): Boolean;
var
i, j: Integer;
begin
for i:=MSY2-1 downto MSY1 do
begin
for j:=MSX2-1 downto MSX1 do
begin
Result:= FindColor(x, y, Color, j, i, MSX2, MSY2);
if Result then break;
j:= j - 9;
end;
if Result then break;
end;
end;
~shut
All my scripts are held on Googlecode git, so if you ever see a problem, fork it and send me a pull request
If a script is grey, it doesn't work, if it's colour then it does!
My Tutorials:-
Everything you need to know about setting up Simba, SRL and Reflection!, How to sort out the MSVCR71.dll error
How to set up players for autoing with Simba, SRL/Simba Standards (with examples), Defines
Auto Updater and Git, Using a testing branch for git, Adding SRL Stats to your script
Creating your own font set for Simba, Guide to Cups, How to make 1.45M (RSGP) a day (not really my tut)
Download a image and set it as your Desktop Wallpaper in C#, How to make your first PHP file uploader
<Coh3n> Shuttleu, fuck I love you right now
Thanks!, yeah i figured something similar out, and also edited my post above with another Idea to make it quicker =)
using your other idea
SCAR Code:FindColorReverse(var x, y: Integer; Color: Integer): Boolean;
var
i, j: Integer;
begin
for i:=MSY2 downto MSY1 do
begin
for j:=MSX2 downto MSX1 do
begin
Result:= (GetColor(j, i) = Color);
if Result then
begin
x:= j;
y:= i;
break;
end;
end;
if Result then break;
end;
end;
~shut
All my scripts are held on Googlecode git, so if you ever see a problem, fork it and send me a pull request
If a script is grey, it doesn't work, if it's colour then it does!
My Tutorials:-
Everything you need to know about setting up Simba, SRL and Reflection!, How to sort out the MSVCR71.dll error
How to set up players for autoing with Simba, SRL/Simba Standards (with examples), Defines
Auto Updater and Git, Using a testing branch for git, Adding SRL Stats to your script
Creating your own font set for Simba, Guide to Cups, How to make 1.45M (RSGP) a day (not really my tut)
Download a image and set it as your Desktop Wallpaper in C#, How to make your first PHP file uploader
<Coh3n> Shuttleu, fuck I love you right now
Oh, yeah, that does the Job.
Thanks for the effort, Shuttleu! =)
There are currently 1 users browsing this thread. (0 members and 1 guests)