SRL Archive - Archive

SRL Member Competition#5 Script#1


YoHoJo

2009-12-21 01:43:12

{*******************************************************************************
Procedure AutoRespond;
By: ***
Description: Will respond to common phrases with a random response.
Usage: AutoRespond; Just call this procedure along with your antirandom checks.
*******************************************************************************}
Procedure AutoRespond;
Var
I, Q, thePos: Integer;
PlayerName, Msg: String;
ArrayTrigger, ArrayResponse : TStringArray;
Begin
If (Not(Players[CurrentPlayer].Booleans[3])) then Exit;
PlayerName := Lowercase(GetChatBoxText(8, clMessage));
Msg := Lowercase(GetChatBoxText(8, clChat));
If(LastChat = Msg) Then Exit;
If(Length(Msg) < 2) Then Exit;
LastChat := Msg;
WriteLn('Found Chat: '+Msg);
If(PlayerName = (Lowercase(Players[CurrentPlayer].Name + ':'))) Or (isQuickChat = True) Then
Begin
//WriteLn('Not talking to ourselves now, are we?');
Exit;
End;
For I:= 0 To 7 Do
Begin
Case I Of
0: Begin //Hellos
ArrayTrigger := ['hi', 'hello', 'hey', 'hai', 'sup', 'wats up', 'whats up', 'what''s up', 'wazzup', 'how are you', 'hola', 'holla', 'hay', 'hallo', LowerCase(Players[CurrentPlayer].Name)];
ArrayResponse := ['hi', 'hello', 'hey', 'hai', 'sup', 'wats up', 'whats up', 'watz up', 'wazzup', 'how are you', 'the name is ' + LowerCase(Players[CurrentPlayer].Name)];
End;
1: Begin //Byes
ArrayTrigger := ['bye', 'goodbye', 'good bye', 'cya', 'later', 'see ya', 'so long', 'adios'];
ArrayResponse := ['bye', 'goodbye', 'good bye', 'cya', 'later', 'see ya', 'byebye', 'get to da chopper'];
End;
2: Begin //Requests / leave
ArrayTrigger := ['can you', 'can i', 'may i', 'can we', 'may we', 'go away', 'get away', 'get out', 'stop', 'trade', 'trd', 'leave', 'change w', 'switch w', 'change t', 'switch t', '2 each', 'two each', 'share', 'robot', 'macro', 'botter', 'cheater', '2each'];
ArrayResponse := ['sorry', 'sry', 'no can do', 'no', 'nah', 'nuh uh', 'nope'];
End;
2: Begin //Questions
ArrayTrigger := ['what', 'where', 'how', 'do you', 'do u', 'were', 'wat', 'are u', 'are you', 'u th', 'u kno', 'you kno', 'wanna', 'want to', 'want 2'];
ArrayResponse := ['i dunno', 'wat', 'what', 'uhh', 'sorry', 'sry', 'no can do', 'no', 'nah', 'nuh uh', 'nope', '?'];
End;
3: Begin //Question mark response
ArrayTrigger := ['?'];
ArrayResponse := ['wat', 'what', 'uhh', 'huh', '?'];
End;
4: Begin //lolz
ArrayTrigger := ['lol', 'l o l', 'l.o.l', 'lawl', 'lul', 'i wasn''t talk', 'i wasnt talk', 'i was not talk', 'i not talk', 'im not talk', 'i''m not talk', 'i aint talk', 'lmao', 'rofl'];
ArrayResponse := ['lol', 'l o l', 'lawl', 'lul', 'hehe', 'heh', 'ha', 'meh', 'lolol', 'lollercakes', 'uber lulz', 'lulz', 'lololol', '^^', '^_^', '=[)', ':D', ':)'];
End;
5: Begin //Insults
ArrayTrigger := ['f u', 'noob', 'choob', 'froob', 'dum', 'dumb', 'nub', 'chub', 'frick', 'fok', 'effing', 'f ing', 'f-ing', 'fing', 'freakin', 'fuggin', 'damn', 'ass', 'scrw', 'screw', 'jerk'];
ArrayResponse := ['leave me alone', 'go away', 'ur mean', 'im rubber ur glue', 'im rubber and you are glue', 'suuure', 'talk about calling the kettle black', 'u too', 'thanks, thanks alot', 'dont make me report you', 'yeah right', 'ya right', 'yeah yeah...', 'what eva', 'what ever'];
End;
6: Begin //Compliments
ArrayTrigger := ['ur good', 'nice', 'cool a', 'cool s', 'cool w', 'cool h', 'ur cool', 'u r cool', 'your cool', 'you''re cool'];
ArrayResponse := ['ty', 'thanks', 'ty :D', 'ty :)', 'thx', 'ty', 'omg ty'];
End;
End; //case end
For Q:= 0 To High(ArrayTrigger) Do
Begin
thePos := Pos(ArrayTrigger[Q], Msg);
If(thePos = 1) Then
Begin
If(TimeFromMark(MsgTimers[I]) > 320000) Then
Begin
MarkTime(MsgTimers[I]);
TypeSendEx(AddMistakes(ArrayResponse[RandomRange(0, High(ArrayResponse))], 20), True);
Players[CurrentPlayer].Integers[8] := Players[CurrentPlayer].Integers[8] + 1;
Exit;
End Else
Exit;
End
End;
End;
End;

