SRL Archive - Archive

sm0k3 - SRL Member Application


sm0k3

2013-04-13 20:21:22

How Long have You Played Runescape?
4 Year(s)


Are you affilated in anyway with Jagex LTD?
NO

Were you Referred to SRL?



What is your general programming knowledge?
html
Javascript
PascalScript
VB
Learning C++
CubeScript ( Sauerbraten Level Scripting )


Are you a member of any other communities?
Was an RSbuddy Member at one point
also can Be found@ XDA developers


Tell us about yourself…
From: sm0k3
i live in the uk and enjoy Gaming
music, Parkour, Scripting and making maps for a games ie Saurbraten / Farcry
have plans to start a webhosting buisness in the near future, and i love Linux altho tend to use windows due to using a lot of Windows only apps



Please show us one (or multiple) of your scripts.
TarCollecter (WIP) :

program TarCollect; // 0.4a beta
{$DEFINE SMART8}
{$i SRL/srl.simba}
{$i sps/sps.simba}
{$i SRL/SRL/misc/smartgraphics.simba}
{$i srl/srl/misc/online.simba}



{=====Player Details========================================}
const
PNAME = ''; {Your Players USERNAME here}
PPASS = ''; {Your Players PASSWORD here}

{=====Options===============================================}
DEBUGSMART = True; {DUBUG output on SMART?}
DEBUGS = True; {DEBUG output In Simba}

totalrun = 100;
{=================== LEAVE THESE ALONE ===================}
var
truns, TarPrice, NUMtar, EstProf,NUMruns: integer;
CurrTask: string;
TarPath1, TarPath2, TarCpoints: TPointArray;
TarINSCREEN: boolean;
{=========================================================}

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := PNAME;
Pass := PPASS;
BoxRewards := [''];
LampSkill := SKILL_PRAYER;
Pin := '';
Active := true;
end;
end;
{========================================================}







{===SCRIPT===============================================
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
========================================================}
procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour, Shadow: integer);
var
mx, my, Pic, I, B, H, TPH, Numb: Integer;
TTP: TPointArray;
begin
SmartSetDebug(True);
GetClientDimensions(mx,my);
Pic := BitmapFromString(mx,my,'');
TPH := High(TP);
for I := 0 to TPH do
begin
TTP := LoadTextTPA(TP[i], SmallChars, H);
for B := 0 to High(TTP) do
begin
Numb := ((I + 1) * 13);
FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1, Shadow);
FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
end;
end;

SMART_DrawBitmap(True,Pic, InttoPoint(Placement.x, Placement.y));
FreeBitmap(Pic);
end;

procedure StatsDebug;
begin
NUMtar := GetAmountBox(InvBox(1));
EstProf := TARPRICE * NUMtar;
PrintOnSmart(
['',
'',
'',
'',
' Tar Collector ',
' +======================+',
' Running: '+ TimeRunning,
'+======================+',
' ',
' Player Stats ',
' +====================+',
' Player: '+Capitalize(Players[CurrentPlayer].Name),
' Tar Collected: '+ToStr(NUMtar),
' Estimated Profit: '+ToStr(EstProf),
' Runs: '+ToStr(NUMruns),
' +====================+',
' Status: '+ToStr(CurrTask),
' +====================+'
], Point(10, 70), 196050, 135972);
end;

procedure RunStats;
begin
NUMtar := GetAmountBox(InvBox(1));
EstProf := TARPRICE * NUMtar;
writeln('====Stats================================');
writeln('+ Time Running: '+TimeRunning);
writeln('+ Tar Collected: '+ToStr(NUMtar));
writeln('+ Estimated Earnings: ' +ToStr(EstProf)+'GP');
writeln('=========================================');
end;

function FindObject(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
H, S, L: Extended;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);

if not(FindColorsTolerance(arP, 2763308, MSX1, MSY1, MSX2, MSY2, 5)) then
begin
if (DEBUGS = True) then Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
CurrTask := 'Searching';
Exit;
end;
TarCpoints := arP
arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);

for i := 0 to arL do
begin
ColorToHSL(arC[i], H, S, L);

if (H >= 0.00) and (H <= 8.35) and (S >= 1.94) and (S <= 2.82) and (L >= 15.27) and (L <= 21.00) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 1.93) and (X <= 3.49) and (Y >= 2.02) and (Y <= 3.63) and (Z >= 2.10) and (Z <= 3.78) 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;
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('Take')) then
begin;
Result := True;
TarINSCREEN := True;
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);

if (i = arL + 1) then
begin
if ( DEBUGS = True ) then Writeln('No tar here ?');
TarINSCREEN := False;
Exit;
end;

GetMousePos(fx, fy);
TarCpoints := arP;
end;


Function WithinBounderies(): Boolean;
var
P: TPoint;
Box: TBox;
begin
SPS_GatherMinimap;
P := SPS_GetMyPos;
Box := IntToBox(4360, 3839, 4531, 3938);
if ( DEBUGS = True ) then Writeln(ToStr(P));
if PointInBox(P, Box) then
begin
Result := True;
end
else
begin
writeln('Seem To Be lost ??');
Result := False;
end;
end;

procedure WalkBack;
begin
SPS_Blindwalk(Point(4519,3903));
while (IsMoving = True) do
begin
wait(100);
CurrTask := 'Walking Back';
StatsDebug;
end;
CurrTask := 'WalkLoop';
end;

procedure WalkToClosest;
var
i: TPointArray;
begin
CurrTask := 'Finding Tar Spots!!';
if ( DEBUGS = True ) then writeln('Finding closest Tar Spot');
StatsDebug;
RunStats;
try
i := GetMiniMapDots('red');
SortTPAFrom(i, Point(MMCX, MMCY));
if ( DEBUGSMART = True ) then SMART_DebugTPA(False,i); //testing>>>
Mouse(i[0].X + 6, i[0].Y + 4, 2, 0, mouse_left);
except
if ( DEBUGS = True ) then writeln('No Tar Spots Here :0');
If not WithinBounderies() then WalkBack;
finally
if ( DEBUGS = True ) then writeln('continuing to search');
CurrTask := 'WalkLoop';
// Wait(200);
StatsDebug;
end
end;

procedure DoPickup(xs,ys: integer);
begin
if not LoggedIn then LoginPlayer;
Wait(RandomRange(10,100));
MMouse(xs,ys, 0, 0); //use e.g. MMouse(xs,ys, 4, 4); since random movement better but will make misclicks happen tars to small
if IsUpTextMultiCustom(['Take','Tar']) then
begin
if ( DEBUGS = True ) then writeln('Found Tar');
ClickMouse2(mouse_right);
StatsDebug;
ChooseOptionMultiEx(['Take'],'',ClickLeft);
while (IsMoving = True) do
begin
wait(100);
end;
end
else
if ( DEBUGS = True ) then writeln('Theres no Tar? - Unless Something Went wrong');
TarINSCREEN := False;
end;

