SRL Archive - OSR Help

AutoColor Issues. Whyyy!!?


xtrapsp

2012-02-19 16:28:09

Ok, So I've been working on my Xtra-Ivy and I've bumped into a problem

Decided to use Autocolor in my script now. Rather than a simple color script, the debug box fills up with a load of auto colors but no actual results anymore…

Script:
program xtraivy;

//{$DEFINE SMART}
{$i SRL\SRL.simba}
{include SPS/SPS.simba}


{♠===================================================================♠

♠XtraIVY♠

♠Release Date♠: 17/02/2012

♠Author♠: xtrapsp

♠Support♠: http://villavu.com/forum/showthread.php?t=75528

Changelog:

17/02/2012 - Chopping done.
18/02/2012 - Added Various antiban.
19/02/2012 - Added elements which aren't in use yet.


♠===================================================================♠}

Const
SRLStats_Username = '';
SRLStats_Password = '';
BreakEvery = 120;
BreakFor = 5;
NumbOfPlayers= 1;
StartPlayer= 0;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //Runescape Username
Players[0].Pass := ''; //Runescape Password
Players[0].Nick := ''; //3-4 letters that you will recognise
Players[0].Member := True; //Are you a member?
Players[0].Active := True; //Not sure what this means... I saw it on other scripts
Players[0].Pin := ''; //Bank Pin
Players[0].BoxRewards := ['Xp', 'mote', 'ostume','ssence'];

end;

Var
x, y: Integer;
Nest: Integer;

////////////////////////////////////////////////////////////////////////////////
////////////AutoColour Feature (I'm British I spell it like Colour)/////////////

function IVYColour: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.08);

if not (FindColorsTolerance(arP, 4619873, MSX1, MSY1, MSX2, MSY2, 10)) 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
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

Procedure Chop_Old;
Begin

If FindObjCustom(x, y, ['ch', 'p'], [4553824, 4355931, 5279598], 5) Then
Begin
mouse( x, y, 2, 2, true);
MakeCompass(0 + random(20));
wait(16675 + random(1654))
End;
End;
Procedure Chop;
Begin
If FindObjTPA(x, y, IvyColour, 5, 1, 0, 5,600, ['Cho']) Then
Begin
mouse( x, y, 2, 2, True);
End;
End;

Procedure StatsGuise(wat:String); // Thanks YoHoJo
Begin
Status(wat);
Disguise(wat);
End;

Procedure Antiban;
Begin
Case Random(250) Of
0: Begin StatsGuise('AntiBan') GameTab(tab_Stats) HoverSkill('Woodcutting', False) GameTab(28) End;
1: Begin StatsGuise('AntiBan') SleepAndMoveMouse(7000 + Random(500)); End;
2: Begin StatsGuise('AntiBan') GameTab(tab_Inv) ExamineInv; GameTab(28); End;
3: Begin StatsGuise('AntiBan') RandomAngle(1); End;
4: Begin StatsGuise('AntiBan') GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(28); End;
5: Begin StatsGuise('AntiBan') GameTab(tab_Stats) HoverSkill('random', False); GameTab(28); End;
End;
End;

Procedure FindNest_old;
Begin

If FindObjCustom(x, y, ['Ne', 'st'], [3290938,3883332], 5) Then
mouse( x, y, 2, 2, true);
Writeln('Found a nest... Attempting to pickup');
MakeCompass(10 + random(50));
End;
Procedure FindNest;
Begin
//Nest := DTMFromString('asd')
If FindDTM(Nest, X, Y, MSX1, MSY1, MSX2, MSY2) Then
Begin
Writeln('Found a nest... Attempting to pickup');
MMouse (x, y, 5, 5);
MakeCompass(0 + random(50));
If IsUpText('nes') Then
Mouse(x, y, 0, 0, True);
FreeDTM(Nest);
End;
End;
Procedure CrushNest;
Begin
//Nest := DTMFromString('asd')
If FindDTM(Nest, X, Y, MIX1, MIY1, MIX2, MIY2) Then
Begin
Writeln('Found a nest inside Inventory, Attempting to crush');
MMouse (x, y, 5, 5);
MakeCompass(0 + random(50));
If IsUpText('cru') Then
Mouse(x, y, 0, 0, True);
End;
End;