{*******************************************************************************
Procedure VRoadWalk(SR, ER, R, I1, I2: Integer);
By: ***
Description: RadialRoadWalking with built in autocoloring for Varrock Roads.
(Reliable) Uses TPAs and has very low chance of failure.
Usage: (Same as RadialRoadWalk) SR = Start Radial| ER = End Radial| R = Radius|
I1 = offsetX incase flag doesn't click.| I2 = offsetY incase flag doesn't click.
VRoadWalk(20, 80, 65, 1, 1);
*******************************************************************************}
Procedure VRoadWalk(SR, ER, R, I1, I2: Integer);
Var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
Begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(12, 2);
If Not(FindColorsTolerance(arP, 8553093, MMX1, MMY1, MMX2, MMY2, 5)) Then
Begin
Status('Couldn''t Find Path!');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
End;
//SortTPAFrom(arP, Point(MMCX, MMCY));
arC := GetColors(arP);
ClearSameIntegers(arC);
DebugTPA(arP, '');
arL := High(arC);
For i := 0 To arL Do
Begin
Status('Attemping RadialWalk for color: '+IntToStr(arC[i]));
If (RadialRoadWalk(arC[i], SR, ER, R, I1, I2)) Then
Begin
Status('Success!');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
End;
End;
Players[CurrentPlayer].Active := False;
WriteLn('Failed to find the road color!');
End;