procedure DoCollect;
var
xe, ye: integer;
aFound: extended;
Dbox,Ebox: TPoint;
OBJBOX: TBox;
i: TPointArray;
begin
if not LoggedIn then LoginPlayer;
CurrTask := 'Search';
i := GetMiniMapDots('red');
while ( high(i) >= 1 ) and ( CurrTask = 'Search' ) do
begin
while (IsMoving = True) do
begin
StatsDebug;
wait(100);
end;
if ( DEBUGS = True ) then writeln('looking');
wait(RandomRange(50,200));
try FindObject(xe,ye);
if ( DEBUGSMART = True ) then SMART_DebugTPA(True,TarCpoints);
if ( DEBUGSMART = True ) then SMART_DebugTPA(false,i);
Dbox := IntToPoint(xe-5,ye-5);
Ebox := IntToPoint(xe+5,ye+5);
OBJBOX := PointToBox(Dbox,Ebox);
if ( DEBUGSMART = True ) then SMART_DrawBoxMS(False,False,OBJBOX,clblue);
while ( FindObject(xe,ye) = True ) do
begin
DoPickup(xe, ye);
end;
except
if ( DEBUGS = True ) then writeln('couldnt Find any Tar :0');
finally
if ( DEBUGS = True ) then writeln('Ill Keep Searching :)');
if ( DEBUGSMART = True ) then StatsDebug;
CurrTask := 'WalkLoop';
end;
end;
end;

procedure AntiBan;
begin
if not LoggedIn then Exit;
case Random(99) of
0: wait(500+random(3000));
1: begin
RandomMovement;
SetAngle(SRL_ANGLE_HIGH);
end;
3: PickUpMouse;
end;
end;

procedure DontActLikeAbot;
begin
If not WithinBounderies() then WalkBack;
AntiBan;
FindNormalRandoms;
end;

procedure WalkLoop;
var
i, mypath: integer;
mypathrand: TPointArray;
begin
If not WithinBounderies() then WalkBack;
mypath := random(2);
if (mypath = 1) then
begin
mypathrand := TarPath1;
end;
if (mypath = 2) then
begin
mypathrand := TarPath2;
end;
for i := 0 to High(mypathrand) do
begin
SPS_BlindWalk(mypathrand[i]);
//DoCollect;
WalkToClosest;
DoCollect;
if ( DEBUGSMART = True ) then StatsDebug;
RunStats;
end;
end;

procedure SetupScript;
begin
SRL_SIXHOURFIX := TRUE;
SMART_FIXSPEED := TRUE;
SetupSRL;
DeclarePlayers;
LoginPlayer;
Wait(774 + Random(277));
ClickNorth(SRL_ANGLE_HIGH);
SRL_Procs[SRL_Antiban] := @ DontActLikeAbot;
SPS_Setup(RUNESCAPE_SURFACE, ['10_9','11_9']);
SPS_AnyAngle := True;
TarPath1 := [Point(4533,3928),Point(4507,3928),Point(4484,3931),Point(4454,3932),Point(4447,3913),Point(4469,3893),Point(4487,3893),Point(4499,3903),Point(4516,3905),Point(4531,3912),Point(4534,3926)];
TarPath2 := [Point(4560,3929),Point(4579,3912),Point(4573,3894),Point(4545,3882),Point(4532,3868),Point(4519,3851),Point(4480,3842),Point(4450,3849),Point(4447,3876),Point(4469,3889),Point(4491,3896),Point(4515,3899),Point(4534,3922),Point(4557,3928)];
end;

procedure MainLoop;
begin
CurrTask := 'WalkLoop';
if not LoggedIn then LoginPlayer;
if ( DEBUGSMART = True ) then writeln('Starting Position: '+ ToStr(SPS_GetMyPos()));
while (CurrTask = 'WalkLoop') do
begin
NUMruns := NUMruns + 1;
if ( DEBUGSMART = True ) then StatsDebug;
WalkLoop;
end;
while (CurrTask = 'WalkingBack') do
begin
while (IsMoving = True) do
begin
StatsDebug;
wait(100);
end;
CurrTask := 'WalkLoop';
WalkLoop;
end;


if (truns = totalrun) then
CurrTask := 'STOP';
end;

begin
SMART_ClearCanvas;
NUMtar := GetAmountBox(InvBox(1));
NUMruns := 0;
SetupScript;
TarPrice := GETGEprice(1939);
CurrTask := 'Starting';
if ( DEBUGSMART = True ) then StatsDebug;
MainLoop;
CurrTask := 'NONE';
if ( DEBUGSMART = True ) then StatsDebug;
SMART_ClearCanvas;
end.
Edit: updated to latest version






SMARTchat : i have left this in as this still works for me so i hope it does for others it is linked as its a package and the instructions need to be read … but i will also attach it here unless people want me to add more simba tags

SMARTchat

SMARTchat.sex

program SMARTchat;
// SMART CHAT V0.1A By : Sm0k3 & ggzz

// Allows You To Use The chat In a Game When SMART Wont Let You
// To Use This Script ADD The Following To Each of you Scripts:
//
// {$I SRL/SRL/SMARTchat/SMARTChat.simba}

// And then Call it as Often as possible By adding the line

// WriteSMART;

// Please make sure you Have allready Setup The SMARTchat extension
// Instructions Are Here :
// HTTP://http://villavu.com/forum/showthread.php?t=63432

// Credits Got To ggzz For A lot Of Help Whith This Extension
// And the Accompanying Include's ..








function GetName : string;
begin;
result := 'SMARTchat';
end;

function GetVersion : string;
begin;
result := '0.1a';
end;

var
MainMenuItem, MenuSMARTForm: TMenuItem;
//{$ifndef PS_EXTENSION}
//var
// Client: TClient;
// Simba_MainMenu: TMainMenu;
//{$endif}
//{$i mml.simba}

procedure SMARTReadLine(Sender: TObject);
var
TheLine: string;
begin
inputQuery('SMARTchat', 'Say :', TheLine);
if (Length(TheLine) > 0) then
begin
WriteINI('Changed', 'Changed', 'True', IncludePath+'SRL/SRL/SMARTchat/SMARTchat.INI');
WriteINI('SMART', 'SMART', TheLine, IncludePath+'SRL/SRL/SMARTchat/SMARTchat.INI');
writeln('::SMARTchat:: Sending > '+TheLine+' < To Client Chat')
end;
end;

//type TKeyPressEvent = procedure (Sender: TObject; var Key: Char) of object;
{
procedure KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
var
TheLine: string;
begin
if (Key = VK_F12) then
begin
inputQuery('SMARTchat', 'Say :', TheLine);
if (Length(TheLine) > 0) then
begin
WriteINI('Changed', 'Changed', 'True', IncludePath+'SRL/SRL/SMARTchat/SMARTchat.INI');
WriteINI('SMART', 'SMART', TheLine, IncludePath+'SRL/SRL/SMARTchat/SMARTchat.INI');
writeln('::SMARTchat:: Sending > '+TheLine+' < To Client Chat')
end;
end;
end;
}

procedure Init;
var
TheLine: string;
begin
MainMenuItem := TMenuItem.Create(Simba_MainMenu);
MainMenuItem.Caption := 'SMARTchat';
Simba_MainMenu.Items.Add(MainMenuItem);
MenuSMARTForm := TMenuItem.Create(MainMenuItem);
MenuSMARTForm.Caption := 'SMARTChat';
MenuSMARTForm.ShortCut := 123;
MenuSMARTForm.OnClick := @SMARTReadLine;
MainMenuItem.Add(MenuSMARTForm);

end;

procedure Free;
begin

end;

procedure Attach;
begin
writeln(' SMARTchat By Sm0k3 & ggzz ');
Writeln('# SMARTchat Simba Extension #');
Writeln('# Allows you to Enter Text #');
Writeln('# Into The SMART client #');
Writeln('# Without Having Mess about #');
end;

