SRL Archive - Archive

r!ch!e - SRL Member Application


Rick

2009-08-21 08:08:38

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


Are you affilated in anyway with Jagex LTD?
No

Were you Referred to SRL?



What is your general programming knowledge?
C#, Some C++, VB


Are you a member of any other communities?
Was on Mopar, but I'm only active on SRL now.


Tell us about yourself…
From: r!ch!e
My name is Richard.
I enjoy learning programming languages. And of course long walks on the beach. :p
I wish to become more active in the forums.
3 years has passed since I registered and now I feel that I really understand scripting with SRL.



Please show us one (or multiple) of your scripts.
{=========================================================================]
| Strong Holder |
| Version: 0.35 |
[=========================================================================]
| Description: |
| Trains on any Monster based on user input. |
[=========================================================================]
| Setup: Click Play and Fill in Form, or, set UseForm to False and fill |
| out Declare Players |
[=========================================================================]
| Version: |
| 0.10 - Beta. Random Testing. |
| 0.15 - Fixed Major Heal Bug. |
| 0.20 - First Release. |
| 0.35 - Added Multiplayer, SRL Player Form, Small Fixes |
[=========================================================================]
| Notes: Made by r!ch!e |
| My first SRL script. Please inform me of bugs. |
[=========================================================================]
| About the Name: This was originally for the Stronghold of Security, |
| hence the name, but I adapted it to any monster. |
[=========================================================================}

program StrongHolder;
{.include SRL/SRL/Misc/SMART.SCAR}
{.include SRL/SRL.scar}
{.include SRL/SRL/Misc/Users.scar}
{.include SRL/SRL/Skill/Fighting.scar}

{******************************************************************************)
Setup Here
*******************************************************************************}
const
UseForm = True; // Use SRL PlayerForm ? Or Declare Players ?
DoDebug = 4; // 1 = Status, 2 = Writeln, 3 = Disguise, 4 = All, 5 = None :(

procedure DeclarePlayers;
begin
if not UseForm then
begin
HowManyPlayers := 3;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :='User Name';
Players[0].Pass :='Password';
Players[0].Nick :='3 - 4 Letters of User Name';
Players[0].Active := True;
Players[0].Booleans[0] := True; //Eat Food?
Players[0].Booleans[1] := True; //Use Run?
Players[0].Integers[0] := 90; //Will Eat/Rest until X% HP
Players[0].Integers[1] := 30; //At X% HP will Eat/Rest
Players[0].Integers[2] := 3; //FightMode. 1 = Attack, 2 = Strengh, 3 = Shared, 4 = Defence
Players[0].Integers[3] := 5789791; //Monster Colours { Actual }
Players[0].Integers[4] := 5658205; //Monster Colours { Minotaur Colours }
Players[0].Integers[5] := 4342343; //Monster Colours { :) }
Players[0].Strings[0] := 'inot'; //Part of Monster Name. Ex. Minotaur = inot

Players[1].Name := 'User Name';
Players[1].Pass := 'Password';
Players[1].Nick := '3 - 4 Letters of User Name';
Players[1].Active := False;
Players[1].Booleans[0] := True; //Eat Food?
Players[1].Booleans[1] := True; //Use Run?
Players[1].Integers[0] := 90; //Will Eat/Rest until X% HP
Players[1].Integers[1] := 30; //At X% HP will Eat/Rest
Players[1].Integers[2] := 3; //FightMode. 1 = Attack, 2 = Strengh, 3 = Shared, 4 = Defence
Players[1].Integers[3] := 5789791; //Monster Colours { Actual }
Players[1].Integers[4] := 5658205; //Monster Colours { Minotaur Colours }
Players[1].Integers[5] := 4342343; //Monster Colours { :) }
Players[1].Strings[0] := 'inot'; //Part of Monster Name. Ex. Minotaur = inot

