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)