Procedure Detach;
begin
Writeln('SMARTchat: > Goodbye ...');
Writeln('SMARTchat : : Sm0k3 & ggzz');
end;
Begin
End.

EDIT: i still think that [ATTACH]20661[/ATTACH] should be considered or at least looked at as altho its now deprecated it does a good job of showing what i am capable of it includes a form, reading from external files (ini) and so on and was one of my best scripts so ok it may not be valid but i still think people should take a look if they wish

Sjoe

2013-04-13 20:34:10

Better if u post your scripts here in simba tags :)

We are lazy people.

rj

2013-04-13 20:52:46

From: Sjoekeloe
Better if u post your scripts here in simba tags :)

We are lazy people.


Yes this. Also I think you can only apply with up-to date scripts,(which would only be your tar collector) but I like your slogan "collects tar so you don't have to" what bot is that from?

Sin

2013-04-13 20:57:22

From: Officer Barbrady
Yes this. Also I think you can only apply with up-to date scripts,(which would only be your tar collector) but I like your slogan "collects tar so you don't have to" what bot is that from?


Auto SwampTar Pro

sm0k3

2013-04-13 21:54:22

is it now , seriously i used that slogan cos it sounded cool and collecting tar takes ages so it fit … never used AutoswampTarPro so weird coincidence what bot clients that from anyway ….. also im not sure why SMARTchat not current as its an extension and include so should still work
and SnapeRunner Will work with a small modification i just cant put it online at moment as my copy is missing now so cant use that either

Sjoe

2013-04-13 21:58:57

From: sm0k3
is it now , seriously i used that slogan cos it sounded cool and collecting tar takes ages so it fit … never used AutoswampTarPro so weird coincidence what bot clients that from anyway ….. also im not sure why SMARTchat not current as its an extension and include so should still work
and SnapeRunner Will work with a small modification i just cant put it online at moment as my copy is missing now so cant use that either


Post scripts in simbatags , instead of re-directing the links.

The Mayor

2013-04-13 22:00:08

From: Sjoekeloe
Better if u post your scripts here in simba tags :)

We are lazy people.


This. People will look down, see no script, vote no.

Sjoe

2013-04-13 22:10:46

From: sm0k3
is it now , seriously i used that slogan cos it sounded cool and collecting tar takes ages so it fit … never used AutoswampTarPro so weird coincidence what bot clients that from anyway ….. also im not sure why SMARTchat not current as its an extension and include so should still work
and SnapeRunner Will work with a small modification i just cant put it online at moment as my copy is missing now so cant use that either

and for the lazy ones lol

TarCollector
++++++++++++++++

//small problem with boundry check works fine but is spamming debug thinking its lost when debugs is set true
program TarCollect; // 0.1beta
{$DEFINE SMART8}
{$i SRL/srl.simba}
{$i sps/sps.simba}
{$i SRL/SRL/misc/smartgraphics.simba}
{$i srl/srl/misc/online.simba}



{=====Player Details========================================}
const
PNAME = ''; {Your Players USERNAME here}
PPASS = ''; {Your Players PASSWORD here}

{=====Options===============================================}
DEBUGSMART = True; {DUBUG output on SMART?}
DEBUGS = True; {DEBUG output In Simba}










totalrun = 100;
{=================== LEAVE THESE ALONE ===================}
var
truns, TarBMP, TarDTM, TarPrice, NUMtar, EstProf,NUMruns: integer;
Status, CurrTask: string;
TarPath1, TarPath2, TarCpoints: TPointArray;
TarINSCREEN: boolean;
{=========================================================}

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := PNAME;
Pass := PPASS;
BoxRewards := [''];
LampSkill := SKILL_PRAYER;
Pin := '';
Active := true;
end;
end;
{========================================================}







{===SCRIPT===============================================
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
========================================================}
procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour, Shadow: integer);
var
mx, my, Pic, I, B, H, TPH, Numb: Integer;
TTP: TPointArray;
Canvas: TCanvas;
begin
SmartSetDebug(True);
GetClientDimensions(mx,my);
Pic := BitmapFromString(mx,my,'');
TPH := High(TP);
for I := 0 to TPH do
begin
TTP := LoadTextTPA(TP[i], SmallChars, H);
for B := 0 to High(TTP) do
begin
Numb := ((I + 1) * 13);
FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1, Shadow);
FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
end;
end;
SMART_DrawBitmap(True,Pic, InttoPoint(Placement.x, Placement.y));
FreeBitmap(Pic);
end;

procedure StatsDebug;
begin
NUMtar := GetAmountBox(InvBox(1));
EstProf := TARPRICE * NUMtar;
PrintOnSmart(
['',
'',
'',
'',
' Tar Collector ',
' +======================+',
' Running: '+ TimeRunning,
'+======================+',
' ',
' Player Stats ',
' +====================+',
' Player: '+Capitalize(Players[CurrentPlayer].Name),
' Tar Collected: '+ToStr(NUMtar),
' Estimated Profit: '+ToStr(EstProf),
//' Runs: '+ToStr(NUMruns),
' +====================+',
' Status: '+ToStr(CurrTask),
' +====================+'
], Point(10, 70), 196050, 135972);
end;

procedure RunStats;
begin
NUMtar := GetAmountBox(InvBox(1));
EstProf := TARPRICE * NUMtar;
writeln('====Stats================================');
writeln('+ Time Running: '+TimeRunning);
writeln('+ Tar Collected: '+ToStr(NUMtar));
writeln('+ Estimated Earnings: ' +ToStr(EstProf)+'GP');
writeln('=========================================');
end;

function FindObject(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
H, S, L: Extended;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);

if not(FindColorsTolerance(arP, 2960944, MSX1, MSY1, MSX2, MSY2, 13)) then
begin
if (DEBUGS = True) then Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
CurrTask := 'Searching';
Exit;
end;
TarCpoints := arP
arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);

for i := 0 to arL do
begin
ColorToHSL(arC[i], H, S, L);

if (H >= 0.00) and (H <= 8.35) and (S >= 1.94) and (S <= 2.82) and (L >= 15.27) and (L <= 21.00) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 1.93) and (X <= 3.49) and (Y >= 2.02) and (Y <= 3.63) and (Z >= 2.10) and (Z <= 3.78) 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;
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('Take')) then
begin;
Result := True;
TarINSCREEN := True;
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);

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

GetMousePos(fx, fy);
TarCpoints := arP;
end;


Function WithinBounderies(): Boolean;
var
P: TPoint;
Box: TBox;
begin
SPS_GatherMinimap;
P := SPS_GetMyPos;
Box := IntToBox(4505, 3900, 4585, 3997);
if ( DEBUGSMART = True ) then SMART_DrawBoxMS(True,False,Box,cLgreen);
if ( DEBUGS = True ) then Writeln(ToStr(P));
if PointInBox(P, Box) then
begin
Result := True;
end
else
begin
writeln('Seem To Be lost ??');
Result := False;
end;
end;

procedure WalkBack;
begin
SPS_Blindwalk(Point(4519,3903));
while (IsMoving = True) do
begin
wait(100);
CurrTask := 'Walking Back';
StatsDebug;
end;
CurrTask := 'WalkLoop';
end;

