SRL Archive - Simba (Testing) Scripts

help with my woodcutter please


benny999

2012-05-01 04:32:08

hello i have been following YoHoJos Video Tutorials now i have added walking and banking its buggy as and needs a lot of cleaning but it works for the most part

i don't think its to bad of a job for my first script and i have no idea on how to script except from what i have learned from the community tuts which shows how good the tuts are here :)

now my issue is when its chopping trees it seems to click other areas on the ground and mucks around well ill add the script and you can try for your self


setup start in varrock west bank axe equipped or use the one in the toolbelt
you can test banking just by having a full inv of logs

thanks

program PowerChooper;

{$DEFINE SRL5}
//{$DEFINE SMART}

{$i SRL/srl.simba}
{$i SPS/sps.simba}


Const
SRLStats_Username = ''; // Your SRL Stats Username
SRLStats_Password = ''; // Your SRL Stats Password
NumbOfPlayers = 1; //how how many players
StartPlayer = 0; //which player do you wanna start with 0 being the first
BreakEvery = 120; //how long till break
BreakFor = 5; //how long to break for
Version = '1.0'; //dont touch
Var
TooLong:Integer;

procedure DeclarePlayers;
var i:integer;
begin
NumberOFPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;
for i := 0 to NumbOfPlayers-1 do
Players[i].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];

with Players[0] do
begin
Name := ''; //Player username
Pass := ''; //Player Password
Active := True;
Integers[1] := 4; //which ore
Integers[2] := 4; //seconds to try mining ore
end;

end;
Var
myPath:TPointArray;
myrPath:TPointArray;
Procedure Top;
begin

SPS_Setup(RUNESCAPE_SURFACE,['11_7','10_7']);
myPath := [Point(4579, 2900), Point(4581, 2909), Point(4579, 2915),
Point(4578, 2920), Point(4564, 2931), Point(4550, 2935),
Point(4539, 2936),Point(4525, 2937), Point(4505, 2942),
Point(4495, 2952), Point(4483, 2965), Point(4467, 2975),
Point(4452, 2983), Point(4437, 2981), Point(4426, 2961),
Point(4420, 2947), Point(4408, 2936), Point(4395, 2941)];
SPS_WalkPath(myPath)
end;
Procedure ReturnP;
begin
SetupSRL;
SPS_Setup(RUNESCAPE_SURFACE,['11_7','10_7']);
myrPath := [Point(4381, 2913), Point(4395, 2936),
Point(4409, 2948), Point(4422, 2958), Point(4427, 2970),
Point(4436, 2983), Point(4449, 2984), Point(4461, 2979),
Point(4473, 2974), Point(4486, 2966), Point(4497, 2951),
Point(4509, 2940), Point(4523, 2932), Point(4539, 2934),
Point(4554, 2935), Point(4569, 2934), Point(4577, 2927),
Point(4580, 2911), Point(4580, 2902)];
SPS_WalkPath(myrPath)
end;




Procedure StatsGuise(wat:String);
Begin
Status(wat);
Disguise(wat);
end;


Procedure Antiban;
Begin
Case Random(250) of
0: Begin Statsguise ('AntiBan') GameTab(tab_Stats) HoverSkill('Magic', 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 FailSafe(Reason:String);
Begin
Players[CurrentPlayer].Loc:=Reason;
Logout;
Stats_Commit;
Writeln(Reason);
TerminateScript;
end;
function TreeColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.16, 0.88);

if not (FindColorsTolerance(arP, 3229008, MSX1, MSY1, MSX2, MSY2, 5)) 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;


Function ChopDown:Boolean;
Var
x, y, PlusOne, TreeCounter: Integer;
begin
MarkTime(TooLong);
FindNormalRandoms;
PlusOne:= InvCount+1;
//if FindobjCustom (x, y, ['Chop', 'down'], [2042413, 1450529, 1252637, 1450786 ], 15 ) Then //moves mouse to colour
x:=MSCX;
y:=MSCY;
if FindObjTPA(x, y, TreeColor, 5, 1, 15, 120, 550, ['Cho']) Then
Begin
Writeln ('hooray we found a tree');
GetMousePos(x, y);

Case Random(2) Of
0: Mouse(X, Y, 5, 5, True); //Left click
1: Begin
Mouse(X, Y, 5, 5, False); //Right click
WaitOption('Chop', 500); //Waits for chop

end;
end;

Flag;
MarkTime(TreeCounter);
If (TimeFromMark (TooLong) > 30000) Then
FailSafe('Could Not Find Tree');

Repeat
If (TimeFromMark (TooLong) > 30000) Then
FailSafe('Could Not Find Tree');
FindNormalRandoms;
StatsGuise('Antiban and Waiting')

Antiban;
Wait(500);
if InvCount=PlusOne Then
Writeln ('we got one');
Until (InvCount=Plusone) Or (TimeFromMark(TreeCounter) > 5000) // change 10000 to make wait longer to cut tree or shorter
end;
end;