{*******************************************************************************
procedure StraightenMap(Direction: String; Accuracy: Integer);
By: ***
Description: Will attempt to straighten the minimap via checking a horizontal
length of wall. Built in wall autocoloring.
Can straighten N, E, S, W. Smart compatible. Accuracy is the
length of wall required for finishing in pixils.
Usage: StraightenMap('N', 20); Will straighten the map north with 20 pixil accuracy.
*******************************************************************************}
Procedure StraightenMap(Direction: String; Accuracy: Integer);
Var
Points: TPointArray;
I1, I2, D, Timer, WallColor, LineSize: Integer;
Begin
Status('Starting to straighten map...');
MakeCompass(Direction);
MarkTime(Timer);
Repeat
WallColor := 16185843;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(15.0, 11.0);
FindColorsTolerance(Points, WallColor, MMX1, MMY1, MMX2, MMY2, 5);
DebugTPA(Points, '');
For I1 := 0 To High(Points)-1 Do
Begin
if(LineSize >= Accuracy) then break;
If SimilarColors(GetColor(Points[I1].x,Points[I1].y), WallColor, 5) Then
Repeat
if(LineSize >= Accuracy) then break;
If SimilarColors(GetColor(Points[I1].x+I2,Points[I1].y), WallColor, 4) Then
Begin
Inc(LineSize);
End Else
Begin
If SimilarColors(GetColor(Points[I1].x+I2, Points[I1].y+1), WallColor, 4) And
SimilarColors(GetColor(Points[I1].x+I2, Points[I1].y+2), WallColor, 4) And Not
SimilarColors(GetColor(Points[I1].x+I2, Points[I1].y-2), WallColor, 4) Then
D := 1
Else If SimilarColors(GetColor(Points[I1].x+I2, Points[I1].y-1), WallColor, 4) And
SimilarColors(GetColor(Points[I1].x+I2, Points[I1].y-2), WallColor, 4) And Not
SimilarColors(GetColor(Points[I1].x+I2, Points[I1].y+2), WallColor, 4) Then
D := 2;
Break;
End;
Inc(I2);
Until(LineSize >= Accuracy);
If (LineSize < Accuracy) Then
LineSize := 0;
I2 := 0;
End;
Case LowerCase(Direction) Of
'n': If (rs_GetCompassAngleDegrees > 20) Or (rs_GetCompassAngleDegrees < 340) Then MakeCompass(Direction);
'e': If (rs_GetCompassAngleDegrees > 110) Or (rs_GetCompassAngleDegrees < 70) Then MakeCompass(Direction);
's': If (rs_GetCompassAngleDegrees > 200) Or (rs_GetCompassAngleDegrees < 160) Then MakeCompass(Direction);
'w': If (rs_GetCompassAngleDegrees > 290) Or (rs_GetCompassAngleDegrees < 240) Then MakeCompass(Direction);
End;
Status('Straightening...'+IntToStr(TimeFromMark(Timer)));
If (LineSize >= Accuracy) Then
Begin
WriteLn('Done! Took: '+ IntToStr(TimeFromMark(Timer)/1000)+' Seconds.');
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(0);
Exit;
end;

If (TimeFromMark(Timer) >= 45000) Then
Begin
WriteLn('Error Fixing Map! Taking too long...');
MakeCompass(Direction);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(0);
Exit;
End;
Case D Of
0: SendArrowSilentWait(3, (30 + Random(130)));
1: SendArrowSilentWait(1, (30 + Random(130)));
2: SendArrowSilentWait(3, (30 + Random(130)));
End;
Wait(RandomRange(150, 300));
Until(LineSize >= Accuracy);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(0);
End;

{*******************************************************************************
procedure DropPatternEx(InvSlots: TIntegerArray; Exclude: Boolean);
By: ***
Description: Drops items in slots specified in "InvSlots" in 14 randomly selected patterns.
If Exclude is True, it will drop all slots, except the specified slots.
If Exclude is False, it will drop only the specified slots.
Usage: "DropPatternEx([1, 3, 5, 8], False);" drops slots 1, 3, 5, 8.
"DropPatternEx([1, 3, 5, 8], True);" drops all slots except 1, 3, 5, 8.
*******************************************************************************}
procedure DropPatternEx(InvSlots: TIntegerArray; Exclude: Boolean);
var
I: Byte;
Ptn: TIntegerArray;
begin
SetLength(Ptn, 28);
Gametab(tab_inv);

{ -Patterns-
0: Snake columns
1: Snake rows
2: Box spiral
3: Columns
4: Rows
5: Every other row
6: Every other column }