procedure WalkToClosest;
var
i: TPointArray;
begin
CurrTask := 'Finding Tar Spots!!';
if ( DEBUGS = True ) then writeln('Finding closest Tar Spot');
StatsDebug;
RunStats;
try
i := GetMiniMapDots('red');
SortTPAFrom(i, Point(MMCX, MMCY));
if ( DEBUGSMART = True ) then SMART_DebugTPA(False,i); //testing>>>
Mouse(i[0].X + 6, i[0].Y + 4, 2, 0, mouse_left);
except
if ( DEBUGS = True ) then writeln('No Tar Spots Here :0');
If not WithinBounderies() then WalkBack;
finally
if ( DEBUGS = True ) then writeln('continuing to search');
CurrTask := 'WalkLoop';
Wait(200);
StatsDebug;
end
end;

procedure DoPickup(xs,ys: integer);
begin
if not LoggedIn then LoginPlayer;
Wait(RandomRange(10,200));
MMouse(xs,ys, 0, 0); //use e.g. MMouse(xs,ys, 4, 4); since random movement better
if IsUpTextMultiCustom(['Take','Tar']) then // If statement is if that statement is true
begin
if ( DEBUGS = True ) then writeln('found tar');
ClickMouse2(mouse_right);
StatsDebug;
Wait(RandomRange(100,300));
ChooseOptionMultiEx(['Take'],'',ClickLeft);
while (IsMoving = True) do
begin
wait(100);
end;
end
else
if ( DEBUGS = True ) then writeln('Theres no Tar? - Unless Something Went wrong');
TarINSCREEN := False;
end;

procedure DoCollect;
var
xe, ye: integer;
aFound: extended;
Dbox,Ebox: TPoint;
OBJBOX: TBox;
i: TPointArray;
begin
if not LoggedIn then LoginPlayer;
CurrTask := 'Search';
i := GetMiniMapDots('red');
while ( high(i) >= 1 ) and ( CurrTask = 'Search' ) do
begin
while (IsMoving = True) do
begin
StatsDebug;
wait(100);
end;
if ( DEBUGS = True ) then writeln('looking');
wait(RandomRange(50,200));
try FindObject(xe,ye);
if ( DEBUGSMART = True ) then SMART_DebugTPA(True,TarCpoints);
if ( DEBUGSMART = True ) then SMART_DebugTPA(false,i);
Dbox := IntToPoint(xe-5,ye-5);
Ebox := IntToPoint(xe+5,ye+5);
OBJBOX := PointToBox(Dbox,Ebox);
if ( DEBUGSMART = True ) then SMART_DrawBoxMS(False,False,OBJBOX,clblue);
while ( FindObject(xe,ye) = True ) do
begin
DoPickup(xe, ye);
end;
except
if ( DEBUGS = True ) then writeln('couldnt Find any Tar :0');
finally
if ( DEBUGS = True ) then writeln('Ill Keep Searching :)');
if ( DEBUGSMART = True ) then StatsDebug;
CurrTask := 'WalkLoop';
end;
end;
end;

procedure DontActLikeAbot;
begin
If not WithinBounderies() then WalkBack;
end;

procedure WalkLoop;
var
i, mypath: integer;
mypathrand: TPointArray;
begin
If not WithinBounderies() then WalkBack;
mypath := random(2);
if (mypath = 1) then
begin
mypathrand := TarPath1;
end;
if (mypath = 2) then
begin
mypathrand := TarPath2;
end;
for i := 0 to High(mypathrand) do
begin
//SPS_BlindWalk(mypathrand[i]);
//DoCollect;
WalkToClosest;
DoCollect;
if ( DEBUGSMART = True ) then StatsDebug;
RunStats;
end;
end;

procedure SetupScript;
begin
SRL_SIXHOURFIX := TRUE;
SMART_FIXSPEED := TRUE;
SetupSRL;
DeclarePlayers;
LoginPlayer;
Wait(774 + Random(277));
ClickNorth(SRL_ANGLE_HIGH);
SRL_Procs[SRL_Antiban] := @ DontActLikeAbot;
SPS_Setup(RUNESCAPE_SURFACE, ['10_9','11_9']);
SPS_AnyAngle := True;
TarPath1 := [Point(4533,3928),Point(4507,3928),Point(4484,3931),Point(4454,3932),Point(4447,3913),Point(4469,3893),Point(4487,3893),Point(4499,3903),Point(4516,3905),Point(4531,3912),Point(4534,3926)];
TarPath2 := [Point(4560,3929),Point(4579,3912),Point(4573,3894),Point(4545,3882),Point(4532,3868),Point(4519,3851),Point(4480,3842),Point(4450,3849),Point(4447,3876),Point(4469,3889),Point(4491,3896),Point(4515,3899),Point(4534,3922),Point(4557,3928)];
end;

procedure MainLoop;
begin
CurrTask := 'WalkLoop';
if not LoggedIn then LoginPlayer;
if ( DEBUGSMART = True ) then writeln('Starting Position: '+ ToStr(SPS_GetMyPos()));
while (CurrTask = 'WalkLoop') do
begin
NUMruns := NUMruns + 1;
if ( DEBUGSMART = True ) then StatsDebug;
WalkLoop;
end;
while (CurrTask = 'WalkingBack') do
begin
while (IsMoving = True) do
begin
StatsDebug;
wait(100);
end;
CurrTask := 'WalkLoop';
WalkLoop;
end;


if (truns = totalrun) then
CurrTask := 'STOP';
end;

begin
NUMruns := 0;
SetupScript;
TarPrice := GETGEprice(1939);
CurrTask := 'Starting';
if ( DEBUGSMART = True ) then StatsDebug;
MainLoop;
CurrTask := 'NONE';
if ( DEBUGSMART = True ) then StatsDebug;
SMART_ClearCanvas;
end.


Put this OP instead of your links :p

sm0k3

2013-04-13 22:40:34

Right i have update OP to show the recommended changes
and thank you for the suggestions

masterBB

2013-04-14 06:25:53

Could you think of a way to remove the try..except..finally.. from WalkToClosest?

sm0k3

2013-04-14 08:56:30

well the reason the try..except..finally.. is that on my machine GetMiniMapDots('red'); totaly crashes simba if there are no minimap dots at the time … so the try statement is there purely as it carrys on looking instead of crashing so im sure it could be different but ill be honest i dont have a clue why simba crashes but ill take a look into it

Olly

2013-04-14 11:11:16

From: sm0k3
well the reason the try..except..finally.. is that on my machine GetMiniMapDots('red'); totaly crashes simba if there are no minimap dots at the time … so the try statement is there purely as it carrys on looking instead of crashing so im sure it could be different but ill be honest i dont have a clue why simba crashes but ill take a look into it


It's a problem with your code, you aren't actually checking if you found any npc dots or not.

masterBB

2013-04-14 12:43:31

From: Ollybest
It's a problem with your code, you aren't actually checking if you found any npc dots or not.


Don't give hints :P

Benny

2013-04-14 13:05:04

