TViYH
2008-10-13 20:17:26
Short tutorial, it's all in the script :]
Just trying to help a few people who need help with standards.
Correct me if I'm wrong, rep++ me if you learned something.
Just trying to help a few people who need help with standards.
Correct me if I'm wrong, rep++ me if you learned something.
program ScriptStandards;
{.include SRL\SRL.scar}
//2 spaces between every function or procedure, basically anything.
const
CamelBack = True; // Use camelback capitlization, starts 2 spaces from beginning line.
ObjectCol = 0;
var
x, y, i, l, DTM, BMP,
MyColor: Integer; // If has more than 6 per type, start a new line and use 2 spaces.
// Capitalize the type, also use camelback for words.
function FindMyObject: boolean; // Camelback the function name, lowercase the bold words,
var // lowercase the type.
x, y: Integer; // If it has vars, start a new line, lowercase the single
CustomTPA: TPointArray; // letter vars, camelback the words.
ATPA: T2DPointArray;
CustPoint: TPoint;
begin
if not LoggedIn then Exit; // Camelback the functions/procedures used, lowercase the bold words.
x := MSCX; // Always end declarations with a semicolon.
y := MSCY;
FindColorsSpiralTolerance(x, y, CustomTPA, ObjectCol, MSX1, MSY1, MSX2, MSY2, 5);
if (Length(CustomTPA) = 0) then Exit; // Use parentheses to show comparisons.
ATPA := SplitTPA(CustomTPA, 5);
SortATPASize(ATPA, True);
for i := 0 to High(ATPA) do // Lowercase the var in for loops.
begin
CustPoint := MiddleTPA(ATPA[i]);
MMouse(CustPoint.x, CustPoint.y, 3, 3);
Wait(250 + Random(125));
if IsUpText('ree') then // Don't use: if IsUpText('ree')=True then. It's not needed.
begin
Mouse(CustPoint.x, CustPoint.y, 0, 0, False);
if not ChooseOption('hop') then
Continue;
else
begin // You must add a begin here!
Result := True;
Exit;
end;
end;
end;
end;
begin // Start script
SetupSRL; // Load srl
if FindMyObject then // If it found it then
begin // begin something new, which is:
WriteLn('Found the object!'); // Write this if it found it,
Disguise('Found it!'); // Change scar's title to Found it! if it found it,
end else // If it didn't find it then
begin // begin something new, which is:
WriteLn('Couldn''t find it =['); // Write this if it didn't find it,
Disguise('Couldn''t find it...'); //Change scar's title to Couldn't find it...
end; // End the if then loop.
end. // End script