case Random(7) of
0: Ptn:=[1,5,9,13,17,21,25,26,22,18,14,10,6,2,3,7,11,15,19,23,27,28,24,20,16,12,8,4];
1: Ptn:=[1,2,3,4,8,7,6,5,9,10,11,12,16,15,14,13,17,18,19,20,24,23,22,21,25,26,27,28];
2: Ptn:=[1,2,3,4,8,12,16,20,24,28,27,26,25,21,17,13,9,5,6,7,11,15,19,23,22,18,14,10];
3: Ptn:=[1,5,9,13,17,21,25,2,6,10,14,18,22,26,3,7,11,15,19,23,27,4,8,12,16,20,24,28];
4: Ptn:=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28];
5: Ptn:=[1,2,3,4,9,10,11,12,17,18,19,20,25,26,27,28,5,6,7,8,13,14,15,16,21,22,23,24];
6: Ptn:=[1,5,9,13,17,21,25,4,8,12,16,20,24,28,2,6,10,14,18,22,26,3,7,11,15,19,23,27];
end;

if Random(2) = 1 then
InvertTIA(Ptn);

for I := 0 to 27 do
if(Exclude)then
if (not InIntArray(InvSlots, Ptn[I])) then
DropItem(Ptn[i])
else
if (InIntArray(InvSlots, Ptn[I])) then
DropItem(Ptn[i]);

end;

{*******************************************************************************
procedure DropAll;
By: ***
Description: Drops all items in inventory using patterns.
*******************************************************************************}
procedure DropAll;
begin
DropPatternEx([], True);
end;

{*******************************************************************************
procedure DropAllExcept(IgnoreInvSlots: TIntegerArray);
By: ***
Description: Drops all items except specified in inventory using patterns.
*******************************************************************************}
procedure DropAllExcept(IgnoreInvSlots: TIntegerArray);
begin
DropPatternEx(IgnoreInvSlots, True);
end;

{*******************************************************************************
procedure DropArray(InvSlots: TIntegerArray);
By: ***
Description: Drops item positioned equivalent to numbers in "InvSlots" array.
Example: "DropArray([2, 4, 9, 12]);" would drop items in InvSlot 2, 4, 9 and 12.
*******************************************************************************}
procedure DropArray(InvSlots: TIntegerArray);
begin
DropPatternEx(InvSlots, False);
end;

{*******************************************************************************
(DEPRECATED)Procedure DropPattern(Which: Integer);(DEPRECATED)
By: ***
Description: Drops all items in inventory using DropAll; (DEPRECATED)
WARNING: This method is out of date! Use "DropAll;" instead!
*******************************************************************************}
procedure DropPattern(Which: Integer);
begin
DropAll;
end;

Point System:

* Individuality (75)
* Presentation (75)
* Technique & Creativity (100)
* Reliability (125)
* Efficiency & Simplicity (150)

Nava2

2010-01-17 13:04:38

{*******************************************************************************
Procedure AutoRespond;
By: ***
Description: Will respond to common phrases with a random response.
Usage: AutoRespond; Just call this procedure along with your antirandom checks.
*******************************************************************************}