begin
SetupSRL;
DeclarePlayers;
LoginPlayer;
Writeln('Your using XtraIvy V0.01');
Repeat
Chop
Until(false)
End.

Debug Box:
AutoColor = 3893842
AutoColor = 3893842
AutoColor = 3893842
AutoColor = 3893842
AutoColor = 3893842
AutoColor = 3893842
AutoColor = 3893842
AutoColor = 3893842
AutoColor = 3893842
AutoColor = 3893842
AutoColor = 3893842
AutoColor = 3893842
AutoColor = 3893842
AutoColor = 593215
AutoColor = 3827792
AutoColor = 3827792
AutoColor = 3827792
AutoColor = 4157526
AutoColor = 5807225
AutoColor = 5807225
AutoColor = 5807225
AutoColor = 6648243
AutoColor = 4157526
AutoColor = 4157526
AutoColor = 3893842
AutoColor = 3893842
AutoColor = 3893842
AutoColor = 3893842
AutoColor = 3893842
AutoColor = 3893842
AutoColor = 3893842
AutoColor = 593215
AutoColor = 3827792
AutoColor = 4157526
AutoColor = 4157526
AutoColor = 5807225
AutoColor = 5807225
AutoColor = 3893842
AutoColor = 4157526
AutoColor = 4157526
AutoColor = 4157526
AutoColor = 3893842
AutoColor = 3893842

NOTE: It doesn't use smart. You can. It just doesn't at the moment

RISK

2012-02-19 16:31:04

Make a local integer for the procedure and set the integer to be the procedure you use for autocoloring, like this:
procedure Example;
var
Col: Integer;
begin
Col := InvColour;
end;

Then use 'col' instead in your object finding.

xtrapsp

2012-02-19 16:36:22

From: RISK
Make a local integer for the procedure and set the integer to be the procedure you use for autocoloring, like this:
procedure Example;
var
Col: Integer;
begin
Col := InvColour;
end;

Then use 'col' instead in your object finding.


Your gonna have to forgive me I'm still learning ^.^

Would you mind explaining it a bit more please? Sorry

Edit: Do you mean for the chop procedure?

 Procedure Chop;
var
Col: Integer;
Begin
If Col := IvyColour; Then
Begin
mouse( x, y, 2, 2, True);
End;
End;

RISK

2012-02-19 16:39:08

function IvyColour: Integer;
begin
end;

procedure Chop;
var
X, Y, Col: Integer;
begin
Col := InvColour;

if (FindObjTPA(X, Y, Col, 20, 1, 10, 10, 10, ['', ''])) then
begin
end;
end;

Try that there. Your tolerance needed to be up since you're using CTS 1. What you're doing pretty much is giving the color IvyColour finds to a variable called 'Col'. Then you use that variable called 'Col' in your 'FindObjTPA' method.


E: Some additional info: The width and height are pixels. A general good height is 10 width and 10 height. It takes a little 'Tinkering' to know the 'Sweet spot' though. :p The min pixel is the minimum amount of pixels for the found object to be considered in mousing. 10 pixels is a good one for it too. Just mess with it until you find what is good for you.

xtrapsp

2012-02-19 16:45:34

From: RISK
function IvyColour: Integer;
begin
end;

procedure Chop;
var
X, Y, Col: Integer;
begin
Col := InvColour;

if (FindObjTPA(X, Y, Col, 20, 1, 10, 10, 10, ['', ''])) then
begin
end;
end;

Try that there. Your tolerance needed to be up since you're using CTS 1. What you're doing pretty much is giving the color IvyColour finds to a variable called 'Col'. Then you use that variable called 'Col' in your 'FindObjTPA' method.


E: Some additional info: The width and height are pixels. A general good height is 10 width and 10 height. It takes a little 'Tinkering' to know the 'Sweet spot' though. :p The min pixel is the minimum amount of pixels for the found object to be considered in mousing. 10 pixels is a good one for it too. Just mess with it until you find what is good for you.


