View Full Version : color finding help
samuri51
05-25-2012, 01:24 PM
well I'm making a miner's guild mining script, and I got it to the point where it can find and mine rocks, however it keeps hovering over the black edge of the screen(where the map ends) whenever it gets to the edge.... The color in ACA is 0 and I made sure that it wasn't being highlighted with the program yet it keeps getting stuck at the edges.... work great in the middle and then as I get to the edge where it can see the blackness it gets stuck... Also it stops working if someone steals the coal rock I was mining, I tried adding a counter but it wasn't working for some reason, it only keeps going if it notices another rock in my inventory atm, any help or suggestions would be much appreciated.
edit: also how do i find the width and height of objects?
samuri51
05-26-2012, 12:49 AM
bump
samuri51
05-26-2012, 10:57 PM
bump again
can you post your aca function?
putonajonny
05-26-2012, 11:02 PM
You need to set the bounds of where to search properly, post your code where you are having the problems and we will be able to help much more
vashanddou
05-26-2012, 11:09 PM
Not sure about the colour,
I dont know the reason for why it stops mining after someone steals coal
because it should just move onto the next one, once the coal is mined
my guess is that since its not in the inventory (if using inventory count to keep track of when to mine coal) that it stops, so to fix that have it loop back to "finding coal" if no coal is mined after a certain amount of seconds.
something like:
begin
repeat
MineCoal;
until FindCoal or WaitOption(5000);
end;
So it will repeat the minecoal action untill it has mined and has to find coal again or has been WaitOption(miliseconds); untill it just moves on from mining coal.
No... the above function will stop once it Finds the Coal.
What you need to do is:
repeat
if FindCoal then
MineCoal
else
Writeln('Couldn''t find coal');
until InvFull or (not LoggedIn);
samuri51
05-27-2012, 02:52 AM
how do i quote simba code?
putonajonny
05-27-2012, 09:13 AM
how do i quote simba code?
Put these at the start and the end: (without the space)
[SIMBA][ /SIMBA]
samuri51
05-27-2012, 10:13 AM
k here it is lol, still have more things to add and change so any suggestions would be helpful
program minerandbanker;
{$DEFINE SMART}
{$i srl/srl.simba}
var
coal, x, y: integer;
var
getrunningtime, xpgain, timegone: integer;
var
CoalInInv, XpPerHour, currentxp: integer;
const
SRLStats_Username = ''; // your SRL stats username
SRLStats_password = ''; // your srl stats password
version = '1.0';
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; // Username?
Players[0].Pass := ''; // Password?
Players[0].Nick := ''; // 3 letters of your username (not the first letter)
Players[0].Active := True;
end;
procedure antiban;
begin
case random(1500) of
0..25:
begin
HoverSkill('Mining',false);
MouseBox(644,168,669,202,1);
end;
26..51:
begin
sleep(2000+random(3000));
end;
60..75:
begin
GameTab(tab_Friends);
sleep(100+random(250));
MouseBox(644,168,669,202,1);
end;
80..95:
begin
Mouse(260,160,5,6,false);
sleep(200+random(100));
MMouse(190,276,10,30);
sleep(250+random(100));
MMouse(495,45,50,50);
end;
120..125:
begin
ToggleMoneyPouch(true);
sleep(200+random(250));
Mouse(532,98,10,10,false);
WaitOptionMulti(['Examine money','money pouch'],200);
sleep(500+random(200));
ToggleMoneyPouch(false);
end;
800..825:
begin
SleepAndMoveMouse(2000+random(2000));
end;
end;
end;
procedure progressreport;
begin
ClearDebug;
TimeGone := (getrunningtime/1000);
CoalinInv := InvCount
CurrentXp := GetXPBar(1);
XpGain := (Currentxp-GetXPBarTotal);
XpPerHour :=(3600*(xpgain))/((timegone));
begin
writeln('*Simple Powerminer version one*');
writeln('*We have mined:' +IntToStr(CoalinInv) + 'coal*');
writeln('*We have gained:' + IntToStr(XpGain) + 'xp / Thats' + IntToStr(XpPerHour)+ 'xp per hour*');
writeln('*Total running time:' + IntToStr(getrunningtime/60000) + 'minutes*');
end;
end;
procedure findcoalfrominv;
begin
coal := DTMFromString('m1gAAAHic42JgYFjAxMCwCIjXAfFKJgh/BhBPgtJzgXg2EH8H4ldA/AGI/wExAzOE/gbEb6ByLEAxDQ15oCQTEZg4wEgkRgAAo18OkA==');
If FindDTM(coal, X, Y, MIX1, MIY1, MIX2, MIY2) then
begin
MMouse(x, y, 7, 7);
if isUpText('oal') then
mouse(x, y, 0, 0, true);
FreeDTM(coal);
end;
end;
function autocoalcolor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.00, 0.31);
FindColorsSpiralTolerance(MMCX, MMCY, arP, 1776668, MMX1, MMY1, MMX2, MMY2, 4);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 0.59) and (X <= 1.76) and (Y >= 0.63) and (Y <= 1.86) and (Z >= 0.64) and (Z <= 1.95) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
procedure Failsafe(Reason:String);
begin
Players[CurrentPlayer].Loc:=reason;
Logout;
Stats_commit;
TerminateScript;
end;
function minecoalrocks:Boolean;
var
x, y, PlusOne, counter, toolong: Integer;
begin
Marktime(toolong);
PlusOne := InvCount+1;
x:= MSCX
y:= MSCY
if FindObjTPA(x, y, autocoalcolor, 15, 2, 10, 10, 20, ['Mine Coal']) then
begin
writeln('coal rock found');
GetMousePos(x,y);
case random (2) of
0: mouse(x, y, 5, 5, True);
1: begin
Mouse(x, y, 5, 5, False);
WaitOption('Mine', 500);
end;
end;
flag;
marktime(counter);
if (TimeFromMark(toolong) > 30000) then
Failsafe('could not find rock');
repeat
if (TimeFromMark(toolong) > 30000) then
Failsafe('could not find rock');
antiban;
wait(1000);
if invcount=plusone then
writeln('you add an ore of coal to your inventory');
until (invcount=PlusOne) or (TimeFromMark(counter) > 5000);
end;
end;
begin
SetupSRL;
DeclarePlayers;
FindNormalRandoms;
progressreport;
repeat
minecoalrocks;
progressreport;
until(false);
end.
samuri51
05-27-2012, 02:20 PM
1. so recap of the problem... it can find coal rocks but keeps getting hung up on the edges of the map....
2. progress report is bugged keeps saying divide by 0 error at
writeln('*Simple Powerminer version one*');
procedure progressreport;
begin
ClearDebug;
TimeGone := (getrunningtime/1000);
CoalinInv := InvCount
CurrentXp := GetXPBar(1);
XpGain := (Currentxp-GetXPBarTotal);
XpPerHour :=(3600*(xpgain))/((timegone));
begin
writeln('*Simple Powerminer version one*');
writeln('*We have mined:' +IntToStr(CoalinInv) + 'coal*');
writeln('*We have gained:' + IntToStr(XpGain) + 'xp / Thats' + IntToStr(XpPerHour)+ 'xp per hour*');
writeln('*Total running time:' + IntToStr(getrunningtime/60000) + 'minutes*');
end;
end;
3. Drop procedure is bugged... at MouseItem(coalpattern[I], false);
its not accepting false as a valid option... keeps saying type mismatch :S
procedure DropCoal;
var
x, y, coal, I:integer;
Box:TBox;
coalpattern:TIntegerArray;
begin
coal := DTMFromString('m1gAAAHic42JgYFjAxMCwCIjXAfFKJgh/BhBPgtJzgXg2EH8H4ldA/AGI/wExAzOE/gbEb6ByLEAxDQ15oCQTEZg4wEgkRgAAo18OkA==');
coalpattern := [1,5,9,13,17,21,25,2,6,10,14,18,22,26,3,7,11,15,19, 23,27,4,8,12,16,20,24,28];
for I := 0 to 27 do
begin
Box := InvBox(coalpattern[I]);
If findDTM(coal, x, y, Box.x1, Box.y1, Box.x2, Box.y2) then
begin
MouseItem(coalpattern[I], false);
ChooseOption('Dro');
end;
end;
end;
putonajonny
05-27-2012, 02:26 PM
1. so recap of the problem... it can find coal rocks but keeps getting hung up on the edges of the map....
I'm not quite sure what you mean by this...
2. progress report is bugged keeps saying divide by 0 error at
writeln('*Simple Powerminer version one*');
add divide by zero check:
procedure progressreport;
begin
ClearDebug;
TimeGone := (getrunningtime/1000);
if(TimeGone = 0)then
exit;
CoalinInv := InvCount
CurrentXp := GetXPBar(1);
XpGain := (Currentxp-GetXPBarTotal);
XpPerHour :=(3600*(xpgain))/((timegone));
begin
writeln('*Simple Powerminer version one*');
writeln('*We have mined:' +IntToStr(CoalinInv) + 'coal*');
writeln('*We have gained:' + IntToStr(XpGain) + 'xp / Thats' + IntToStr(XpPerHour)+ 'xp per hour*');
writeln('*Total running time:' + IntToStr(getrunningtime/60000) + 'minutes*');
end;
end;
3. Drop procedure is bugged... at MouseItem(coalpattern[I], false);
its not accepting false as a valid option... keeps saying type mismatch :S
Use:
MouseItem(coalpattern[I], mouse_Right); //if you want to left click use mouse_Left if you just want to move the mouse (not click) use mouse_move
samuri51
05-27-2012, 03:10 PM
thanks i dont get those errors anymore :D
for some reason my drop procedures not working anymore though?
and the progress reports not printing to the command line :c
program powerminer;
//{$DEFINE SMART}
{$i srl/srl.simba}
var
getrunningtime, xpgain, timegone: integer;
var
CoalInInv, XpPerHour, currentxp: integer;
const
SRLStats_Username = ''; // your SRL stats username
SRLStats_password = ''; // your srl stats password
version = '1.0';
custommousespeed = 15;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; // Username?
Players[0].Pass := ''; // Password?
Players[0].Nick := ''; // 3 letters of your username (not the first letter)
Players[0].Active := True;
end;
procedure antiban;
begin
case random(1500) of
0..25:
begin
HoverSkill('Mining',false);
MouseBox(645,169,670,203,1);
end;
26..51:
begin
sleep(1500+random(1500));
end;
60..75:
begin
GameTab(tab_Friends);
sleep(80+random(225));
MouseBox(644,168,669,202,1);
end;
80..95:
begin
Mouse(260,160,5,6,false);
sleep(200+random(100));
MMouse(190,276,10,30);
sleep(250+random(100));
MMouse(495,45,50,50);
end;
120..125:
begin
ToggleMoneyPouch(true);
sleep(200+random(250));
Mouse(532,98,10,10,false);
WaitOptionMulti(['Examine money','money pouch'],200);
sleep(500+random(200));
ToggleMoneyPouch(false);
end;
800..825:
begin
SleepAndMoveMouse(2000+random(2000));
end;
end;
end;
procedure progressreport;
begin
ClearDebug;
TimeGone := (getrunningtime/1000);
if(TimeGone = 0) then
exit;
CoalinInv := InvCount
CurrentXp := GetXPBar(1);
XpGain := (Currentxp-GetXPBarTotal);
XpPerHour :=(3600*(xpgain))/((timegone));
begin
writeln('*Simple Powerminer version one*');
writeln('*We have mined:' +IntToStr(CoalinInv) + 'coal*');
writeln('*We have gained:' + IntToStr(XpGain) + 'xp / Thats' + IntToStr(XpPerHour)+ 'xp per hour*');
writeln('*Total running time:' + IntToStr(getrunningtime/60000) + 'minutes*');
end;
end;
function autocoalcolor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.00, 0.31);
FindColorsSpiralTolerance(MMCX, MMCY, arP, 1776668, MMX1, MMY1, MMX2, MMY2, 4);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 0.59) and (X <= 1.76) and (Y >= 0.63) and (Y <= 1.86) and (Z >= 0.64) and (Z <= 1.95) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
procedure Failsafe(Reason:String);
begin
Players[CurrentPlayer].Loc:=reason;
Logout;
Stats_commit;
TerminateScript;
end;
function minecoalrocks:Boolean;
var
x, y, PlusOne, counter, TooLong: Integer;
begin
Marktime(TooLong);
PlusOne := InvCount+1;
x:= MSCX
y:= MSCY
if FindObjTPA(x, y, autocoalcolor, 15, 2, 10, 10, 20, ['Mine Coal']) then
begin
writeln('coal rock found');
GetMousePos(x,y);
case random (2) of
0: mouse(x, y, 5, 5, True);
1: begin
Mouse(x, y, 5, 5, False);
WaitOption('Mine', 500);
end;
end;
flag;
marktime(counter);
repeat
FindNormalRandoms;
antiban;
wait(1000);
if invcount=plusone then
writeln('you add an ore of coal to your inventory');
until (invcount=PlusOne) or (TimeFromMark(counter) > 10000);
end;
end;
procedure DropCoal;
var
x, y, coal, I:integer;
Box:TBox;
coalpattern:TIntegerArray;
begin
coal := DTMFromString('m1gAAAHic42JgYFjAxMCwCIjXAfFKJgh/BhBPgtJzgXg2EH8H4ldA/AGI/wExAzOE/gbEb6ByLEAxDQ15oCQTEZg4wEgkRgAAo18OkA==');
coalpattern := [1,5,9,13,17,21,25,2,6,10,14,18,22,26,3,7,11,15,19, 23,27,4,8,12,16,20,24,28];
for I := 0 to 27 do
begin
Box := InvBox(coalpattern[I]);
If findDTM(coal, x, y, Box.x1, Box.y1, Box.x2, Box.y2) then
begin
MouseItem(coalpattern[I], mouse_right);
ChooseOption('Dro');
end;
end;
end;
begin
SetupSRL;
DeclarePlayers;
FindNormalRandoms;
progressreport;
MouseSpeed := CustomMouseSpeed;
repeat
minecoalrocks;
DropCoal;
progressreport;
until(false);
end.
and what I mean by the coal thing is I used ACA to find the color of the coal rock... and literally only the coal rock is highlighted in the program... so it should click on the coal rock, which it does... however once it mines its way to the edge of the screen it gets stuck on the edge of the screen and keeps hovering over it (which is ACA 0) the black void around the screen that you get whenever your underground. even though it doesn't highlight it in ACA :S
edit: thats the whole program right there... if you run it youll see what i mean
putonajonny
05-27-2012, 03:18 PM
thanks i dont get those errors anymore :D
for some reason my drop procedures not working anymore though?
and the progress reports not printing to the command line :c
program powerminer;
//{$DEFINE SMART}
{$i srl/srl.simba}
var
coal, x, y: integer;
var
getrunningtime, xpgain, timegone: integer;
var
CoalInInv, XpPerHour, currentxp: integer;
const
SRLStats_Username = ''; // your SRL stats username
SRLStats_password = ''; // your srl stats password
version = '1.0';
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; // Username?
Players[0].Pass := ''; // Password?
Players[0].Nick := ''; // 3 letters of your username (not the first letter)
Players[0].Active := True;
end;
procedure antiban;
begin
case random(1500) of
0..25:
begin
HoverSkill('Mining',false);
MouseBox(645,169,670,203,1);
end;
26..51:
begin
sleep(1500+random(1500));
end;
60..75:
begin
GameTab(tab_Friends);
sleep(80+random(225));
MouseBox(644,168,669,202,1);
end;
80..95:
begin
Mouse(260,160,5,6,false);
sleep(200+random(100));
MMouse(190,276,10,30);
sleep(250+random(100));
MMouse(495,45,50,50);
end;
120..125:
begin
ToggleMoneyPouch(true);
sleep(200+random(250));
Mouse(532,98,10,10,false);
WaitOptionMulti(['Examine money','money pouch'],200);
sleep(500+random(200));
ToggleMoneyPouch(false);
end;
800..825:
begin
SleepAndMoveMouse(2000+random(2000));
end;
end;
end;
procedure progressreport;
begin
ClearDebug;
TimeGone := (getrunningtime/1000);
if(TimeGone = 0) then
exit;
CoalinInv := InvCount
CurrentXp := GetXPBar(1);
XpGain := (Currentxp-GetXPBarTotal);
XpPerHour :=(3600*(xpgain))/((timegone));
begin
writeln('*Simple Powerminer version one*');
writeln('*We have mined:' +IntToStr(CoalinInv) + 'coal*');
writeln('*We have gained:' + IntToStr(XpGain) + 'xp / Thats' + IntToStr(XpPerHour)+ 'xp per hour*');
writeln('*Total running time:' + IntToStr(getrunningtime/60000) + 'minutes*');
end;
end;
procedure findcoalfrominv;
begin
coal := DTMFromString('m1gAAAHic42JgYFjAxMCwCIjXAfFKJgh/BhBPgtJzgXg2EH8H4ldA/AGI/wExAzOE/gbEb6ByLEAxDQ15oCQTEZg4wEgkRgAAo18OkA==');
If FindDTM(coal, X, Y, MIX1, MIY1, MIX2, MIY2) then
begin
MMouse(x, y, 7, 7);
if isUpText('oal') then
mouse(x, y, 0, 0, true);
FreeDTM(coal);
end;
end;
function autocoalcolor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.00, 0.31);
FindColorsSpiralTolerance(MMCX, MMCY, arP, 1776668, MMX1, MMY1, MMX2, MMY2, 4);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 0.59) and (X <= 1.76) and (Y >= 0.63) and (Y <= 1.86) and (Z >= 0.64) and (Z <= 1.95) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
procedure Failsafe(Reason:String);
begin
Players[CurrentPlayer].Loc:=reason;
Logout;
Stats_commit;
TerminateScript;
end;
function minecoalrocks:Boolean;
var
x, y, PlusOne, counter, TooLong: Integer;
begin
Marktime(TooLong);
PlusOne := InvCount+1;
x:= MSCX
y:= MSCY
if FindObjTPA(x, y, autocoalcolor, 15, 2, 10, 10, 20, ['Mine Coal']) then
begin
writeln('coal rock found');
GetMousePos(x,y);
case random (2) of
0: mouse(x, y, 5, 5, True);
1: begin
Mouse(x, y, 5, 5, False);
WaitOption('Mine', 500);
end;
end;
flag;
marktime(counter);
repeat
FindNormalRandoms;
antiban;
wait(1000);
if invcount=plusone then
writeln('you add an ore of coal to your inventory');
until (invcount=PlusOne) or (TimeFromMark(counter) > 10000);
end;
end;
procedure DropCoal;
var
x, y, coal, I:integer;
Box:TBox;
coalpattern:TIntegerArray;
begin
coal := DTMFromString('m1gAAAHic42JgYFjAxMCwCIjXAfFKJgh/BhBPgtJzgXg2EH8H4ldA/AGI/wExAzOE/gbEb6ByLEAxDQ15oCQTEZg4wEgkRgAAo18OkA==');
coalpattern := [1,5,9,13,17,21,25,2,6,10,14,18,22,26,3,7,11,15,19, 23,27,4,8,12,16,20,24,28];
for I := 0 to 27 do
begin
Box := InvBox(coalpattern[I]);
If findDTM(coal, x, y, Box.x1, Box.y1, Box.x2, Box.y2) then
begin
MouseItem(coalpattern[I], mouse_right);
ChooseOption('Dro');
end;
end;
end;
begin
SetupSRL;
DeclarePlayers;
FindNormalRandoms;
progressreport;
repeat
minecoalrocks;
DropCoal;
progressreport;
until(false);
end.
and what I mean by the coal thing is I used ACA to find the color of the coal rock... and literally only the coal rock is highlighted in the program... so it should click on the coal rock, which it does... however once it mines its way to the edge of the screen it gets stuck on the edge of the screen and keeps hovering over it (which is ACA 0) the black void around the screen that you get whenever your underground. even though it doesn't highlight it in ACA :S
edit: thats the whole program right there... if you run it youll see what i mean
Just realised this, get rid of the variable getimerunning and when you do getimerunning/1000 change it to gettimerunning/1000
For the drop procedure, don't check for dtms, it's easier to use inv box to get a box around that item then count color tolerance to determine if there is coal there, since the shape of the coal changes this way it won't fail
samuri51
05-27-2012, 03:26 PM
can you give me an example please? i'm pretty new to simba (of how to find items with boxes)
putonajonny
05-27-2012, 03:37 PM
can you give me an example please? i'm pretty new to simba
I'm typing on my phone so I'm not sure how this will come out...
procedure DropStuff;
Var
I : integer;
B : TBox;
begin
for i := 1 to 28 do
begin
If(ExistsItem(I))then
Begin
B := InvBox(I);
If(CountColorTolerance(CoalColour, B.x1, B.y1, B.x2, B.y2, 20) > 50)then
Begin
MouseItem(I, mouse_Right);
WaitOption('rop', 100+Random(500));
End;
End;
End;
End;
samuri51
05-27-2012, 03:45 PM
lol thanks dude that drop procedure works really well c:, now if only the findcoal wasn't such a fail >.<, literally cant figure out why its detecting color 0 when i have it set to color
1776668
putonajonny
05-27-2012, 03:51 PM
lol thanks dude that drop procedure works really well c:, now if only the findcoal wasn't such a fail >.<, literally cant figure out why its detecting color 0 when i have it set to color
1776668
You could try reducing the tolerance or using another colour on the coal rock that isn't black...
samuri51
05-28-2012, 01:51 AM
yes i tried using gray and it didnt work, I also tried reducing the tolerence to 0 and it didnt work... even though the outside of the map is not a highlighted color in aca is still finds it...
samuri51
05-28-2012, 02:14 AM
nvm i figured out what the problem was... i was having aca create a function for the minimap :p fail
samuri51
05-28-2012, 02:32 AM
ugh nvm it stills finds the edges of the screen... WTF
CephaXz
05-28-2012, 02:39 AM
Function ClickCoal :Boolean;
var
a: Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
MP : TPoint;
tmpCTS : Integer;
begin
if(not(LoggedIn))then Exit;
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Hue, Sat); //Hue and Sat here
FindColorsTolerance(TPA, Color, MSX1, MSY1, MSX2, MSY2, Tolerance); //Color and tolerance here
SortTPAFrom(TPA, Point(MSCX, MSCY));
ATPA := TPAtoATPAEx(TPA, 25, 25);
SortATPAFromSize(ATPA, 500, true);
for a := 0 to High(ATPA) do
begin
MP := MiddleTPA(ATPA[a]);
{$IFDEF SMART}
SMART_DrawDotsEx(false, ATPA[a], clYellow);
{$ENDIF}
MMouse(MP.X, MP.Y, 4, 4);
if WaitUptext('ine', 2000) then //Uptext of mining the rock
begin
ClickMouse2(mouse_Left);
writeln('Clicked rock?');
Result := True;
{$IFDEF SMART}
SMART_ClearCanvas;
{$ENDIF}
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
Try the function above.
EDIT: Remember using CTS 2 when using ACA to find colors, they give more accurate colors with the use of hue and sat.
samuri51
05-28-2012, 05:01 AM
should I use this in place of my mine coal function or in place of my autocolor function?
also its giving me the error [Error] (172:5): Unknown identifier 'SMART_DrawDotsEx' at line 171
should I use this in place of my mine coal function or in place of my autocolor function?
also its giving me the error [Error] (172:5): Unknown identifier 'SMART_DrawDotsEx' at line 171
Put this after you include Simba at the start of your script:
{$i SRL\SRL\MISC\Paintsmart.simba}
samuri51
05-28-2012, 05:34 AM
thanks alot for all your help guys it works really well now :D
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.