var
x, y: Integer;

function Bank(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.04, 1.14);

if not(FindColorsTolerance(arP, 2181721, MSX1, MSY1, MSX2, MSY2, 7)) then
begin
Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 3.75) and (X <= 10.34) and (Y >= 3.93) and (Y <= 10.83) and (Z >= 1.30) and (Z <= 4.25) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;

SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 10, 10);
arL := High(ararP);

for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('Bank')) then
begin;
Result := True;
Break;
end;
end;

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

if (i = arL + 1) then
begin
Writeln('FindObject could not find object.');
Exit;
end;

GetMousePos(fx, fy);
end;

Procedure DepLogs;
var
x, y, LogDtm, I:Integer;
SlotBox:TBox;
LogPattern:TIntegerArray;


Begin


LogDTM:= DTMFromString('mwQAAAHic42RgYLBkYmAwAWIrIHYGYlcg9gRiLyB2A2I7IL4HVPcCiN8B8Usgvg3Fzxggcq+BuDXLmqEtxxpMx7ppMvjbKDME2aqA2SCc6KnNQAxgJALDAQAftRKI');

LogPattern:=[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



SlotBox:= InvBox(LogPattern[I]);
If FindDTm(LogDTM,x,y,SlotBox.X1,SlotBox.Y1, SlotBox.X2, SlotBox.Y2) Then
Begin
MouseItem(LogPattern[I],0);
ChooseOption('Deposit-All');
end;
end;

end;

begin

SetupSRL;
DeclarePlayers;
SetAngle(SRL_ANGLE_LOW);

Repeat
Top;
ChopDown;
If InvFull Then
ReturnP;
Bank(x, y);
Mouse(X, Y, 5, 5, True);
wait(5000)
DepLogs;

Until(false);

End.

riwu

2012-05-01 05:05:17

do u mean it starts clicking other trees while u still chopping?
(TimeFromMark(TreeCounter) > 5000)

This means that it will start searching for tree again 5sec after u clicked the tree. What color u choose for the tree? Is it a similar colour to the ground or anything that it has been trying to click?

benny999

2012-05-01 06:02:05

nah it clicks other places

NKN

2012-05-01 17:05:11

Try choosing less colors in ACA, then click Best Color, or you could make a search area, so it only searches in that closed section.

benny999

2012-05-02 06:34:13

but from the tut i understand more the better? and it would be a pretty big area how do i do that?

benny999

2012-05-02 07:43:12

ugh its so frustrating i cant figure it out

benny999

2012-05-02 09:31:58

i figured it out :) working good now! now i wanna add it to say in a set area tweak the chopping a bit add fail safes best randoms fix it up dtms a bit figure out a few better things to learning so much atm hurts my brain

program PowerChooper;

{$DEFINE SRL5}
//{$DEFINE SMART}

{$i SRL/srl.simba}
{$i SPS/sps.simba}


Const
SRLStats_Username = ''; // Your SRL Stats Username
SRLStats_Password = ''; // Your SRL Stats Password
NumbOfPlayers = 1; //how how many players
StartPlayer = 0; //which player do you wanna start with 0 being the first
BreakEvery = 120; //how long till break
BreakFor = 5; //how long to break for
Version = '1.0'; //dont touch
Var
TooLong:Integer;

procedure DeclarePlayers;
var i:integer;
begin
NumberOFPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;
for i := 0 to NumbOfPlayers-1 do
Players[i].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];

with Players[0] do
begin
Name := ''; //Player username
Pass := ''; //Player Password
Active := True;
Integers[1] := 4; //which ore
Integers[2] := 4; //seconds to try mining ore
end;

end;
Var
myPath:TPointArray;
myrPath:TPointArray;
Procedure Top;
begin

SPS_Setup(RUNESCAPE_SURFACE,['11_7','10_7']);
myPath := [Point(4579, 2900), Point(4581, 2909), Point(4579, 2915),
Point(4578, 2920), Point(4564, 2931), Point(4550, 2935),
Point(4539, 2936),Point(4525, 2937), Point(4505, 2942),
Point(4495, 2952), Point(4483, 2965), Point(4467, 2975),
Point(4452, 2983), Point(4437, 2981), Point(4426, 2961),
Point(4420, 2947), Point(4408, 2936), Point(4395, 2941)];
SPS_WalkPath(myPath)
end;
Procedure ReturnP;
begin
SetupSRL;
SPS_Setup(RUNESCAPE_SURFACE,['11_7','10_7']);
myrPath := [Point(4381, 2913), Point(4395, 2936),
Point(4409, 2948), Point(4422, 2958), Point(4427, 2970),
Point(4436, 2983), Point(4449, 2984), Point(4461, 2979),
Point(4473, 2974), Point(4486, 2966), Point(4497, 2951),
Point(4509, 2940), Point(4523, 2932), Point(4539, 2934),
Point(4554, 2935), Point(4569, 2934), Point(4577, 2927),
Point(4580, 2911), Point(4580, 2902)];
SPS_WalkPath(myrPath)
end;