Players[2].Name := 'User Name';
Players[2].Pass := 'Password';
Players[2].Nick := '3 - 4 Letters of User Name';
Players[2].Active := False;
Players[2].Booleans[0] := True; //Eat Food?
Players[2].Booleans[1] := True; //Use Run?
Players[2].Integers[0] := 90; //Will Eat/Rest until X% HP
Players[2].Integers[1] := 30; //At X% HP will Eat/Rest
Players[2].Integers[2] := 3; //FightMode. 1 = Attack, 2 = Strengh, 3 = Shared, 4 = Defence
Players[2].Integers[3] := 5789791; //Monster Colours { Actual }
Players[2].Integers[4] := 5658205; //Monster Colours { Minotaur Colours }
Players[2].Integers[5] := 4342343; //Monster Colours { :) }
Players[2].Strings[0] := 'inot'; //Part of Monster Name. Ex. Minotaur = inot

end else
SRLPlayerForm(True, ['Eat Food?', 'Use Run?'], ['HPMax (Restore to X% Health)', 'HPRest (At X% will Eat/Rest)', 'Fight Mode (1[Attk], 2[Str], 3[Ctrl], 4[Def])', 'Colour 1', 'Colour 2', 'Colour 3'], ['Part of Monsters Name (Ex. "inot")'], []);
end;

{******************************************************************************)
End Setup
*******************************************************************************}

var
Colours: Array [0..2] Of Integer;
BadMark, Fail: Integer;

{******************************************************************************)
AntiBan + Debug
*******************************************************************************}

procedure Debug(reason:string);
begin
Case DoDebug of
1: Status(Reason);
2: Writeln(Reason);
3: Disguise(Reason);
4: begin
Status(Reason);
Writeln(Reason);
Disguise(Reason);
end;
5: Writeln('');
end;
end;

procedure AntiBan;
begin
Debug('AntiBan ...');
if not LoggedIn then Exit;
FindNormalRandoms;
case Random(20) of
0: begin
case Players[CurrentPlayer].Integers[2] of
1: begin
HoverSkill('Attack', false);
Wait(2453+Random(432));
end;
2: begin
HoverSkill('Strength', false);
Wait(2453+Random(432));
end;
3: begin
HoverSkill('Attack', false);
Wait(2453+Random(432));
end;
4: begin
HoverSkill('Defence', false);
Wait(2453+Random(432));
end;
end;
end;
1: PickUpMouse;
2: begin
MakeCompass('N');
Wait(200+random(60));
MakeCompass('S');
Wait(80+random(25));
MakeCompass('N');
end;
3: RandomRClick;
4: GameTab(1 + Random(12));
5: PickUpMouse;
6: RandomMovement;
7: BoredHuman;
8: begin
SetAngle(False);
Wait(30 + random(10));
SetAngle(True);
end;
9: HoverSkill('Hitpoints', false);
10: BoredHuman;
11: BoredHuman;
end;
FindNormalRandoms;
end;

procedure WaitEx(Time: Integer);
Var
Mark: integer;
begin
if not LoggedIn then Exit;
MarkTime(Mark);
while (TimeFromMark(Mark) < Time) do
begin
FindNormalRandoms;
end;
end;

{******************************************************************************)
Healing Functions
*******************************************************************************}

{*******************************************************************************
function RestHPUntil(Percent: Integer): Boolean;
By: r!ch!e [RestHPUntil]. Based off of ZephyrsFury [RestUntil].
Description: Rests until HP is equal to Percent. Results True if successful.
Modded RestUntil. Restores Hitpoints instead of run.
*******************************************************************************}

function RestHPUntil(Percent: Integer): Boolean;
var
s: string;
i,ii, Mark: integer;
begin
Result := False;
if Percent > 100 then
begin
WriteLn('Invalid HP Percent');
Exit;
end;
ii:= GetSkillInfo('hp',false)
i := Round(GetMMLevels('hp', s) * 100 / ii)
if (i >= Percent) or InFight then Exit;
SetRest;
MarkTime(Mark);
Debug('Resting ...');
while (i < Percent) do
begin
if (TimeFromMark(Mark) > 600000) then Exit;
WaitEx(10000 + random(300));
AntiBan; //Stay Logged in, Stops Banage, Checks for Randoms :)
i := Round(GetMMLevels('hp', s) * 100 / ii);
end;
case i of
Percent: Result:= True;
end;
if not Result then Exit;
WaitEx(100 + Random(50));
end;