Thanks for the swifty Response, However I'm not sure I'm doing it correct?
It's now just moving the mouse into the corner :S

Sorry about the issues haha, I know I'm a pain :3

program xtraivy;

//{$DEFINE SMART}
{$i SRL\SRL.simba}
{include SPS/SPS.simba}


{♠===================================================================♠

♠XtraIVY♠

♠Release Date♠: 17/02/2012

♠Author♠: xtrapsp

♠Support♠: http://villavu.com/forum/showthread.php?t=75528

Changelog:

17/02/2012 - Chopping done.
18/02/2012 - Added Various antiban.
19/02/2012 - Added elements which aren't in use yet.


♠===================================================================♠}

Const
SRLStats_Username = '';
SRLStats_Password = '';
BreakEvery = 120;
BreakFor = 5;
NumbOfPlayers= 1;
StartPlayer= 0;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //Runescape Username
Players[0].Pass := ''; //Runescape Password
Players[0].Nick := 'xtr'; //3-4 letters that you will recognise
Players[0].Member := True; //Are you a member?
Players[0].Active := True; //Not sure what this means... I saw it on other scripts
Players[0].Pin := ''; //Bank Pin
Players[0].BoxRewards := ['Xp', 'mote', 'ostume','ssence'];

end;

Var
x, y: Integer;
Nest: Integer;

////////////////////////////////////////////////////////////////////////////////
////////////AutoColour Feature (I'm British I spell it like Colour)/////////////

function IVYColour: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.08);

if not (FindColorsTolerance(arP, 4619873, MSX1, MSY1, MSX2, MSY2, 10)) 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
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

Procedure Chop_Old;
Begin

If FindObjCustom(x, y, ['ch', 'p'], [4553824, 4355931, 5279598], 5) Then
Begin
mouse( x, y, 2, 2, true);
MakeCompass(0 + random(20));
wait(16675 + random(1654))
End;
End;

procedure Chop;
var
X, Y, Col: Integer;
begin
Col := IVYColour;

if (FindObjTPA(X, Y, Col, 20, 1, 10, 10, 10, ['', ''])) then
begin
mouse( x, y, 2, 2, True);
end;
end;
Procedure StatsGuise(wat:String); // Thanks YoHoJo
Begin
Status(wat);
Disguise(wat);
End;

Procedure Antiban;
Begin
Case Random(250) Of
0: Begin StatsGuise('AntiBan') GameTab(tab_Stats) HoverSkill('Woodcutting', False) GameTab(28) End;
1: Begin StatsGuise('AntiBan') SleepAndMoveMouse(7000 + Random(500)); End;
2: Begin StatsGuise('AntiBan') GameTab(tab_Inv) ExamineInv; GameTab(28); End;
3: Begin StatsGuise('AntiBan') RandomAngle(1); End;
4: Begin StatsGuise('AntiBan') GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(28); End;
5: Begin StatsGuise('AntiBan') GameTab(tab_Stats) HoverSkill('random', False); GameTab(28); End;
End;
End;

Procedure FindNest_old;
Begin

If FindObjCustom(x, y, ['Ne', 'st'], [3290938,3883332], 5) Then
mouse( x, y, 2, 2, true);
Writeln('Found a nest... Attempting to pickup');
MakeCompass(10 + random(50));
End;
Procedure FindNest;
Begin
//Nest := DTMFromString('asd')
If FindDTM(Nest, X, Y, MSX1, MSY1, MSX2, MSY2) Then
Begin
Writeln('Found a nest... Attempting to pickup');
MMouse (x, y, 5, 5);
MakeCompass(0 + random(50));
If IsUpText('nes') Then
Mouse(x, y, 0, 0, True);
FreeDTM(Nest);
End;
End;
Procedure CrushNest;
Begin
//Nest := DTMFromString('asd')
If FindDTM(Nest, X, Y, MIX1, MIY1, MIX2, MIY2) Then
Begin
Writeln('Found a nest inside Inventory, Attempting to crush');
MMouse (x, y, 5, 5);
MakeCompass(0 + random(50));
If IsUpText('cru') Then
Mouse(x, y, 0, 0, True);
End;
End;

