SRL Archive - OSR Help

Random Double Clicking


imangry

2012-09-19 13:44:19

Hi,
Today i made my first script but after using ACA when finding a ore to mine to seems to randomly click the ore twice.. and in the debug AutoColor = 5149181
AutoColor = 8893177
AutoColor = 8827384
AutoColor = 9155836
AutoColor = 4687078
Anyway to make it stay to one ore and no double clicking?

Thanks!

Solar

2012-09-19 13:47:48

You're going to have to give some more information to get an answer. Post some or all of the script that is relevant.

imangry

2012-09-19 13:55:05

Well here it is:

program new;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i sps/sps.simba}


function CopperColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.02, 1.48);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 6329580, MSX1, MSY1, MSX2, MSY2, 13);
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 >= 33.24) and (X <= 61.86) and (Y >= 26.81) and (Y <= 55.88) and (Z >= 8.26) and (Z <= 32.74) 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 Antiban; //Thanks to Solidone40
Begin

Case Random(100) Of
1: HoverSkill('Mining', False);
2: HoverSkill('random', False);
3: Boredhuman;
4: Wait(2500 + random(4500));
5: HoverSkill('smithing', False);
6: PickUpMouse;
7: RandomMovement;
8: RandomRClick;
end;
end;

Procedure MiniBreaker;
Begin

Case Random (160) Of
1: Wait(40000 + random(7400));
2: Wait(25500 + random(8550));
3: Wait(60040 + random(6759));
4: Wait(20400 + random(2549));
end;
end;

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;

Procedure DropCopper;
begin

if(InvFull) then
DropAllExcept([1]);// keep my pickaxe

end;


Procedure FullCheck;
begin
if(InvFull) then
begin
writeln('Dropping now');
DropCopper;
end;

end;


Procedure FindCopper;
var x, y: integer;
begin
repeat
if FindObj(x, y, 'ine', CopperColor, 1)Then
mouse(x, y, 1, 1,1);
ChooseOption('ine');
repeat
wait(1200+random(450));
AntiBan;
FullCheck;
FindNormalRandoms;
until not(IsUpText('opper')or(invFull))
until(InvFull)

end;


begin

SetupSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
repeat
FindCopper;
FullCheck;
DropCopper;
until(false)
end.

Mat

2012-09-19 14:03:19


program new;
{$DEFINE SMART}
{$i srl/srl.simba}



function CopperColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.02, 1.48);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 6329580, MSX1, MSY1, MSX2, MSY2, 13);
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 >= 33.24) and (X <= 61.86) and (Y >= 26.81) and (Y <= 55.88) and (Z >= 8.26) and (Z <= 32.74) 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 Antiban; //Thanks to Solidone40
Begin

Case Random(100) Of
1: HoverSkill('Mining', False);
2: HoverSkill('random', False);
3: Boredhuman;
4: Wait(2500 + random(4500));
5: HoverSkill('smithing', False);
6: PickUpMouse;
7: RandomMovement;
8: RandomRClick;
end;
end;

Procedure MiniBreaker;
Begin

Case Random (160) Of
1: Wait(40000 + random(7400));
2: Wait(25500 + random(8550));
3: Wait(60040 + random(6759));
4: Wait(20400 + random(2549));
end;
end;

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;
procedure FindCopper;
var x, y: integer;
begin
repeat
if FindObj(x, y, 'ine', CopperColor, 1)Then
begin
mouse(x, y, 1, 1,1);
ChooseOption('ine');
repeat
wait(1200+random(450));
AntiBan;
FullCheck;
FindNormalRandoms;
until not(IsUpText('opper')or(invFull))
end;
until(InvFull)
end;
begin
SetupSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
repeat
FindCopper;
if(InvFull) then //Removed Drop Copper and Full Checked
begin //Added it here
writeln('Dropping now');
DropAllExcept([1]);
end;
until(false)
end.
I removed a few things Like there was a if and you had it click no matter if it found it or not, so I wrapped that, also I sorted standards to make life a bit easier :).

imangry

2012-09-19 14:09:01

From: Mat

program new;
{$DEFINE SMART}
{$i srl/srl.simba}



function CopperColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.02, 1.48);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 6329580, MSX1, MSY1, MSX2, MSY2, 13);
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 >= 33.24) and (X <= 61.86) and (Y >= 26.81) and (Y <= 55.88) and (Z >= 8.26) and (Z <= 32.74) 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 Antiban; //Thanks to Solidone40
Begin

Case Random(100) Of
1: HoverSkill('Mining', False);
2: HoverSkill('random', False);
3: Boredhuman;
4: Wait(2500 + random(4500));
5: HoverSkill('smithing', False);
6: PickUpMouse;
7: RandomMovement;
8: RandomRClick;
end;
end;

Procedure MiniBreaker;
Begin

Case Random (160) Of
1: Wait(40000 + random(7400));
2: Wait(25500 + random(8550));
3: Wait(60040 + random(6759));
4: Wait(20400 + random(2549));
end;
end;

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;
procedure FindCopper;
var x, y: integer;
begin
repeat
if FindObj(x, y, 'ine', CopperColor, 1)Then
begin
mouse(x, y, 1, 1,1);
ChooseOption('ine');
repeat
wait(1200+random(450));
AntiBan;
FullCheck;
FindNormalRandoms;
until not(IsUpText('opper')or(invFull))
end;
until(InvFull)
end;
begin
SetupSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
repeat
FindCopper;
if(InvFull) then //Removed Drop Copper and Full Checked
begin //Added it here
writeln('Dropping now');
DropAllExcept([1]);
end;
until(false)
end.
I removed a few things Like there was a if and you had it click no matter if it found it or not, so I wrapped that, also I sorted standards to make life a bit easier :).


but still it doesn't fix the problem of the double clicking and also it start mining a ore then switch to another any ideas? :garfield:

litoris

2012-09-19 15:13:05

From: imangry
but still it doesn't fix the problem of the double clicking and also it start mining a ore then switch to another any ideas? :garfield:


Look up pixelshift, flight had a great tutorial on it. I also suggest you read through some working scripts and try to understand what's going on, many scripters comment their code to explain the functions.