function Eat(Percent: Integer):boolean;
var
s: string;
i, ii, iii, x, y, Mark, FailA: integer;
begin
Result := False;
if Percent > 100 then
begin
WriteLn('Invalid HP Percent');
Exit;
end;
ii:= GetSkillInfo('hp',false)
i := Round(GetMMLevels('hp', s) * 100 / ii)
if (i >= Percent) then Exit;
GameTab(4);
MarkTime(Mark);
Debug('Eating ...');
while (i < Percent) do
begin
if (TimeFromMark(Mark) > 180000) then Exit;
for iii := 1 to 28 do
if ExistsItem(iii) then
begin
MMouseItem(iii);
WaitEx(200 + random(30));
if WaitUpText('at', 400) then
begin
GetMousePos(x, y);
Mouse(x,y,0,0,false);
WaitEx(30 + random(50));
if ChooseOption('Eat') then
begin
WaitEx(250 + random(120));
i := Round(GetMMLevels('hp', s) * 100 / ii);
end;
end else
begin
i := Round(GetMMLevels('hp', s) * 100 / ii);
FailA:= FailA + 1;
if (FailA > 28) then
begin
RestHPUntil(Percent);
Exit;
end;
end;
end;
end;
if (i > Percent) then Result:= True;
if (not(Result)) then Exit;
WaitEx(100 + Random(50));
AntiBan;
end;

function Heal(Percent: Integer; Food: Boolean): boolean;
begin
Result:= False;
if Percent > 100 then
begin
Writeln('Invalid HP Percent');
Exit;
end;
if not(LoggedIn) or (HPPercent >= Percent) then Exit;
if Food then
begin
if Eat(Percent) then
begin
Result:= True;
Exit;
end else
begin
if RestHPUntil(Percent) then
begin
Result:= True;
Exit;
end;
end;
end else
if RestHPUntil(Percent) then Result:= True;
end;

procedure HPCheck(Percent: Integer);
begin
Debug('Checking HP ...');
if Percent > 100 then
begin
Writeln('Invalid HP Percent');
//Exit; Let's be nice ;p
Percent := 100;
end;
if not(LoggedIn) or (HPPercent >= Percent) then Exit;
if (HPPercent < Percent) then
begin
Heal(Players[CurrentPlayer].Integers[0], Players[CurrentPlayer].Booleans[0]);
end;
end;

{******************************************************************************)
Fighting Functions
*******************************************************************************}

function FindMonster(Name: String; Colours: TIntegerArray; Tol: Integer): Boolean;
var
x, y, i, ii, iii: Integer;
MTPA: TPointArray;
MATPA: T2DPointArray;
MPoint: TPoint;
begin
Result:= False;
Debug('Finding Monster ...');
if not LoggedIn or InFight then Exit;
iii:= High(Colours)
for i:= 0 to iii do
if FindColorsSpiralTolerance(MSCX + 3, MSCY - 3, MTPA, Colours[i], MSX1, MSY1, MSX2, MSY2, Tol) then
if not FindColorTolerance(x, y, 65280, MPoint.x - 40, MPoint.y - 40, MPoint.x + 40, MPoint.y + 40, 5) then
Break;
begin
MATPA := TPAtoATPAEx(MTPA, 10, 10);
if Length(MATPA) = 0 then Exit;
ii:= High(MATPA);
for i := 0 to ii do
begin
MPoint:= MiddleTPA(MATPA[i])
begin
MMouse(MPoint.x, MPoint.y, 2, 2);
WaitEx(90 + random(60));
if IsUpText(Name) then
begin
GetMousePos(x, y);
case Random(3) of
0..2: begin
Mouse(x, y, 0, 0, False);
WaitEx(100 + random(50));
if ChooseOption('ttac') then
begin
Result:= True;
Debug('Fighting Monster ...');
Exit;
end;
end;
3: begin
if IsUpText(Name) then
begin
Mouse(x, y, 0, 0, True);
WaitEx(600 + Random(75));
if InFight then
begin
Result:= True;
Debug('Fighting Monster ...');
Exit;
end;
end;
end;
end;
end;
end;
end;
end;
if not Result then Fail:= Fail + 1;
end;

procedure InTheFray; //by Narcle. Modded a little.
Var
Mark: integer;
begin
Debug('Waiting for Fight ...');
MarkTime(Mark);
while not InFight and (TimeFromMark(mark) < 6000) do WaitEx(100);
Debug('Fighting ...');
AntiBan;
repeat
HpCheck(Players[CurrentPlayer].Integers[1]);
WaitEx(3000);
until(not(InFight) or not (LoggedIn))
end;