So I'm leaning towards a no vote mainly due to the fact that members is a community rank as well. You have posted a bit but I haven't really seen you around. :(

Try and get more active so we can get to know you.

Olly

2013-04-14 13:05:41

From: masterBB
Don't give hints :P


pshh, for me that's pretty good, i normally straight give out the code :p

on topic though im going to have to vote no, a basic autocolor find obj function SPS walking isn't enough for me im afraid.

sm0k3

2013-04-14 13:44:49

@masterBB; and @Ollybest; well what about this …


function FindClosest(): TPointArray;
var i: TPointArray;
begin
CurrTask := 'Finding Tar Spots!!';
if ( DEBUGS = True ) then writeln('Finding closest Tar Spot');
if ( CountDots('red') <=1 ) then
begin
writeln('No Tar Spots Here :0');
Dotsonmm := false;
end
else
i := GetMiniMapDots('red');
if ( DEBUGSMART = True ) then SMART_DebugTPA(False,i);
result := i;
DoCollect;
end;

procedure WalkToClosest;
var i : TPointArray;
begin
StatsDebug;
RunStats;
i := FindClosest;
if (dotsonMM) then SortTPAFrom(i, Point(MMCX, MMCY));
If not WithinBounderies() then WalkBack;
Mouse(i[0].X + 6, i[0].Y + 4, 2, 0, mouse_left);
if ( DEBUGS = True ) then writeln('continuing to search');
CurrTask := 'WalkLoop';
while (IsMoving = True) do
begin
StatsDebug;
wait(100);
end;
end;


well thats why i had to include the other scripts as well ie if reflection hadn't broken hiker was damn good i think
smartchat shows i have an understanding of how simbas extensions work also

also im online everyday most of the day i just dont post as much as i try to only give usable input but im now master progrmmer or anything and you guys tend to get there first whith a better response :ahem excuses

the only reason i havent been seen so much since 2011 is ive only had the net back for 2 months now spent a long time internetless lol
a tad enlightening realy …..

masterBB

2013-04-14 16:05:47

Now try it without a second function, without a global var and without adding more then one line ;)

Hint: The error shows up when there are no points stored in i.

sm0k3

2013-04-14 16:48:21


procedure WalkToClosest;
var
i: TPointArray;
begin
CurrTask := 'Finding Tar Spots!!';
if ( DEBUGS = True ) then writeln('Finding closest Tar Spot');
StatsDebug;
RunStats;
i := GetMiniMapDots('red');
if ( Length(i) >=0 ) then
begin
SortTPAFrom(i, Point(MMCX, MMCY));
if ( DEBUGSMART = True ) then SMART_DebugTPA(False,i); //testing>>>
Mouse(i[0].X + 6, i[0].Y + 4, 2, 0, mouse_left);
end
else
begin
if ( DEBUGS = True ) then writeln('No Tar Spots Here :0');
if not WithinBounderies() then WalkBack;
if ( DEBUGS = True ) then writeln('continuing to search');
end;
CurrTask := 'WalkLoop';
StatsDebug;
end;

Better? lol i can do it i just tend to go the long way round :]


also @Ollybest; sps isn't really used much anyway the sps points are actually approx locations of the tar it only walk to the sps points occasional,y most of the time it calculates the closes next piece of tar from minimap dots
it will some times pick 1 of two paths to make it look like its following some kind of order more often tho it goes clockwise if you see walkToClosest gets called more often , the sps path is also a kind of fail-safe along with WithinBoundarys (buggy) incase it cant see any tar on the MM it'll walk back allong the path uuntill it begins to find tar again

masterBB

2013-04-14 17:02:45

From: sm0k3
Better? lol i can do it i just tend to go the long way round :]


Exactly what I was looking for. Only doesn't it need to be > instead of <= ?

sm0k3

2013-04-14 17:10:07

From: masterBB
Exactly what I was looking for. Only doesn't it need to be > instead of <= ?


oh yes good point fixed lol

cause

2013-04-15 01:22:28

Voted yes.
EDIT: Who and why are voting no? This script is more than adequate and he is responding to critiques very well as well as being active-ish

masterBB

2013-04-15 07:43:20

From: cause
Voted yes.
EDIT: Who and why are voting no? This script is more than adequate and he is responding to critiques very well as well as being active-ish


Okay Okay, I will give a real vote. However, I don't see how it is "more than adequate", what part really convinced you? Just curious.

Complete script review! (super rare from me ;) ) I really liked the script and I can see you put a lot of work in it. However, there are a few things that could be improved to make it "Members worthy".

  • Too much global vars
  • CurrTask creates more confusing in the script then it should, main reason for a lot of problems
  • You never call your antiban
  • You call "if Debug = True then print(X);" very often, consider creating a procedure for that
  • if x = True then is the same as if x then
  • Mainloop needs to be rewritten, cause it doesn't function like you think it does.
  • Some var/proc aren't descriptive of what they do. They either do more, or the name doesn't describe anything.
  • Standards could be better
  • A lot of while loops are potential endless loops
  • Try to pass more information into functions with parameters and return values

Read the comments for more in depth critics.

var
truns, TarPrice, NUMtar, EstProf, NUMruns: integer;
CurrTask: string; //This one might be better suited as a var in the mainloop function
TarPath1, TarPath2, TarCpoints: TPointArray; //Do these really need to be globals?
TarINSCREEN: boolean; //" "

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := PNAME;
Pass := PPASS;
BoxRewards := [''];
LampSkill := SKILL_PRAYER;
Pin := '';
Active := true;
end;
end;

//Just wondering, did you wrote this procedure?
procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour, Shadow: integer);
var
mx, my, Pic, I, B, H, TPH, Numb: Integer;
TTP: TPointArray;
begin
SmartSetDebug(True);
GetClientDimensions(mx, my);
Pic := BitmapFromString(mx, my, '');
TPH := High(TP);
for I := 0 to TPH do
begin
TTP := LoadTextTPA(TP[i], SmallChars, H);
for B := 0 to High(TTP) do
begin
Numb := ((I + 1) * 13);
FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1, Shadow);
FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
end;
end;
SMART_DrawBitmap(True, Pic, InttoPoint(Placement.x, Placement.y));
FreeBitmap(Pic);
end;

procedure StatsDebug;
begin
NUMtar := GetAmountBox(InvBox(1));
//Doesn't need to be a global, also NUMtar isn't a good name. Since the type is an Integer, we already know it is a number. For example TarCount would be better.
EstProf := TARPRICE * NUMtar;
//Doesn't need to be a global var.
PrintOnSmart(['', '', '', '', ' Tar Collector ', ' +======================+', ' Running: ' + TimeRunning, '+======================+', ' ', ' Player Stats ', ' +====================+', ' Player: ' + Capitalize(Players[CurrentPlayer].Name), ' Tar Collected: ' + ToStr(NUMtar), ' Estimated Profit: ' + ToStr(EstProf), ' Runs: ' + ToStr(NUMruns), ' +====================+', ' Status: ' + ToStr(CurrTask), ' +====================+'], Point(10, 70), 196050, 135972);
end;

procedure RunStats; //Can be combined with StatsDebug in one procedure.
begin
NUMtar := GetAmountBox(InvBox(1)); //same comments
EstProf := TARPRICE * NUMtar;
writeln('====Stats================================');
writeln('+ Time Running: ' + TimeRunning);
writeln('+ Tar Collected: ' + ToStr(NUMtar));
writeln('+ Estimated Earnings: ' + ToStr(EstProf) + 'GP');
writeln('=========================================');
end;