{n2 remarks:
-presentation: Standards of uppercase Bold.. NO.
-not very original procedure.. Autoresponders have been used many times.
-efficiency, could have been implemented into FindNormalRandoms since a call to
Respond is made
-Most of the function is the catalouge of responses
}
Procedure AutoRespond;
Var
I, Q, thePos: Integer;
PlayerName, Msg: String;
ArrayTrigger, ArrayResponse : TStringArray;
Begin
If (Not(Players[CurrentPlayer].Booleans[3])) then Exit; // Shouldn't use the player record for SRL, unless you add to it
PlayerName := Lowercase(GetChatBoxText(8, clMessage)); // Why not use GetTextAtEx for a certain area, you are wasting time getting it all
Msg := Lowercase(GetChatBoxText(8, clChat));
If(LastChat = Msg) Then Exit; // where is the LastChat variable defined?
If(Length(Msg) < 2) Then Exit; // this and the line before *could* be moved together, with the first before hand
LastChat := Msg;
WriteLn('Found Chat: '+Msg); // SRL_Debug should be used, with a sensitivity. This will spam quite nicely.
If(PlayerName = (Lowercase(Players[CurrentPlayer].Name + ':'))) Or (isQuickChat = True) Then // QuickChat should be implemented
Begin
//WriteLn('Not talking to ourselves now, are we?');
Exit;
End;
For I:= 0 To 7 Do
Begin // could have used a 2D array for this, making it shorter, no need for case
Case I Of // this should have been loaded from a library. This is a very big waste of space. Not to mention, your responses mimic, for the most part, your triggers.
0: Begin //Hellos // your triggers should allow for tokens as well. $username $mininglevel, etc.
ArrayTrigger := ['hi', 'hello', 'hey', 'hai', 'sup', 'wats up', 'whats up', 'what''s up', 'wazzup', 'how are you', 'hola', 'holla', 'hay', 'hallo', LowerCase(Players[CurrentPlayer].Name)];
ArrayResponse := ['hi', 'hello', 'hey', 'hai', 'sup', 'wats up', 'whats up', 'watz up', 'wazzup', 'how are you', 'the name is ' + LowerCase(Players[CurrentPlayer].Name)];
End;
1: Begin //Byes
ArrayTrigger := ['bye', 'goodbye', 'good bye', 'cya', 'later', 'see ya', 'so long', 'adios'];
ArrayResponse := ['bye', 'goodbye', 'good bye', 'cya', 'later', 'see ya', 'byebye', 'get to da chopper'];
End;
2: Begin //Requests / leave
ArrayTrigger := ['can you', 'can i', 'may i', 'can we', 'may we', 'go away', 'get away', 'get out', 'stop', 'trade', 'trd', 'leave', 'change w', 'switch w', 'change t', 'switch t', '2 each', 'two each', 'share', 'robot', 'macro', 'botter', 'cheater', '2each'];
ArrayResponse := ['sorry', 'sry', 'no can do', 'no', 'nah', 'nuh uh', 'nope'];
End;
2: Begin //Questions
ArrayTrigger := ['what', 'where', 'how', 'do you', 'do u', 'were', 'wat', 'are u', 'are you', 'u th', 'u kno', 'you kno', 'wanna', 'want to', 'want 2'];
ArrayResponse := ['i dunno', 'wat', 'what', 'uhh', 'sorry', 'sry', 'no can do', 'no', 'nah', 'nuh uh', 'nope', '?'];
End;
3: Begin //Question mark response
ArrayTrigger := ['?'];
ArrayResponse := ['wat', 'what', 'uhh', 'huh', '?'];
End;
4: Begin //lolz
ArrayTrigger := ['lol', 'l o l', 'l.o.l', 'lawl', 'lul', 'i wasn''t talk', 'i wasnt talk', 'i was not talk', 'i not talk', 'im not talk', 'i''m not talk', 'i aint talk', 'lmao', 'rofl'];
ArrayResponse := ['lol', 'l o l', 'lawl', 'lul', 'hehe', 'heh', 'ha', 'meh', 'lolol', 'lollercakes', 'uber lulz', 'lulz', 'lololol', '^^', '^_^', '=[)', ':D', ':)'];
End;
5: Begin //Insults
ArrayTrigger := ['f u', 'noob', 'choob', 'froob', 'dum', 'dumb', 'nub', 'chub', 'frick', 'fok', 'effing', 'f ing', 'f-ing', 'fing', 'freakin', 'fuggin', 'damn', 'ass', 'scrw', 'screw', 'jerk'];
ArrayResponse := ['leave me alone', 'go away', 'ur mean', 'im rubber ur glue', 'im rubber and you are glue', 'suuure', 'talk about calling the kettle black', 'u too', 'thanks, thanks alot', 'dont make me report you', 'yeah right', 'ya right', 'yeah yeah...', 'what eva', 'what ever'];
End;
6: Begin //Compliments
ArrayTrigger := ['ur good', 'nice', 'cool a', 'cool s', 'cool w', 'cool h', 'ur cool', 'u r cool', 'your cool', 'you''re cool'];
ArrayResponse := ['ty', 'thanks', 'ty :D', 'ty :)', 'thx', 'ty', 'omg ty'];
End;
End; //case end
For Q:= 0 To High(ArrayTrigger) Do // small thing, high in for loop, unless its first, is slower
Begin
thePos := Pos(ArrayTrigger[Q], Msg);
If(thePos = 1) Then // why would you want the pos to be *ONLY* one?
Begin
If(TimeFromMark(MsgTimers[I]) > 320000) Then // good, should use a constant/global var though
Begin
MarkTime(MsgTimers[I]);
TypeSendEx(AddMistakes(ArrayResponse[RandomRange(0, High(ArrayResponse))], 20), True); //Random(Length(ArrayResponse)); The Mistakes should be a constant or global var
Players[CurrentPlayer].Integers[8] := Players[CurrentPlayer].Integers[8] + 1; // again, player record is BAD for this stuff, unless you create a new part of the record.
Exit;
End Else
Exit;
End
End;
End;
End;