{******************************************************************************)
Setup Procedures
*******************************************************************************}

procedure Report;
var
i: Integer;
begin
Debug('Proggress Report ...');
ClearReport;
ChangeReportWidth(325);
AddToReport(' __________________________________ ');
AddToReport('| |');
AddToReport('| --------- StrongHolder --------- |');
AddToReport('|__________________________________|');
AddToReport('| |');
AddToReport('|Ran For: ' + TimeRunning + ' Minutes |');
for i := 0 to (HowManyPlayers - 1) do
AddToReport('|Player[' + IntToStr(i) + ']: Exp Gained: ' + IntToStr(Players[i].Integers[7] - Players[i].Integers[6]) + ' |');
AddToReport('|__________________________________|');
AddToReport('| |');
AddToReport('| ------------ r!ch!e ------------ |');
AddToReport('|__________________________________|');
AddToReport('');

end;

procedure Sig;
begin
ClearDebug;
Debug('Sig ...');
ChangeReportWidth(275);
Writeln(' ____ _ ___ _ _ _ ____ ');
Writeln('( _ \/ \ / __)/ )( \/ \( __) ');
Writeln(' ) /\_/( (__ ) __ (\_/ ) _) ');
Writeln('(__\_)(_) \___)\_)(_/(_)(____) ');
Wait(2000);
end;

procedure GetXPLvl(old: Boolean);
var
oXP, nXP: Integer;
begin
case old of
True: begin
case Players[CurrentPlayer].Integers[2] of
1: oXP := GetXp('attack');
2: oXP := GetXp('strength');
3: oXP := GetXP('shared');
4: oXP := GetXp('defence');
end;
Players[CurrentPlayer].Integers[6] := oXP;
Debug('Got Old Exp Levels ...');
end;
False: begin
case Players[CurrentPlayer].Integers[2] of
1: nXP := GetXp('attack');
2: nXP := GetXp('strength');
3: nXP := GetXP('shared');
4: nXP := GetXp('defence');
end;
Players[CurrentPlayer].Integers[7] := nXP;
Debug('Got New Exp Levels ...');
end;
end;
end;

procedure NextPlayerEx(Active: Boolean);
begin
GetXPLvl(False);
case Active of
True: NextPlayer(True);
False: NextPlayer(False);
end;

procedure SetFightingMode;
begin
if not LoggedIn then Exit;
SetFightMode(Players[CurrentPlayer].Integers[2]);
end;

procedure SetupRS;
var
i: Integer;
begin
if not LoggedIn then Exit;
Debug('Setting up RuneScape ...');
for i:= 0 to High(Colours) do
Colours[i]:= Players[CurrentPlayer].Integers[i+3];
SetFightingMode;
Wait(500 + random(200));
if Players[CurrentPlayer].Booleans[1] then SetRun(true);
SetAngle(True);
GetXPLvl(True);
Wait(200 + random(50));
end;

procedure SetupSmart;
begin
Debug('Setting up SMART ...');
Smart_Server := 155;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
Wait(1000);
SetTargetDC(SmartGetDC);
end;

procedure SetupScript;
begin
Fail:= 0;
Sig;
Debug('Setting up Script ...');
SetupSRL;
SetUpSmart;
DeclarePlayers;
Wait(500 + random(100));
end;

{******************************************************************************)
Main Loop
*******************************************************************************}

begin
SetupScript;
Debug('Running Script :)');
repeat
if not LoggedIn then
begin
LoginPlayer;
Wait(500);
SetupRS;
MarkTime(BadMark);
end;
if FindMonster(Players[CurrentPlayer].Strings[0], Colours, 20) then
InTheFray;
if InFight then
InTheFray;
if (Fail > 30) then
NextPlayerEx(False);
if (TimeFromMark(BadMark) > 360000) then
NextPlayerEx(False);
HPCheck(Players[CurrentPlayer].Integers[1]);
WaitEx(5000);
FindNormalRandoms;
until(False);
Debug('Script Finished');
Report;
end.

JPHamlett

2009-08-21 08:28:42

yes

ian.

2009-08-21 08:37:09

Haven't looked too in detail (kinda busy =X), but quick read through I saw this