function FindObject(var fx, fy: Integer): Boolean; //taken from aca, not going to comment the first part.
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
H, S, L: Extended;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
if not (FindColorsTolerance(arP, 2763308, MSX1, MSY1, MSX2, MSY2, 5)) then
begin
if (DEBUGS = True) then
Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
CurrTask := 'Searching';
Exit;
end;
TarCpoints := arP arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);
for i := 0 to arL do
begin
ColorToHSL(arC[i], H, S, L);
if (H >= 0.00) and (H <= 8.35) and (S >= 1.94) and (S <= 2.82) and (L >= 15.27) and (L <= 21.00) then
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 1.93) and (X <= 3.49) and (Y >= 2.02) and (Y <= 3.63) and (Z >= 2.10) and (Z <= 3.78) 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;
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);
if (IsUpText('Take')) then
begin
Result := True;
TarINSCREEN := True; //Doesn't need to be a global, this function could return this.
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
if (i = arL + 1) then
begin
if (DEBUGS = True) then
Writeln('No tar here ?');
TarINSCREEN := False; //same
Exit;
end;
GetMousePos(fx, fy); //Not required in this function
TarCpoints := arP; //can be a function paramater.
end;

function WithinBounderies(): Boolean;
var
P: TPoint;
Box: TBox;
begin
SPS_GatherMinimap;
P := SPS_GetMyPos;
Box := IntToBox(4360, 3839, 4531, 3938);

if (DEBUGS = True) then
Writeln(ToStr(P)); //ToStr is not required.

//rewrote this part for you
Result := PointInBox(P, Box)

if not(Result) then
writeln('Seem To Be lost ??');
end;

procedure WalkBack;
begin
SPS_Blindwalk(Point(4519, 3903));
while (IsMoving = True) do //possible endless loop, always use a counter and a maximum amount of time it can be in.
begin
wait(100); //Even though it is in a loop, always use some random
CurrTask := 'Walking Back'; //not required, could be passed to StatsDebug directly with a parameter, in mainloop it only knows this without space
StatsDebug;
end;
CurrTask := 'WalkLoop';
end;

procedure WalkToClosest;
var
i: TPointArray;
begin
CurrTask := 'Finding Tar Spots!!';
if (DEBUGS = True) then
writeln('Finding closest Tar Spot');
StatsDebug;
RunStats;
try //as mentioned in thread, not required to use a try..except
i := GetMiniMapDots('red');
SortTPAFrom(i, Point(MMCX, MMCY));
if (DEBUGSMART = True) then
SMART_DebugTPA(False, i);
Mouse(i[0].X + 6, i[0].Y + 4, 2, 0, mouse_left);
except
if (DEBUGS = True) then
writeln('No Tar Spots Here :0');
if not WithinBounderies() then
WalkBack;
finally
if (DEBUGS = True) then
writeln('continuing to search');
CurrTask := 'WalkLoop';
StatsDebug;
end
end;

procedure DoPickup(xs, ys: integer);
begin
if not LoggedIn then
LoginPlayer; //if not LoginPlayer then TerminateScript; ?

Wait(RandomRange(10, 100));
MMouse(xs, ys, 0, 0); //No random?

if IsUpTextMultiCustom(['Take', 'Tar']) then
begin
if (DEBUGS = True) then
writeln('Found Tar');
ClickMouse2(mouse_right);
StatsDebug;
ChooseOptionMultiEx(['Take'], '', ClickLeft);

while (IsMoving = True) do //Possibly endless loop, see prev comment
wait(100); //non random wait
end else if (DEBUGS = True) then
writeln('Theres no Tar? - Unless Something Went wrong');

TarINSCREEN := False; //Doesn't need to be global
end;

procedure DoCollect;
var
xe, ye: integer;
aFound: extended;
Dbox, Ebox: TPoint;
OBJBOX: TBox;
i: TPointArray;
begin
if not LoggedIn then
LoginPlayer;
CurrTask := 'Search';
i := GetMiniMapDots('red');
while (high(i) >= 1) and (CurrTask = 'Search') do
begin
while (IsMoving = True) do
begin
StatsDebug;
wait(100);
end;
if (DEBUGS = True) then
writeln('looking');
wait(RandomRange(50, 200));
try //I don't even see what exception this can catch?
FindObject(xe, ye); //if FindObject then ?

if (DEBUGSMART = True) then //I simplified this
begin
SMART_DebugTPA(True, TarCpoints);
SMART_DebugTPA(false, i);
end;

Dbox := IntToPoint(xe - 5, ye - 5); //The funny thing is, it is not a box ;)
Ebox := IntToPoint(xe + 5, ye + 5);
OBJBOX := PointToBox(Dbox, Ebox); //Can be set with IntToBox

if (DEBUGSMART = True) then
SMART_DrawBoxMS(False, False, OBJBOX, clblue);

while (FindObject(xe, ye) = True) do //possibly endless loop, no waits
DoPickup(xe, ye);
except
if (DEBUGS = True) then
writeln('couldnt Find any Tar :0');
finally
if (DEBUGS = True) then
writeln('Ill Keep Searching :)');
if (DEBUGSMART = True) then
StatsDebug;
CurrTask := 'WalkLoop';
end;
end;
end;

procedure AntiBan;
begin
if not LoggedIn then
Exit;
case Random(99) of
0: wait(500 + random(3000));
1:
begin
RandomMovement;
SetAngle(SRL_ANGLE_HIGH);
end;
3: PickUpMouse;
end;
end;

procedure DontActLikeAbot; //should be combined with AntiBan to one proc
begin
if not WithinBounderies() then
WalkBack;

AntiBan;
FindNormalRandoms;
end;

procedure WalkLoop;
var
i, mypath: integer;
mypathrand: TPointArray;
begin
if not WithinBounderies() then
WalkBack;

mypath := random(2); //if you make TarPath(s) an ATPA you can do TarPaths[random(2)]

if (mypath = 1) then //random(2) == 0 or 1
mypathrand := TarPath1
else if (mypath = 2) then
mypathrand := TarPath2;

for i := 0 to High(mypathrand) do
begin
SPS_BlindWalk(mypathrand[i]); //No check if it succeeded?
WalkToClosest;
DoCollect;
if (DEBUGSMART = True) then
StatsDebug;
RunStats;
end;

end;

procedure SetupScript;
begin
SRL_SIXHOURFIX := TRUE;
SMART_FIXSPEED := TRUE;
SetupSRL;
DeclarePlayers;
LoginPlayer;
Wait(774 + Random(277));
ClickNorth(SRL_ANGLE_HIGH);
SRL_Procs[SRL_Antiban] := @ DontActLikeAbot; //This isn't enough. Also add it in procedures manually
SPS_Setup(RUNESCAPE_SURFACE, ['10_9', '11_9']);
SPS_AnyAngle := True;
TarPath1 := [Point(4533, 3928), Point(4507, 3928), Point(4484, 3931), Point(4454, 3932), Point(4447, 3913), Point(4469, 3893), Point(4487, 3893), Point(4499, 3903), Point(4516, 3905), Point(4531, 3912), Point(4534, 3926)];
TarPath2 := [Point(4560, 3929), Point(4579, 3912), Point(4573, 3894), Point(4545, 3882), Point(4532, 3868), Point(4519, 3851), Point(4480, 3842), Point(4450, 3849), Point(4447, 3876), Point(4469, 3889), Point(4491, 3896), Point(4515, 3899), Point(4534, 3922), Point(4557, 3928)];
end;

procedure MainLoop; //Should be rewritten to get rid of the confusing CurrTask global var, call your antiban more often
begin
CurrTask := 'WalkLoop';

if not LoggedIn then
LoginPlayer;

if (DEBUGSMART = True) then
writeln('Starting Position: ' + ToStr(SPS_GetMyPos()));