Procedure StatsGuise(wat:String);
Begin
Status(wat);
Disguise(wat);
end;


Procedure Antiban;
Begin
Case Random(250) of
0: Begin Statsguise ('AntiBan') GameTab(tab_Stats) HoverSkill('Magic', 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 FailSafe(Reason:String);
Begin
Players[CurrentPlayer].Loc:=Reason;
Logout;
Stats_Commit;
Writeln(Reason);
TerminateScript;
end;
function TreeColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.23, 0.84);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 2833223, MSX1, MSY1, MSX2, MSY2, 6);
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 >= 2.65) and (X <= 6.64) and (Y >= 2.66) and (Y <= 6.70) and (Z >= 1.95) and (Z <= 4.70) 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;


Function ChopDown:Boolean;
Var
xd, yd, PlusOne, TreeCounter: Integer;
begin
MarkTime(TooLong);
FindNormalRandoms;
PlusOne:= InvCount+1;
//if FindobjCustom (x, y, ['Chop', 'down'], [2042413, 1450529, 1252637, 1450786 ], 15 ) Then //moves mouse to colour
xd:=MSCX;
yd:=MSCY;
if FindObjTPA(xd, yd, TreeColor, 10, 1, 15, 100, 450, ['Cho']) Then
Begin
Writeln ('hooray we found a tree');
GetMousePos(xd, yd);

Case Random(2) Of
0: Mouse(Xd, Yd, 5, 5, True); //Left click
1: Begin
Mouse(Xd, Yd, 5, 5, False); //Right click
WaitOption('Chop', 500); //Waits for chop

end;
end;

Flag;
MarkTime(TreeCounter);
If (TimeFromMark (TooLong) > 30000) Then
FailSafe('Could Not Find Tree');

Repeat
If (TimeFromMark (TooLong) > 30000) Then
FailSafe('Could Not Find Tree');
FindNormalRandoms;
StatsGuise('Antiban and Waiting')

Antiban;
Wait(500);
if InvCount=PlusOne Then
Writeln ('we got one');
Until (InvCount=Plusone) Or (TimeFromMark(TreeCounter) > 5000) // change 10000 to make wait longer to cut tree or shorter
end;
end;


var
x, y: Integer;

function Bank(var fx, fy: Integer): Boolean;
var
arP: TPointArray;
ararP: T2DPointArray;
tmpCTS, i, arL: Integer;
P: TPoint;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.91, 3.75);

if not(FindColorsTolerance(arP, 2502979, MSX1, MSY1, MSX2, MSY2, 7)) then
begin
Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

SortTPAFrom(arP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arP, 10, 10);
arL := High(ararP);

for i := 0 to arL do
begin
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 0, 0);
Wait(100 + Random(100));
if (IsUpText('booth')) then
begin;
Result := True;
Break;
end;
end;

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

if (i = arL + 1) then
begin
Writeln('FindObject could not find object.');
Exit;
end;

GetMousePos(fx, fy);
end;

Procedure DepLogs;
var
LogDtm:Integer;




Begin


LogDTM:= DTMFromString('mlwAAAHicY2dgYLBgYmCwAWIHIHYEYncg9gBiZyC+B5R/A8RPgPg1EN8G4udQfmOGJUOItRRDtKsGQ6ybJkOIvSqY7W2hyIAPMOLBUAAATNENpg==');


Begin
MouseItem(LogDTM,0);
ChooseOption('Deposit-All');
end;


end;

begin

SetupSRL;
DeclarePlayers;
SetAngle(SRL_ANGLE_LOW);

Repeat

ChopDown;
If InvFull Then
begin
ReturnP;
Bank(x, y);
Mouse(X, Y, 5, 5, True);
wait(5000);
DepLogs;
Top;
end;

Until(false);

End.


well heres the script if anyone wanna test it start it to the west side of the cook guild with axe on you dont worry it wont dep your axe it only looks for logs pretty basic it banks at varrock west bank

fulldragons

2013-04-30 16:57:32

when i copy ur script a tried to play it. wrong message is that : [Error] (2:1): Unable to register function function SPS_FindMapInMap(out fx, fy: integer; LargeMap, SmallMap: T3DIntegerArray; tol: extended): integer; at line 1
Compiling failed.

is that for rs07?

fulldragons

2013-04-30 17:10:41

that dont work, this is the problem [Error] (2:1): Unable to register function function SPS_FindMapInMap(out fx, fy: integer; LargeMap, SmallMap: T3DIntegerArray; tol: extended): integer; at line 1
Compiling failed.

some help plz? is that for rs 07?