{*******************************************************************************
Procedure VRoadWalk(SR, ER, R, I1, I2: Integer);
By: ***
Description: RadialRoadWalking with built in autocoloring for Varrock Roads.
(Reliable) Uses TPAs and has very low chance of failure.
Usage: (Same as RadialRoadWalk) SR = Start Radial| ER = End Radial| R = Radius|
I1 = offsetX incase flag doesn't click.| I2 = offsetY incase flag doesn't click.
VRoadWalk(20, 80, 65, 1, 1);
*******************************************************************************}
Procedure VRoadWalk(SR, ER, R, I1, I2: Integer);
Var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
Begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(12, 2); // these really really don't seem right..
If Not(FindColorsTolerance(arP, 8553093, MMX1, MMY1, MMX2, MMY2, 5)) Then
Begin
Status('Couldn''t Find Path!');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
End;
//SortTPAFrom(arP, Point(MMCX, MMCY));
arC := GetColors(arP);
ClearSameIntegers(arC);
DebugTPA(arP, '');
arL := High(arC);
For i := 0 To arL Do
Begin
Status('Attemping RadialWalk for color: '+IntToStr(arC[i]));
If (RadialRoadWalk(arC[i], SR, ER, R, I1, I2)) Then
Begin
Status('Success!');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
End;
End;
Players[CurrentPlayer].Active := False; // you never reset the CTS if it fails.
// you should NEVER set a play inactive without the scripter knowing. (unless its on login :p)
WriteLn('Failed to find the road color!');
End;