while (CurrTask = 'WalkLoop') do
begin
NUMruns := NUMruns + 1;
if (DEBUGSMART = True) then
StatsDebug;
WalkLoop; //Does a lot more then just walk, bad proc name
end;

while (CurrTask = 'WalkingBack') do //There is not a single place where it can be set to WalkingBack
begin
while (IsMoving = True) do //possibly endless loop, add a timer
begin
StatsDebug;
wait(100); //non random wait
end;
CurrTask := 'WalkLoop';
WalkLoop;
end;
if (truns = totalrun) then //it is not in the loop itself, will never be checked
CurrTask := 'STOP'; //What happens if it is set to stop? Same as what would happen if truns != totalrun
end;

It is not that I didn't like the script or wanted to burn down the script. I just commented on what I think you can do better. It is a great script to start with, but it could be better. Good luck, I am sure you will get there.

Voted yes because you solved previous assignment from me.

sm0k3

2013-04-15 12:13:53

@masterBB; thank you for that as now i can review and better my standards/techniques
i believe i have miss understood how SRL_procs work as calling SRL_Procs[SRL_Antiban] := @ DontActLikeAbot;
i believed would be enough ..

as for the script it would probably help if i had updated the script in op to show latest edits

also could you elaborate for me on this

Dbox := IntToPoint(xe - 5, ye - 5); //The funny thing is, it is not a box ;)
Ebox := IntToPoint(xe + 5, ye + 5);
OBJBOX := PointToBox(Dbox, Ebox); //Can be set with IntToBox

whats wrong with my box … i may just be being slow here .. altho i have been wondering about this ..

will have an update here shortly

masterBB

2013-04-15 12:41:18

From: sm0k3
@masterBB; thank you for that as now i can review and better my standards/techniques
i believe i have miss understood how SRL_procs work as calling SRL_Procs[SRL_Antiban] := @ DontActLikeAbot;
i believed would be enough ..

as for the script it would probably help if i had updated the script in op to show latest edits

also could you elaborate for me on this

Dbox := IntToPoint(xe - 5, ye - 5); //The funny thing is, it is not a box ;)
Ebox := IntToPoint(xe + 5, ye + 5);
OBJBOX := PointToBox(Dbox, Ebox); //Can be set with IntToBox

whats wrong with my box … i may just be being slow here .. altho i have been wondering about this ..

will have an update here shortly


ObjBox := IntToBox(xe - 5, ye - 5, xe + 5, ye + 5);

sm0k3

2013-04-16 02:21:26

Have ReWritten some of the script to include recommendations and
have simplified some to
not as fast as it was but thats mostly due to the amount of other people suddenly collecting tar since i released version 1 … hmm makes it a little hard for me to work on realy as im now fighting with at least 3-4 others on most servers….
@masterBB; what do you think …. i didnt get rid of CurrTask but its not as confusing now i think as its only realy used by Debug to print status messages ..


program TarCollect; // 0.4a beta
{$DEFINE SMART8}
{$i SRL/srl.simba}
{$i sps/sps.simba}
{$i SRL/SRL/misc/smartgraphics.simba}
{$i srl/srl/misc/online.simba}



{=====Player Details========================================}
const
PNAME = ''; {Your Players USERNAME here}
PPASS = ''; {Your Players PASSWORD here}

{=====Options===============================================}
DEBUGSMART = False; {DUBUG output on SMART?}
DEBUGS = True; {DEBUG output In Simba}

totalrun = 100;
{=================== LEAVE THESE ALONE ===================}
var
truns, TarPrice, TarCount, OldTarCount, EstProf,NUMruns: integer;
CurrTask: string; //kept CurrTask but made less complicated now used only for Debugging Task and Stopping Script
TarCpoints, mypathrand: TPointArray;
ObjectRecord: TAutoColorInfo;

{=========================================================}

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := PNAME;
Pass := PPASS;
BoxRewards := [''];
LampSkill := SKILL_PRAYER;
Pin := '';
Active := true;
end;
end;
{========================================================}







{===SCRIPT===============================================
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
========================================================}
procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour, Shadow: integer);
var
mx, my, Pic, I, B, H, TPH, Numb: Integer;
TTP: TPointArray;
begin
SmartSetDebug(True);
GetClientDimensions(mx,my);
Pic := BitmapFromString(mx,my,'');
TPH := High(TP);
for I := 0 to TPH do
begin
TTP := LoadTextTPA(TP[i], SmallChars, H);
for B := 0 to High(TTP) do
begin
Numb := ((I + 1) * 13);
FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1, Shadow);
FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
end;
end;

SMART_DrawBitmap(True,Pic, InttoPoint(Placement.x, Placement.y));
FreeBitmap(Pic);
end;

procedure StatsDebug(TarCount: integer);
begin
EstProf := TARPRICE * TarCount;
PrintOnSmart(
['',
'',
'',
'',
' Tar Collector ',
' +======================+',
' Running: '+ TimeRunning,
'+======================+',
' ',
' Player Stats ',
' +====================+',
' Player: '+Capitalize(Players[CurrentPlayer].Name),
' Tar Collected: '+ToStr(TarCount),
' Estimated Profit: '+ToStr(EstProf),
' Runs: '+ToStr(NUMruns),
' +====================+',
' Status: '+ToStr(CurrTask),
' +====================+'
], Point(10, 70), 196050, 135972);
end;

procedure RunStats;
var TarCountTot: integer;
begin
TarCountTot := GetAmountBox(InvBox(1));
TarCount := TarCountTot - OldTarCount;
EstProf := TARPRICE * TarCountTot;
writeln('====Stats================================');
writeln('+ Time Running: '+TimeRunning);
writeln('+ Total Tar in inv: '+ToStr(OldTarCount));
writeln('+ Tar Collected: '+ToStr(TarCount));
writeln('+ Estimated Earnings: ' +ToStr(EstProf)+'GP');
writeln('=========================================');
if DebugSMART then StatsDebug(TarCount);
end;




function WithinBounderies(): Boolean;
var
P: TPoint;
Box: TBox;
begin
SPS_GatherMinimap;
P := SPS_GetMyPos;
Box := IntToBox(4360, 3839, 4531, 3938);

if (DEBUGS = True) then
Writeln(P);


Result := PointInBox(P, Box)

if not(Result) then
writeln('Seem To Be lost ??');
end;

procedure WalkBack;
var t : integer;
begin
//writeln('Entering WalkBack');
SPS_Blindwalk(Point(4519,3903));
while IsMoving do
begin
MarkTime(t);
wait(1000+randomrange(100,400));
CurrTask := 'Walking Back';
RunStats;
if ( TimeFromMark(t) >= 10000 ) then Break;
end;
end;

procedure WalkToClosest;
var
i: TPointArray;
begin
//writeln('Entering WalkToClosest');
CurrTask := 'Finding Tar Spots!!';
if ( DEBUGS = True ) then writeln('Finding closest Tar Spot');
RunStats;
i := GetMiniMapDots('red');
writeln(ToStr(Length(i)) + ' Tar Spots On Map');
if ( DEBUGS = True ) then writeln(ToStr(Length(i)));
if ( Length(i) > 0 ) then
begin
SortTPAFrom(i, Point(MMCX, MMCY));
if ( DEBUGSMART = True ) and not ( Length(i) = 0 ) then SMART_DebugTPA(False,i);
Mouse(i[0].X + 6, i[0].Y + 4, 2, 0, mouse_left);
CurrTask := 'Walking to Tar spot'
end
else
begin
if ( DEBUGS = True ) then writeln('No Tar Spots Here :0');
if not WithinBounderies() then WalkBack;
if ( DEBUGS = True ) then writeln('continuing to search');
end;
RunStats;
end;