case i of
Percent: Result:= True;
end;

Why not just use an if then statement? :)

Yes.

JAD

2009-08-21 08:51:09

In Debug, the 5: Writeln(''); in that case isn't really necessary, is it? And probably just an unwanted space each time Debug is called. Just take it out and it will do nothing if the user put DoDebug = 5;

In AntiBan, this:


0: begin
case Players[CurrentPlayer].Integers[2] of
1: begin
HoverSkill('Attack', false);
Wait(2453+Random(432));
end;
2: begin
HoverSkill('Strength', false);
Wait(2453+Random(432));
end;
3: begin
HoverSkill('Attack', false);
Wait(2453+Random(432));
end;
4: begin
HoverSkill('Defence', false);
Wait(2453+Random(432));
end;
end;
end;

Could just be:


0: begin
case Players[CurrentPlayer].Integers[2] of
1,3: HoverSkill('Attack', false);
2: HoverSkill('Strength', false);
4: HoverSkill('Defence', false);
end;
Wait(2453+Random(432));
end;

Saves a lot of space.


Maybe have it do the above more often than the other anti bans? Seems like the main ones you would do if you were playing legit.

WaitEx is probably going to cause a large amount of lag. Add a Wait(1); in there:


procedure WaitEx(Time: Integer);
Var
Mark: integer;
begin
if not LoggedIn then Exit;
MarkTime(Mark);
while (TimeFromMark(Mark) < Time) do
begin
FindNormalRandoms;
wait(1);
end;
end;

In RestHPUntil:


case i of
Percent: Result:= True;
end;

Why have a case at all? Cases are only more code efficient with at least 3 options in most cases:


Result := (i = Percent);


Instead of not eating at all if the percent was over 100%, maybe do like:


if(Percent > 100)then Percent := 75;


In eat:

if (TimeFromMark(Mark) > 180000) then Exit;

You should add randomness to your TimeFromMark checks:


if (TimeFromMark(Mark) > 180000 + random(15000)) then Exit;

I am not sure if WaitUpText automatically adds randomness, but you should add randomness to that if it doesn't:


if WaitUpText('at', 400+random(100)) then

Maybe try a WaitChooseOption as well just below that in case of lag?

In Heal, this looks pretty messy:

if Food then
begin
if Eat(Percent) then
begin
Result:= True;
Exit;
end else
begin
if RestHPUntil(Percent) then
begin
Result:= True;
Exit;
end;
end;
end else
if RestHPUntil(Percent) then Result:= True;

Change a few things:

if Food then
begin
Result := Eat(Percent);
if(not(Result))then Result := RestHPUntil(Percent);
if(Result)then Exit;
end;
Result := RestHPUntil(Percent);


In HPCheck (just to save lines), instead of:

if (HPPercent < Percent) then
begin
Heal(Players[CurrentPlayer].Integers[0], Players[CurrentPlayer].Booleans[0]);
end;

Just do:


if (HPPercent < Percent) then
Heal(Players[CurrentPlayer].Integers[0], Players[CurrentPlayer].Booleans[0]);

A begin/end after an if/then is only necessary if doing more than one statement.


In FindMonster, you had:

for i := 0 to ii do
begin
MPoint:= MiddleTPA(MATPA[i])
begin
MMouse(MPoint.x, MPoint.y, 2, 2);
WaitEx(90 + random(60));
if IsUpText(Name) then
begin
GetMousePos(x, y);
case Random(3) of
0..2: begin
Mouse(x, y, 0, 0, False);
WaitEx(100 + random(50));
if ChooseOption('ttac') then
begin
Result:= True;
Debug('Fighting Monster ...');
Exit;
end;
end;
3: begin
if IsUpText(Name) then
begin
Mouse(x, y, 0, 0, True);
WaitEx(600 + Random(75));
if InFight then
begin
Result:= True;
Debug('Fighting Monster ...');
Exit;
end;
end;
end;
end;
end;
end;
end;

Changed a few things:

for i := 0 to ii do
begin
MPoint:= MiddleTPA(MATPA[i])
MMouse(MPoint.x, MPoint.y, 2, 2);
WaitEx(90 + random(60));
if IsUpText(Name) then
begin
GetMousePos(x, y);
case Random(4) of //changed to 4
0..2: begin
Mouse(x, y, 0, 0, False);
WaitEx(100 + random(50));
if ChooseOption('ttac') then
begin
Result:= True;
Debug('Fighting Monster ...');
Exit;
end;
end;
3: if IsUpText(Name) then
begin
Mouse(x, y, 0, 0, True);
WaitEx(600 + Random(75));
if InFight then
begin
Result:= True;
Debug('Fighting Monster ...');
Exit;
end;
end;
end;
end;
end;
You had a begin/end in there for no reason (no if/then or anything), and another unnecessary one in the case. You also had it case Random(3) and had an option in there for 3. 3 would have never resulted from Random(3).

Also, right before the for loop, you have another unnecessary begin/end:

for i:= 0 to iii do
if FindColorsSpiralTolerance(MSCX + 3, MSCY - 3, MTPA, Colours[i], MSX1, MSY1, MSX2, MSY2, Tol) then
if not FindColorTolerance(x, y, 65280, MPoint.x - 40, MPoint.y - 40, MPoint.x + 40, MPoint.y + 40, 5) then
Break;
begin //Here
MATPA := TPAtoATPAEx(MTPA, 10, 10);
if Length(MATPA) = 0 then Exit;
ii:= High(MATPA);
for i := 0 to ii do
begin
MPoint:= MiddleTPA(MATPA[i])
begin
MMouse(MPoint.x, MPoint.y, 2, 2);
WaitEx(90 + random(60));
if IsUpText(Name) then
begin
GetMousePos(x, y);
case Random(3) of
0..2: begin
Mouse(x, y, 0, 0, False);
WaitEx(100 + random(50));
if ChooseOption('ttac') then
begin
Result:= True;
Debug('Fighting Monster ...');
Exit;
end;
end;
3: begin
if IsUpText(Name) then
begin
Mouse(x, y, 0, 0, True);
WaitEx(600 + Random(75));
if InFight then
begin
Result:= True;
Debug('Fighting Monster ...');
Exit;
end;
end;
end;
end;
end;
end;
end; //Here
end;

begin/ends that aren't after if/then's, but just there for no reason at all make very unattractive code.


In GetXPLvl:

case old of
True: begin
case Players[CurrentPlayer].Integers[2] of
1: oXP := GetXp('attack');
2: oXP := GetXp('strength');
3: oXP := GetXP('shared');
4: oXP := GetXp('defence');
end;
Players[CurrentPlayer].Integers[6] := oXP;
Debug('Got Old Exp Levels ...');
end;
False: begin
case Players[CurrentPlayer].Integers[2] of
1: nXP := GetXp('attack');
2: nXP := GetXp('strength');
3: nXP := GetXP('shared');
4: nXP := GetXp('defence');
end;
Players[CurrentPlayer].Integers[7] := nXP;
Debug('Got New Exp Levels ...');
end;
end;

Could simply be:

procedure GetXPLvl(old: Boolean);
var
XP: Integer;
begin
case Players[CurrentPlayer].Integers[2] of
1: XP := GetXp('attack');
2: XP := GetXp('strength');
3: XP := GetXP('shared');
4: XP := GetXp('defence');
end;
if(old)then Players[CurrentPlayer].Integers[6] := XP else
Players[CurrentPlayer].Integers[7] := XP;
if(old)then Debug('Got Old Exp Levels ...') else
Debug('Got New Exp Levels ...');
end;

No need to case the same thing twice and have 2 separate variables.



NextPlayerEx:

procedure NextPlayerEx(Active: Boolean);
begin
GetXPLvl(False);
case Active of
True: NextPlayer(True);
False: NextPlayer(False);
end;

Could simply be:


procedure NextPlayerEx(Active: Boolean);
begin
GetXPLvl(False);
NextPlayer(Active);
end;

You were missing an end in your first case anyways? I don't think that this script would have compiled.


That's all I have time for right now (that took me long enough :p). You just had quite a few coding inefficiencies (begins/ends that were there not even after an if/then or anything…etc.) and a few things that could be tweaked. Nothing too major. I can tell that you worked very hard on this, and I've seen you active around the forums too.

Good script? Check.
Good attitude? Check.
Good effort? Check.

Yes :) Good job!

[JS]

2009-08-21 09:05:48