begin
SetupSRL;
DeclarePlayers;
LoginPlayer;
Writeln('Your using XtraIvy V0.01');
Repeat
Chop
Until(false)
End.

RISK

2012-02-19 16:57:22

No worries. Instead of using autocolor functions, I want you to use your regular functions, but like this:
procedure Chop;
var
X, Y: Integer;
begin
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.2, 0.2); // Modify these two numbers

if FindObj(X, Y, '', 0, 0) then
begin
end;

(* We revert back to the defaults here. *)
SetColorSpeed2Modifiers(0.2, 0.2);
SetColorToleranceSpeed(1);
end;

Use ACA and set the CTS on the bottom right to 'CTS 2'. Once you do that, I want you to pick the ivy color in ACA and get it just right by testing it by refreshing the image of the client.
Then I want you to take the hue and saturation modifiers and change the first "SetColorSpeed2Modifiers(0.2, 0.2);". Hue goes in the first one and sat goes in to the second one.

Then take the 'Best color' that ACA gives you and insert it in to the color section on the findobj. Then the same for the tolerance.

Don't modify the bottom two values where we revert back to the default.

So you should end up with something like this, this is just an example and it won't work, by the way:
procedure Chop;
var
X, Y: Integer;
begin
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.15, 0.63); // Modify these two numbers

if FindObj(X, Y, 'Ivy', 252673473, 14) then
begin
end;

(* We revert back to the defaults here. *)
SetColorSpeed2Modifiers(0.2, 0.2);
SetColorToleranceSpeed(1);
end;


By the way, the values you want to get are in the bottom right of ACA once you pick colors.

xtrapsp

2012-02-19 17:14:02

From: RISK
No worries. Instead of using autocolor functions, I want you to use your regular functions, but like this:
procedure Chop;
var
X, Y: Integer;
begin
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.2, 0.2); // Modify these two numbers

if FindObj(X, Y, '', 0, 0) then
begin
end;

(* We revert back to the defaults here. *)
SetColorSpeed2Modifiers(0.2, 0.2);
SetColorToleranceSpeed(1);
end;

Use ACA and set the CTS on the bottom right to 'CTS 2'. Once you do that, I want you to pick the ivy color in ACA and get it just right by testing it by refreshing the image of the client.
Then I want you to take the hue and saturation modifiers and change the first "SetColorSpeed2Modifiers(0.2, 0.2);". Hue goes in the first one and sat goes in to the second one.

Then take the 'Best color' that ACA gives you and insert it in to the color section on the findobj. Then the same for the tolerance.

Don't modify the bottom two values where we revert back to the default.

So you should end up with something like this, this is just an example and it won't work, by the way:
procedure Chop;
var
X, Y: Integer;
begin
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.15, 0.63); // Modify these two numbers

if FindObj(X, Y, 'Ivy', 252673473, 14) then
begin
end;

(* We revert back to the defaults here. *)
SetColorSpeed2Modifiers(0.2, 0.2);
SetColorToleranceSpeed(1);
end;


By the way, the values you want to get are in the bottom right of ACA once you pick colors.



These? (Attatched)

So it would be

procedure Chop;
var
X, Y: Integer;
begin
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.02, 0.07); // Modify these two numbers

if FindObj(X, Y, 'Ivy', 4619873, 7) then
begin
end;

(* We revert back to the defaults here. *)
SetColorSpeed2Modifiers(0.2, 0.2);
SetColorToleranceSpeed(1);
end;

RISK

2012-02-19 17:16:31

Change your tolerance to '8' as it should be according to ACA and then try it out. Make sure you change the uptext and all that to what it should be, of course.

xtrapsp

2012-02-19 17:34:18

From: RISK
Change your tolerance to '8' as it should be according to ACA and then try it out. Make sure you change the uptext and all that to what it should be, of course.


Worked beautifully! More reliable on my old code then? (Check my sig for the script)

Thanks once again RISK!

RISK

2012-02-19 17:48:12

You're very welcome. If you need any further help you can make another thread or just PM me. :)

Great job on your script, by the way!


Yeah, it'll be more reliable since it is more accurate.