First off, I have been told I am a hard-ass on members applications. I'm sorry, but 9/10 of my votes are a no, and I'd love to see that changing. This tutorial has many examples, so I hope you can learn. Also, I have attached the best tutorials I could find on each subject, please look for the links!
Please note: I do not give anyone assurance that any code works, but all code here has been written by myself. Also, this is my PERSONAL voting style, use your discretion. Some agree others disagree, I am posting this as a learning tool.
Well, here is a list of some of the reasons why I vote no on SRL Members applications.
- Attitude:
- It is key, bad attitude, no. Good attitude, Heck yes! I have voted no purely on attitude, as have others. A good attitude is your best bet into SRL members. Someone says they don't like something, ask how you can fix it. They don't like you, ask how you can fix it. Be helpful and courteous and you will get the same in return.
- How to become Respected at SRL
- Sloppy Standards
- Standards, these are OFTEN over looked but provide key readabilities. They also can improve your code altogether and make it more efficient. This is also the main reason why I will vote NO! I am not adamant on standards, I won't vote no becuase you capitalize bold words, but sloppy standards make me look deeper, and I notice other falters. All in all, good rule of thumb, hide mistakes in pretty standards.
- Standards List
P.S. Anyone who I have helped teach will verify that the FIRST thing I tell them is to adopt correct standards, I refuse to read it if they are bad.- Large If statements
- These are when you see things like:
SCAR Code:if I = 0 then
else
if I = 1 then
else
if I = 2 then
else- These are a key reason I vote no, something this big and long can be made faster and more efficient by using a simple case I of.
SCAR Code:case I of
0: Blah;
1: Blah;
2: Blah;
else
BiggerBlah;
end;- There are appropriate times for large amounts of if statements, for example:
Notice how every If statement has a different type of boolean statement. This cannot be made more efficient and is the best way available.SCAR Code:procedure Calibrate(Portal : String);
var
I : Integer;
AInfo : AlterInfo;
P : TPoint;
begin
if not R_LoggedIn then Exit;
Portal := LowerCase(Portal);
AInfo := SetupPortalInfo(Portal);
P := GetMyPos;
if DistanceFrom(EdgeToAbyss[0]) < 2 then
Players[CurrentPlayer].Loc := 'Banking : Glory Tele'
else
if ChargeGlory then
Players[CurrentPlayer].Loc := 'Charging Glories'
else
if TileInBox(GetMyPos, 3089, 3488, 3098, 3499) then
Players[CurrentPlayer].Loc := 'Banking : In Bank'
else
if FindMeOnPath(I, EdgeToAbyss, 10) then
Players[CurrentPlayer].Loc := 'OnPath : EdgeToAbyss'
else
if InCircle(P.x, P.y, 3039, 4834, 17) then
Players[CurrentPlayer].Loc := 'OnPath : AlterTPA'
else
if CheckNPCsByName('Abyssal') and InCircle(P.x, P.y, 3039, 4834, 40) then
Players[CurrentPlayer].Loc := 'OnPath : OutPath'
else
if TileOnMM(AInfo.ATile) then
Players[CurrentPlayer].Loc := 'AtAlter : ' + Portal
else
Players[CurrentPlayer].Loc := 'Lost';
Writeln('Player''s location is: ' + Players[CurrentPlayer].Loc);
Disguise('Active Player: ' + Capitalize(LowerCase(Players[CurrentPlayer].Name)) +'; Loc: ' + Players[CurrentPlayer].Loc);
end;- Need more information on cases see this: Statements Tutorial
- Inefficient Code.
- This is a large reason why I vote no. If I see code being repeated multiple times for no reason, then you need to change something.
- Option 1: Procedures / Functions If you find yourself repeating things multiple times, make it a procedure or a function. It saves lines, and looks a lot cleaner here is an example:
SCAR Code:// Bad:
//...
if Left then
begin
iTime := GetTimeRunning;
repeat
Player := SmartGetFieldObject(0, MyPlayer);
Result := SmartGetFieldInt(Player, CharAnim) > 0;
SmartFreeObject(Player);
Wait(20);
RCC := RCC + Integer(Result);
until (RCC = 2) or (GetTimeRunning - iTime > 500);
Result := IsInteractingWithMe(Index) or RCC = 2;
end;
else
if IsOptionMenuOpen then
begin
ChooseOption('ttack');
WWM;
iTime := GetTimeRunning;
repeat
Player := SmartGetFieldObject(0, MyPlayer);
Result := SmartGetFieldInt(Player, CharAnim) > 0;
SmartFreeObject(Player);
Wait(20);
RCC := RCC + Integer(Result);
until (RCC = 2) or (GetTimeRunning - iTime > 500);
Result := IsInteractingWithMe(Index) or RCC = 2;
end;
//...SCAR Code:// Good:
function R_InFight : Boolean;
var
Player, RCC, iTime : Integer;
begin
iTime := GetTimeRunning;
repeat
Player := SmartGetFieldObject(0, MyPlayer);
Result := SmartGetFieldInt(Player, CharAnim) > 0;
SmartFreeObject(Player);
Wait(20);
RCC := RCC + Integer(Result);
until (RCC = 2) or (GetTimeRunning - iTime > 500);
end;
//...
if Left then
Result := IsInteractingWithMe(Index) or R_InFight
else
if IsOptionMenuOpen then
begin
ChooseOption('ttack');
WWM;
Result := IsInteractingWithMe(Index) or R_InFight;
end;
//...- Option 2: Loops! Create a loop statement and use it to cycle through. Example:
SCAR Code:// Bad:
MakeCompass(IntToStr(180));
WaitRR(200, 300);
P := Point(Points[1].x + Random(2) - (2), Points[1].y - Random(3));
if not TileOnMS(P, 20) then
begin
WalkToTile(P, 1, 0);
R_Flag;
end;
P := TileToMS(P, 20);
MMouse(P.x, P.y, 5, 5);
WaitRR(80, 100);
if IsUpText('limb') then
MyMouse(['limb']);
WaitWhileTele(2);
WaitRR(400, 600);
MakeCompass(IntToStr(360));
WaitRR(200, 300);
P := Point(Points[1].x + Random(2) - (4), Points[1].y - Random(3));
if not TileOnMS(P, 20) then
begin
WalkToTile(P, 1, 0);
R_Flag;
end;
P := TileToMS(P, 20);
MMouse(P.x, P.y, 5, 5);
WaitRR(80, 100);
if IsUpText('limb') then
MyMouse(['limb']);
WaitWhileTele(2);
WaitRR(400, 600);Notice the good and bad sections. The good has a loop and it is half the size, it uses some math and makes it much more efficient. Saves compiling times as well.SCAR Code:// Good:
for I := 1 to 2 do
begin
MakeCompass(IntToStr(180 * I));
WaitRR(200, 300);
P := Point(Points[1].x + Random(2) - (2 * (I - 1)), Points[1].y - Random(3));
if not TileOnMS(P, 20) then
begin
WalkToTile(P, 1, 0);
R_Flag;
end;
P := TileToMS(P, 20);
MMouse(P.x, P.y, 5, 5);
WaitRR(80, 100);
if IsUpText('limb') then
MyMouse(['limb']);
WaitWhileTele(2);
WaitRR(400, 600);
end;- Option 3: Combine Procedures! Instead of having 4 procedures to declare 4 DDTMs why not use one procedure to declare any of them?
SCAR Code:// Bad:
procedure BronzeBarD;
var
BColor: integer;
SubPoints: array[0..3] of TDTMPointDef;
MainPoint : TDTMPointDef;
BarTDTM: TDTM;
begin
MainPoint.x:=68;
MainPoint.y:=224;
//...
BarTDTM.MainPoint := MainPoint;
BarTDTM.SubPoints := SubPoints;
BarDTM := AddDTM(BarTDTM);
end;
procedure IronBarD;
var
BColor: integer;
SubPoints: array[0..3] of TDTMPointDef;
MainPoint : TDTMPointDef;
BarTDTM: TDTM;
begin
MainPoint.x:=68;
MainPoint.y:=224;
//...
BarTDTM.MainPoint := MainPoint;
BarTDTM.SubPoints := SubPoints;
BarDTM := AddDTM(BarTDTM);
end;
procedure SteelBarD;
var
BColor: integer;
SubPoints: array[0..3] of TDTMPointDef;
MainPoint : TDTMPointDef;
BarTDTM: TDTM;
begin
MainPoint.x:=68;
MainPoint.y:=224;
//...
BarTDTM.MainPoint := MainPoint;
BarTDTM.SubPoints := SubPoints;
BarDTM := AddDTM(BarTDTM);
end;SCAR Code:// Good:
procedure BarD(Bar: string); //I could use just a DTM with a tol of 442, but this is more accurate
var
BColor: integer;
SubPoints: array[0..3] of TDTMPointDef;
MainPoint : TDTMPointDef;
BarTDTM: TDTM;
begin
case Lowercase(bar) of
'bronze': BColor := 1451311;
'iron': BColor := 3223861;
'steel': BColor := 4802895;
'mith': BColor := 4008489;
'addy': BColor := 2831658;
'rune': BColor := 4274988;
else
begin
Writeln('Bar Color was invalid choice.');
exit;
end;
end;
MainPoint.x:=68;
MainPoint.y:=224;
SubPoints[0].x:=82;
SubPoints[0].y:=223;
//...
BarTDTM.MainPoint := MainPoint;
BarTDTM.SubPoints := SubPoints;
BarDTM := AddDTM(BarTDTM);
end;- Advanced Code:
- This is not a huge deal to me, but I do look for certain things:
- 1: TPAs: These are a highly recommended point. They are the current style of object finding and must be used correctly. Although Custom TPAs are not absolutely necessary, I look at them as a necessity, personally, here is an example, more advanced than necessary (Its my object finder):
TPA's For Dummys!SCAR Code:function NFindObj(Colors : TIntegerArray; UpTexts : TStringArray; w, h, minCount, Tol : Integer) : Boolean;
var
Pts : T2DPointArray;
P : TPoint;
CTS, I, Hi : Integer;
begin
CTS := GetColorToleranceSpeed;
try
ColorToleranceSpeed(2);
SetArrayLength(Pts, 2);
for I := 0 to High(Colors) do
begin
FindColorsSpiralTolerance(MSCX, MSCY, Pts[0], Colors[I], MSx1, MSy1, MSx2, MSy2, Tol);
Pts[1] := CombineTPA(Pts[0], Pts[1]);
end;
if (Length(Pts[1]) = 0) then
begin
SRL_Warn('NFindObj', 'Could not find any colors.', -1);
Exit;
end;
Pts := SplitTPAEx(Pts[1], w, h);
SortATPAFrom(Pts, Point(MSCX, MSCY));
Hi := High(Pts);
for I := 0 to Hi do
begin
if Length(Pts[I]) < MinCount then Continue;
P := MiddleTPA(Pts[I]);
MMouse(P.x - 3, P.y - 3, 7, 7);
WaitRR(80, 120);
if IsUpTextMultiCustom(UpTexts) then
begin
Result := MyMouse(UpTexts);
Exit;
end;
end;
Result := False;
finally
ColorToleranceSpeed(CTS);
end;
end;- 2. DTMs/DDTMs: These are crucial becuase they are the basis of item finding and IMO one of the best map walking procedures, except reflection. An example of these:
DDTM TutorialSCAR Code:procedure BarD(Bar: string);
var
BColor: integer;
SubPoints: array[0..3] of TDTMPointDef;
MainPoint : TDTMPointDef;
BarTDTM: TDTM;
begin
case Lowercase(bar) of
'bronze': BColor := 1451311;
'iron': BColor := 3223861;
'steel': BColor := 4802895;
'mith': BColor := 4008489;
'addy': BColor := 2831658;
'rune': BColor := 4274988;
end;
if BColor = 0 then
begin
Writeln('Bar Color was invalid choice.');
exit;
end;
MainPoint.x:=68;
MainPoint.y:=224;
MainPoint.areasize:=1
MainPoint.areashape:=0;
MainPoint.color:=BColor;
MainPoint.tolerance:=5;
SubPoints[0].x:=82;
SubPoints[0].y:=223;
SubPoints[0].areasize:=0;
SubPoints[0].areashape:=0;
SubPoints[0].color:=65536;
SubPoints[0].tolerance:=0;
SubPoints[1].x:=70;
SubPoints[1].y:=236;
SubPoints[1].areasize:=0;
SubPoints[1].areashape:=0;
SubPoints[1].color:=65536;
SubPoints[1].tolerance:=0;
SubPoints[2].x:=55;
SubPoints[2].y:=231;
SubPoints[2].areasize:=0;
SubPoints[2].areashape:=0;
SubPoints[2].color:=65536;
SubPoints[2].tolerance:=0;
SubPoints[3].x:=69;
SubPoints[3].y:=215;
SubPoints[3].areasize:=1;
SubPoints[3].areashape:=0;
SubPoints[3].color:=65536;
SubPoints[3].tolerance:=0;
BarTDTM.MainPoint := MainPoint;
BarTDTM.SubPoints := SubPoints;
BarDTM := AddDTM(BarTDTM);
end;- 3. Banking: Its not necessarily advanced, but it shows your script is better. I won't go into detail on this. Its too specific.
- The Simple Stuff, you don't think is important, but I notice and will vote no for:
- Memory Leaks: You make a memory leak, I forget how to click yes. Simple. When you declare a DTM or a Bitmap or Call a SmartGetFieldObject you MUST free it! Here is a list of the freeing procedures:
Without freeing, you can crash a script, or just eat the hell out of a computers resources while also causing a lot of lag.SCAR Code:procedure FreeDTM(DTM : Integer);
procedure FreeBitmap(Bitmap : Integer);
procedure SmartFreeObject(Object : Integer);- Correct Multiplayer: This should be added, it shows you know how to use logic. Its not too hard, just create a loop outside your main-loop where you switch players. Now, if you do it wrong, its worse than not at all, so be careful. Adding MultiPlayer
- AntiBan: This is crucial, its missing? NO! Antiban ranges from random coords in ALL clicking (Within Reason) and Random Waits (Within Reason) do full out AntiBan procedures. In some of my scripts, I have no antiban procedures, it is ALL in the script itself. This can be better or worse, you pick. I will not vote yes for people who use others, regardless of credit. Adding AntiBan and AntiRandom Tutorial!
- AntiRandoms: Insta-No if missing. These can be done using either reflection, SRL, or both. Here is a good procedure:
I will not vote a yes for people who do not create their own. Adding AntiBan and AntiRandom Tutorial!SCAR Code:function FindRandoms : Boolean;
begin
Result := R_FindRandoms;
if not Result then
Result := FindNormalRandoms;
if not Result then
Result := ClickContinue(True, True);
end;- Crediting: Another instant no. If you do not credit people correctly, then its a no. Also, if more than 60% of your script is someone else's its also a no. Here is an example of crediting:
SCAR Code:{*******************************************************************************
function CheckQuest(Quest: string): Boolean;
By: lordsaturn
Description: Will return true if the quest 'Quest' is completed, and perform the
action declared in 'Action'.
*******************************************************************************}
function CheckQuest(Quest: string; Action: fnct_ActionOptions): Boolean;
var
arS: TStringArray;
//...- Arrays, Dynamic and Static: I always look for good use of them. Dynamic arrays aren't always useful. But static arrays should ALWAYS be used when you have multiple variables, an example:
SCAR Code:// Bad:
var
I, II, III, IIII, IIIII, IIIIII : Integer;
begin
I := 1;
II := 2;
III := 4;
IIII := 3;
IIIII := 5;
IIIIII := 6;
Writeln(IntToStr(I) + ', ' + IntToStr(II) + ', ' + IntToStr(III) + ', ' + IntToStr(IIII)
+ ', ' + IntToStr(IIIII) + ', ' + IntToStr(IIIIII));
end;This is a poor example, as they take up similar lines, but should the array have been larger, the space saved and the length of space taken would be much greater. Also, less variables and you can use things like for loops better.SCAR Code://Good:
var
Ints : TIntegerArray;
S : String;
I : Integer;
begin
Ints := [1, 2, 4, 3, 5, 6];
for I := 0 to 5 do
S := S + IntToStr(Ints[I]) + ', '
Writeln(S);
end;- Reflection:
- Well, I love it. I will not vote no if you have it, though, unless you can really blow my socks off, I will not vote favorably to it.
- If you have apply with a 100 line script of reflection, I will vote no since its not advanced, you use reflection well, I will vote you a yes.
Finally, this is under-construction, if you have suggestions, please post.
Also, I will update the formatting .
Please let me vote more yes's