procedure DoPickup(xs,ys: integer);
begin
//writeln('Entering DoPickup');
if not LoggedIn then LoginPlayer;
MMouse(xs,ys, 0, 0); //random movement better but will make misclicks happen tars to small
Wait(600+RandomRange(300,900));
if IsUpTextMultiCustom(['Take','ake','Tar','tar']) then
begin
if ( DEBUGS = True ) then writeln('Found Tar');
case Random(10) of
0,2,4,6,8: begin
ClickMouse2(mouse_right);
ChooseOptionMultiEx(['Take','ake','Tar','tar'],'',ClickLeft);
end;
1,3,5,7,9: ClickMouse2(mouse_left);
end;
RunStats;
end
else
begin
if ( DEBUGS = True ) then writeln('Thats not Tar? - Unless Something Went wrong');
end;
end;

procedure DoCollect;
var
xe, ye ,t: integer;
OBJBOX: TBox;
i: TPointArray;
begin
//writeln('Entering DoCollect');
MarkTime(t);
if not LoggedIn then LoginPlayer;
CurrTask := 'Thinking';
i := GetMiniMapDots('red');
writeln(ToStr(Length(i)) + ' Tar Spots On Map');
while not ( Length(i) = 0 ) do
begin
while IsMoving do
begin
CurrTask := 'Walking';
if ( TimeFromMark(t) > 3500 ) then Break;
RunStats;
wait(600+randomrange(200,1200));
end;
CurrTask := 'looking';
if ( DEBUGS = True ) then writeln('looking ..');
wait(RandomRange(50,200));
if FindObjRecordEx(xe, ye, ObjectRecord, MSX1, MSY1, MSX2, MSY2, False, True) then
begin
writeln('Tar Found');
if ( DEBUGSMART = True ) then SMART_DebugTPA(True,TarCpoints);
if ( DEBUGSMART = True ) and not ( Length(i) = 0 ) then SMART_DebugTPA(false,i);
ObjBox := IntToBox(xe - 5, ye - 5, xe + 5, ye + 5);
if ( DEBUGSMART = True ) then SMART_DrawBoxMS(False,False,OBJBOX,clblue);
DoPickup(xe, ye);
end;
if not FindObjRecordEx(xe, ye, ObjectRecord, MSX1, MSY1, MSX2, MSY2, False, True) then
begin
if ( DEBUGS = True ) then writeln('Ill Keep Searching :)');
RunStats;
WalkToClosest;
break;
end;
if ( TimeFromMark(t) > 8000 ) then Break;
end;
end;

procedure AntiBan;
begin
if not LoggedIn then Exit;
CurrTask := 'AntiBan'
RunStats;
case Random(99) of
0: wait(500+random(3000));
1: begin
RandomMovement;
SetAngle(SRL_ANGLE_HIGH);
end;
3: PickUpMouse;
end;
end;

procedure DontActLikeAbot;
begin
If not WithinBounderies() then WalkBack;
AntiBan;
FindNormalRandoms;
end;


procedure SetupScript;
var TarPath1, TarPath2: TPointArray;
mypath: integer;
begin
SRL_SIXHOURFIX := TRUE;
SMART_FIXSPEED := TRUE;
SetupSRL;
DeclarePlayers;
LoginPlayer;
Wait(774 + Random(277));
ClickNorth(SRL_ANGLE_HIGH);
SRL_Procs[SRL_Antiban] := @ DontActLikeAbot;
SPS_Setup(RUNESCAPE_SURFACE, ['10_9','11_9']);
SPS_AnyAngle := True;
TarPath1 := [Point(4533,3928),Point(4507,3928),Point(4484,3931),Point(4454,3932),Point(4447,3913),Point(4469,3893),Point(4487,3893),Point(4499,3903),Point(4516,3905),Point(4531,3912),Point(4534,3926)];
TarPath2 := [Point(4560,3929),Point(4579,3912),Point(4573,3894),Point(4545,3882),Point(4532,3868),Point(4519,3851),Point(4480,3842),Point(4450,3849),Point(4447,3876),Point(4469,3889),Point(4491,3896),Point(4515,3899),Point(4534,3922),Point(4557,3928)];
mypath := random(2);
if (mypath = 1) then
begin
mypathrand := TarPath1;
end;
if (mypath = 2) then
begin
mypathrand := TarPath2;
end;

with ObjectRecord do
begin
UpText := 'Take';
MaxDist := 8;
Color := 2697515;
HueMod := 4.17;
SatMod := 0.10;
LumTol := 2;
MinR := 39; MaxR := 47;
MinG := 38; MaxG := 45;
MinB := 37; MaxB := 45;
MinX := 1.93; MaxX := 2.50;
MinY := 2.02; MaxY := 2.58;
MinZ := 2.10; MaxZ := 2.77;
end;
end;

procedure MainLoop;
var
i: integer;

begin
//writeln('Entering MainLoop');
CurrTask := 'Walking';
if not LoggedIn then LoginPlayer;
if ( DEBUGSMART = True ) then writeln('Starting Position: '+ ToStr(SPS_GetMyPos()));
while not ( CurrTask = 'STOP' ) do
begin
NUMruns := NUMruns + 1;
RunStats
If not WithinBounderies() then WalkBack;
DoCollect;
DontActLikeAbot;
WalkToClosest;
RunStats;
if (truns = totalrun) then CurrTask := 'STOP';
end;
end;

begin
TarPrice := GETGEprice(1939);
CurrTask := 'Starting';
NUMruns := 0;
SetupScript;
SMART_ClearCanvas;
OldTarCount := GetAmountBox(InvBox(1)); //Get amount of tar allready in inv
RunStats;
MainLoop;
CurrTask := 'Finished';
RunStats;
SMART_ClearCanvas;
end.

Vinyl Scratch

2013-04-17 09:52:58

I voted yes, you're updating your script quickly, and taking advice really well. I like your attitude.

Good luck!

Hobbit

2013-04-20 17:47:20

Yes

sm0k3

2013-04-23 04:14:07

@ Srl Members so then how's my application looking then ?
times getting on now and no new votes as yet not to worry though we'll see what happens when the poll closes :)

i also have now got a release candidate for TarCollect altho im not sure if it should be public as its essentially a Money Farming Script and can be easily abused . i mean ive only publicly released a beta so far and i am allready having trouble updating/testing the script as im having to change server every 10 15 mins due to to many other players in the swamp :(

Latest features:
Faster tar collection
Switches World when to many players ( user settable )
random choice of path ( will run path in reverse in attempt to get to tar before others )
Stats now calculates profit based on tar collected and discounts tar allready in inventory
Stats shows both total tar in inv AND amount of tar collected
Better antiban also runs more often
reduced amount of uptext checks as this was causing holdups

NOTE: Currently i have fallen back to SPS to run the path as walking to closest tar spot is causing issues ( only running part of the swamp) in way this was not a big issue as walking half of the swap can be faster but walking the whole swap results in more profit per run

Hobbit

2013-05-05 21:33:35

Didn't make it this time. Take the suggestions given to you above, check out the tutorial island section and feel free to apply in 2 weeks time. Good start though.

Cheers
Hobbit