I vote yes. :)

TRiLeZ

2009-08-21 09:12:54

Time to examine your script.

Good:
MultiPlayer
AntiBan
AntiRandoms
A TPA

Bad:

5: Writeln('');

That makes an unessasary blank line in the Debug Box.
Just remove that and everything will be fine.


while (TimeFromMark(Mark) < Time) do
begin
FindNormalRandoms;
end;
If Scar knows that the character is not in a random then SMART will freeze and maybe even log out depending on the time you making the script wait.
Add some wait time in there.


if not LoggedIn then
begin
LoginPlayer;
Wait(500);
SetupRS;
MarkTime(BadMark);
end;

If the script failed a random, it will log in and the random will have to try to solve it when its been failed and log you out. This will go on forever.

From MainLoop:

until(False);

Even when all players are inactive the script will keep going and will be stuck in an endless loop. The MainLoop is never breaked away from.

Suggestions:
Declare Monster Colors in your own procedure to make declareplayers more cleaner and shorter. It will also may be easier for the user to understand.
Do something like:

for i:= 0 to (HowManyPlayers -1) do
begin
Players[i].Integers[3] := 5789791;
Players[i].Integers[4] := 5658205;
Players[i].Integers[5] := 4342343;
end;
Or instead of putting the monster colors in players[].intergers[] you could put them in some integers of 1 TIntegerArray.


Fail:= 0;

Un-needed, integers will always start at 0

Overall:
MultiPlayer
AntiBan
AntiRandoms
1 TPA
NO DTMs / Bitmaps
NO DDTMs
NO Walking Methods
Really bad Bad's
Good standerds but they're not the best

Sorry but Im gonna vote no.

Laimonas171

2009-08-21 11:54:11

yes from me. :) script looks nice :)

bugger0001

2009-08-21 13:19:53

if a then 
begin
b
end;
can be
if a then b

procedure NextPlayerEx(Active: Boolean);
begin
GetXPLvl(False);
case Active of
True: NextPlayer(True);
False: NextPlayer(False);
end;
You are missing an end; in there and this can be shortened as JAD told. But overall for booleans I'd go for an if else statement like this:
if Boolean then a
else b;

Well, time to vote. All in all the script isn't very complicated(only 1 TPA, no (D)DTMS, BMPs, RRW or stuff like that) which makes me vote no, but at the same time I lean towards a yes as your attitude in forums seems good. Therefore I'm holding my vote for now. Show me at least one good usage of DDTM, BMP or RRW and I'll vote YES.

A thing I'm not too sure about, but consider worth mentioning:
Can't recall which TPA finding function has a bug in it that causes it result FALSE every time it's called, but I know one of them has. Therefore I wouldn't do anything like 'if FindColorsTolerance' or 'if FindColorsSpiralTolerance'. Just check the length of the TPA afterwards and you'll know if it was succesful or not ;)

cycrosism

2009-08-21 14:30:53

Yes. Good Luck

Home

2009-08-21 15:12:40