{*******************************************************************************
procedure StraightenMap(Direction: String; Accuracy: Integer);
By: ***
Description: Will attempt to straighten the minimap via checking a horizontal
length of wall. Built in wall autocoloring.
Can straighten N, E, S, W. Smart compatible. Accuracy is the
length of wall required for finishing in pixils.
Usage: StraightenMap('N', 20); Will straighten the map north with 20 pixil accuracy.
*******************************************************************************}
Procedure StraightenMap(Direction: String; Accuracy: Integer);
Var
Points: TPointArray;
I1, I2, D, Timer, WallColor, LineSize: Integer;
Begin
Status('Starting to straighten map...'); // SRL_Debug
MakeCompass(Direction);
MarkTime(Timer);
Repeat
WallColor := 16185843; // constant
ColorToleranceSpeed(2); // get the CTS so you can reset it later
SetColorSpeed2Modifiers(15.0, 11.0); // REALLY LARGE
FindColorsTolerance(Points, WallColor, MMX1, MMY1, MMX2, MMY2, 5);
DebugTPA(Points, ''); // you shouldn't call this everytime :p BAAAD waste of CPU
For I1 := 0 To High(Points)-1 Do // why High-1? :s
Begin
if(LineSize >= Accuracy) then break;
If SimilarColors(GetColor(Points[I1].x,Points[I1].y), WallColor, 5) Then
Repeat
if(LineSize >= Accuracy) then break;
If SimilarColors(GetColor(Points[I1].x+I2,Points[I1].y), WallColor, 4) Then
Begin
Inc(LineSize);
End Else
Begin
// replace with a for loop..
If SimilarColors(GetColor(Points[I1].x+I2, Points[I1].y+1), WallColor, 4) And
SimilarColors(GetColor(Points[I1].x+I2, Points[I1].y+2), WallColor, 4) And Not
SimilarColors(GetColor(Points[I1].x+I2, Points[I1].y-2), WallColor, 4) Then
D := 1
Else If SimilarColors(GetColor(Points[I1].x+I2, Points[I1].y-1), WallColor, 4) And
SimilarColors(GetColor(Points[I1].x+I2, Points[I1].y-2), WallColor, 4) And Not
SimilarColors(GetColor(Points[I1].x+I2, Points[I1].y+2), WallColor, 4) Then
D := 2;
Break;
End;
Inc(I2);
Until(LineSize >= Accuracy);
If (LineSize < Accuracy) Then
LineSize := 0;
I2 := 0;
End;
Case LowerCase(Direction) Of
'n': If (rs_GetCompassAngleDegrees > 20) Or (rs_GetCompassAngleDegrees < 340) Then MakeCompass(Direction);
'e': If (rs_GetCompassAngleDegrees > 110) Or (rs_GetCompassAngleDegrees < 70) Then MakeCompass(Direction);
's': If (rs_GetCompassAngleDegrees > 200) Or (rs_GetCompassAngleDegrees < 160) Then MakeCompass(Direction);
'w': If (rs_GetCompassAngleDegrees > 290) Or (rs_GetCompassAngleDegrees < 240) Then MakeCompass(Direction);
End;
Status('Straightening...'+IntToStr(TimeFromMark(Timer)));
If (LineSize >= Accuracy) Then
Begin
WriteLn('Done! Took: '+ IntToStr(TimeFromMark(Timer)/1000)+' Seconds.');
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(0); // set the previous?
Exit;
end;

If (TimeFromMark(Timer) >= 45000) Then
Begin
WriteLn('Error Fixing Map! Taking too long...');
MakeCompass(Direction);
SetColorSpeed2Modifiers(0.2, 0.2); // set the previous?
ColorToleranceSpeed(0);
Exit;
End;
Case D Of
0: SendArrowSilentWait(3, (30 + Random(130))); // this seems real bad... really really bad.
1: SendArrowSilentWait(1, (30 + Random(130)));
2: SendArrowSilentWait(3, (30 + Random(130)));
End;
Wait(RandomRange(150, 300)); // is this necessary? :s
Until(LineSize >= Accuracy); // this will never break because of the loop earlier sets it down..
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(0);
End;

{*******************************************************************************
procedure DropPatternEx(InvSlots: TIntegerArray; Exclude: Boolean);
By: ***
Description: Drops items in slots specified in "InvSlots" in 14 randomly selected patterns.
If Exclude is True, it will drop all slots, except the specified slots.
If Exclude is False, it will drop only the specified slots.
Usage: "DropPatternEx([1, 3, 5, 8], False);" drops slots 1, 3, 5, 8.
"DropPatternEx([1, 3, 5, 8], True);" drops all slots except 1, 3, 5, 8.
*******************************************************************************}
procedure DropPatternEx(InvSlots: TIntegerArray; Exclude: Boolean);
var
I: Byte;
Ptn: TIntegerArray;
begin
SetLength(Ptn, 28); // not necessary, the [] declaration will set the length.
Gametab(tab_inv); // what if the gametab fails?