Yes from me (:

~Home

Sabzi

2009-08-21 15:29:00

Yes, keep up the good work!

marpis

2009-08-21 16:23:54

Yes.
Wow JAD, you pretty much said everything there!
FindMonster

for i:= 0 to iii do
if FindColorsSpiralTolerance(MSCX + 3, MSCY - 3, MTPA, Colours[i], MSX1, MSY1, MSX2, MSY2, Tol) then
if not FindColorTolerance(x, y, 65280, MPoint.x - 40, MPoint.y - 40, MPoint.x + 40, MPoint.y + 40, 5) then
Break;
You never set MPoint in the beginning, so
FindColorTolerance(x, y, 65280, MPoint.x - 40, MPoint.y - 40, MPoint.x + 40, MPoint.y + 40, 5)
Searches the color in (-40, -40, 40, 40) box.
Why does it search for color 65280? InFight check?

Eating
This could be done alot shorter and easier way. I suggest you make some options of what kind of food to eat, like
players[0].Strings[?] := 'lobster'; //lobster, swordfish, tuna, salmon
and search for a DTM or a bitmap in inventory. If you have inv full and only one food in the last invbox, it goes through every single item in inventory, which is very bottish and it takes time too.
There's already a HPPercent function in SRL, and it doesn't change tabs if players[?].Level[skill_Hitpoints] is set.

Overall
Your standards aren't perfect but they're OK.
I'd rate your script 65/100 where 0=helloworld, 50=srl members minimum.

Welcome!

Torrent of Flame

2009-08-21 16:28:49

Ofcourse.

Rick

2009-08-21 18:05:58

Wow, thanks for the great feedback! I can see there is still a lot to learn. I will fix everything you mentioned, and use DTM's for eating.

Dynamite

2009-08-21 18:24:12

Taken feedback into account.
Will to learn.
Become a bit more active? :D
Posts Per Day: 0.09 XD

Yes.
T~M

Griff

2009-08-21 20:44:02

Yes. JAD pretty much snagged everything :p

Rick

2009-08-21 22:23:37

Bugger0001 wanted to see use of a (D)DTM. DDTM's are better for walking and that isn't really needed here so I made a DTM for the Inventory.

procedure LoadDTMs;
begin
Lobster := DTMFromString('78DA639CCAC4C0A0CDC8800CEE964833FC02D' +
'220D1FF40C0D80154A381AA06220B23817437508D3E013553806A' +
'8C08A8990354634C40CD6CA01A2D22CC5126A0662E508D3401359' +
'3806AD4F0AB010027DB0D4B');
end;
Made that with the DTM Editor. 7 points, one central with high tolerance, 6 of the black outline. I've tested it, in game aswell, and it works.

I updated the eating function, including all the feedback, and modified it to use the DTM(s).

function Eat2(Percent, DTMName: Integer):boolean;
var
s: string;
i, ii, iii, x, y, Mark, FailA: integer;
iBox: TBox;
begin
Result := False;
if Percent > 100 then
begin
WriteLn('Invalid HP Percent');
Exit;
end;
ii:= GetSkillInfo('hp',false)
i := Round(GetMMLevels('hp', s) * 100 / ii)
if (i >= Percent) then Exit;
GameTab(4);
MarkTime(Mark);
Debug('Eating ...');
while (i < Percent) do
begin
if (TimeFromMark(Mark) > 180000 + random(15000)) then Exit;
for i:= 1 to 28 do
begin
iBox := InvBox(i);
if FindDTM(DTMName, x, y, iBox.x1, iBox.y1, iBox.x2, iBox.y2) then
begin
MMouse(x, y, 2, 2);
WaitEx(200 + random(30));
if WaitUpText('at', 100 + random(100)) and WaitUpText(Players[CurrentPlayer].Strings[1], 100 + random(100)) then
begin
GetMousePos(x, y);
Mouse(x,y,0,0,false);
WaitEx(30 + random(50));
if ChooseOption('Eat') then
begin
WaitEx(250 + random(120));
i := Round(GetMMLevels('hp', s) * 100 / ii);
end;
end else
begin
i := Round(GetMMLevels('hp', s) * 100 / ii);
FailA:= FailA + 1;
if (FailA > 28) then
begin
RestHPUntil(Percent);
Exit;
end;
end;
end;
end;
end;
if (i > Percent) then Result:= True;
WaitEx(100 + Random(50));
AntiBan;
if (not(Result)) then Exit;
end;
User would define
Players[0].Strings[1] := 'obster';
Then I would make a case to change the string into DTMName
function Eat2(Percent, [B]DTMName[/B]: Integer):boolean;

That will make it a lot less bottish.

Oh, and
procedure FreeAll;
begin
FreeDTM(Lobster);
end;

Edit: And Trilez, I fixed the main loop from
until(False)
to
until(AllPlayersInactive);

Kave

2009-08-21 22:49:59

yep :)

3Garrett3

2009-08-21 23:16:53

I vote yes. Thank you kindly for taking advice into account and for willing to learn :)

Gu3st...

2009-08-22 10:36:27

Yeah, JAD and Marpis covered it all :o

boberman

2009-08-22 20:56:42

Yes from me, the script looks sufficiently complex and well written. There where a few quirky things (Like a case statement with only one value) but not enough for a no.

Good job.

Rick

2009-08-22 23:31:13

Thanks everyone :), is there anything I should know/do about my application, just I'm going away next week and won't be available.

Sir R. M8gic1an

2009-08-26 22:29:25

Welcome to Jah People!

~RM