{ -Patterns-
0: Snake columns
1: Snake rows
2: Box spiral
3: Columns
4: Rows
5: Every other row
6: Every other column }
// should use constants here.
case Random(7) of
0: Ptn:=[1,5,9,13,17,21,25,26,22,18,14,10,6,2,3,7,11,15,19,23,27,28,24,20,16,12,8,4];
1: Ptn:=[1,2,3,4,8,7,6,5,9,10,11,12,16,15,14,13,17,18,19,20,24,23,22,21,25,26,27,28];
2: Ptn:=[1,2,3,4,8,12,16,20,24,28,27,26,25,21,17,13,9,5,6,7,11,15,19,23,22,18,14,10];
3: Ptn:=[1,5,9,13,17,21,25,2,6,10,14,18,22,26,3,7,11,15,19,23,27,4,8,12,16,20,24,28];
4: Ptn:=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28];
5: Ptn:=[1,2,3,4,9,10,11,12,17,18,19,20,25,26,27,28,5,6,7,8,13,14,15,16,21,22,23,24];
6: Ptn:=[1,5,9,13,17,21,25,4,8,12,16,20,24,28,2,6,10,14,18,22,26,3,7,11,15,19,23,27];
end;

if Random(2) = 1 then
InvertTIA(Ptn); // this should be done before hand.

for I := 0 to 27 do
if(Exclude)then // this should be moved external to the for loop to stop it from being called everytime
if (not InIntArray(InvSlots, Ptn[I])) then
DropItem(Ptn[i]) // im not even sure if this works.. I think that the else here references the second if statement so if Exclue=False it wont work :|
else
if (InIntArray(InvSlots, Ptn[I])) then
DropItem(Ptn[i]);

end;

{
I like that you included these, but they don't benefit you in any way.. Sure, you shortened them. But it accomplishes very little.
}

{*******************************************************************************
procedure DropAll;
By: ***
Description: Drops all items in inventory using patterns.
*******************************************************************************}
procedure DropAll;
begin
DropPatternEx([], True);
end;

{*******************************************************************************
procedure DropAllExcept(IgnoreInvSlots: TIntegerArray);
By: ***
Description: Drops all items except specified in inventory using patterns.
*******************************************************************************}
procedure DropAllExcept(IgnoreInvSlots: TIntegerArray);
begin
DropPatternEx(IgnoreInvSlots, True);
end;

{*******************************************************************************
procedure DropArray(InvSlots: TIntegerArray);
By: ***
Description: Drops item positioned equivalent to numbers in "InvSlots" array.
Example: "DropArray([2, 4, 9, 12]);" would drop items in InvSlot 2, 4, 9 and 12.
*******************************************************************************}
procedure DropArray(InvSlots: TIntegerArray);
begin
DropPatternEx(InvSlots, False);
end;

// if its depreciated, don't include it.
{*******************************************************************************
(DEPRECATED)Procedure DropPattern(Which: Integer);(DEPRECATED)
By: ***
Description: Drops all items in inventory using DropAll; (DEPRECATED)
WARNING: This method is out of date! Use "DropAll;" instead!
*******************************************************************************}
procedure DropPattern(Which: Integer);
begin
DropAll;
end;

  1. Individuality - 40
    • Nothing really blew me away.. it wasn't anything *spectacular*.
  2. Presentation - 50
    • Clean code
    • The uppercase bolds tick me off..
    • Some comments throughout
    • good use of comments as function headers.
  3. Technique - 60
    • You did things efficently for the most part.
    • Couple iffy loops
    • The one-line procedures really bring this down.
  4. Reliability - 60
    • The auto responder needs a bigger vocab and some tokens for allowing fancier responses
    • The autocolor functions had CTS2 mods > 1 which I don't *think* are correct, especially that high.
    • Infinite loops etc.
  5. Efficiency - 100
    • not tooo bad, but could be better
    • use more arrays or at least records to help you
    • Tokens in the auto responder
    • You set a lot of vars to the same thing in loops which should be done externally from the loop and that way you don't waste time
    • Some were.. very simple?

I'd consider adding the Drop procedure, the rest not really. +25

Total - 335/425

Cheers,
n2