Sorry for the double post, but I have changed some minor things, and added mood changing (not very advanced yet). Looking for more tips, suggestions, etc.
This will be entered in the SRL Comp (conveniently came right after I started this eh? xD), so I'm hoping to make it really good for it.
Here's the updated version, which doesn't seem to like compiling right now :confused::
{
I'd like to thank many people!
Viral, for pointing me towards, and posting, Nava's InChatArr function.
Wt-Fakawi, for creating the InChatArr function (I believe).
Nava, for posting the InChatArr function where Viral got it, regardless of the original creator.
Camo Kyle, for sitting with me in Lumbridge tower while we tried to figure out why it wasn't working (PSST! InChatMulti was broken!)
Botsrs, for sitting with me in Lumbridge tower and helping me try the fixed version.
Here's an example of what you can expect from the responses, may be
changed in later versions!
'laid back': Respond1 := ['Tis ', 'Yo, my wc lvl is ', 'My level be ', 'It be ', ''];
'polite': Respond1 := ['Thanks for asking, it is ', 'It is ', ''];
'bored': Respond1 := ['Lolz, it''s ', 'Dood! My wc level is ', '', 'Aren''t you smart? It''s obviously 99, duh!', 'Lolcat sayz it be ', 'Lolwut! My level be '];
'angry': Respond1 := ['What''s it matter? if you must know it''s ', 'Bah. ', ''];
}
const
StartPersonality = 'polite'; //Which personality to start with.
TimeBetweenResponds = 10000; //Time inbetween responds
RespondsToChangeAt = 10; //Number of times to respond before changing personality.
AngryToWhat = 'polite'; //Which personality to change to, from angry?
BoredToWhat = 'angry'; //Which personality to change to, from bored?
LaidBackToWhat = 'bored'; //Which personality to change to, from laid back?
PoliteToWhat = 'bored'; //Polite to which personality?
var
Respond1, I : array of string;
Personality : string;
N, C, TimeMarkerNow : Integer;
function InChatArr(Text: array of string): Boolean;
var
I, H: integer;
s: string;
begin
H := High(Text);
if (not (GetLastChatText(s))) then
LastChatter(s);
for I := 0 to H do
begin
if (Pos(Lowercase(Text[i]), (Lowercase(s))) > 0) then
begin
Result := true;
Exit;
end;
end;
end;
procedure SetupAutorespond;
begin
Personality := StartPersonality;
TimeMarkerNow := TimeBetweenResponds + 1;
end;
procedure Responding;
var
EditedName : string;
Responds : Integer;
begin
if not LoggedIn then
Exit;
if not TimeFromMark(TimeMarkerNow) > TimeBetweenResponds then
begin
WriteLn('Time from the last mark is not higher then the set time to wait between responses!');
Exit;
end;
EditedName := Players[currentplayer].name;
Delete(EditedName, 1, 1);
if not FindBlackChatMessage(EditedName) and InChatArr(['oodcutting', 'oodcut', 'ishing', 'ish', 'ine', 'ining', 'hi', 'hello', 'sup', 'yo', 'lol', 'lmao', 'rofl', 'haha']) then
begin
WriteLn('Here we go!');
I := ['oodcutting', 'oodcut', 'ishing', 'ish', 'ining', 'hi ', 'hello ', 'sup ', 'yo ', 'lol', 'lmao ', 'rofl ', 'haha ', 'rafting', 'raft', ''];
for N := 0 to GetArrayLength(I)-1 do
case InChat(lowercase(I[N])) of
True:
begin
C := N;
case C of
0..1 :
begin
case lowercase(Personality) of
'laid back': Respond1 := ['Tis ', 'Yo, my wc lvl is ', 'My level be ', 'It be ', ''];
'polite': Respond1 := ['Thanks for asking, it is ', 'It is ', ''];
'bored': Respond1 := ['Lolz, it''s ', 'Dood! My wc level is ', '', 'Aren''t you smart? It''s obviously 99, duh!', 'Lolcat sayz it be ', 'Lolwut! My level be '];
'angry': Respond1 := ['What''s it matter? if you must know it''s ', 'Bah. ', ''];
end;
case Random(4) of
0..2 : TypeSend(AddMistakes(Respond1[Random(GetArrayLength(Respond1))] + IntToStr(GetSkillInfo('woodcutting', True)), 20));
end;
TimeMarkerNow:=0;
Marktime(TimeMarkerNow);
Responds := Responds + 1;
end;
2..3 :
begin
case lowercase(Personality) of
'laid back': Respond1 := ['Tis ', 'Yo, my fishing lvl is ', 'It''s ', '', 'My level be ', 'It be '];
'polite': Respond1 := ['Thanks for asking, it is ', 'It is ', ''];
'bored': Respond1 := ['Lolz, it''s ', 'dood! My fishing level is ', '', 'Aren''t you smart? It''s obviously 99, duh!', 'Lolcat sayz it be ', 'Lolwut! My level be '];
'angry': Respond1 := ['What''s it matter? if you must know it''s ', 'Bah. ', ''];
end;
case Random(4) of
0..2 : TypeSend(AddMistakes(Respond1[Random(GetArrayLength(Respond1))] + IntToStr(GetSkillInfo('fishing', True)), 20));
end;
TimeMarkerNow:=0;
Marktime(TimeMarkerNow);
Responds := Responds + 1;
end;
4..5 :
begin
case lowercase(Personality) of
'laid back': Respond1 := ['Tis ', 'Yo, my craft lvl is ', '', 'My level be ', 'It be '];
'polite': Respond1 := ['Thanks for asking, my crafting level is ', 'It is ', ''];
'bored': Respond1 := ['Lolz, it''s ', 'dood! My crafting level is ', '', 'Aren''t you smart? It''s obviously 99, duh!', 'Lolcat sayz it be ', 'Lolwut! My level be '];
'angry': Respond1 := ['Whats it to you? if you must know its ', 'Bah. ', ''];
end;
case Random(4) of
0..2 : TypeSend(AddMistakes(Respond1[Random(GetArrayLength(Respond1))] + IntToStr(GetSkillInfo('crafting', True)), 20));
end;
TimeMarkerNow:=0;
Marktime(TimeMarkerNow);
Responds := Responds + 1;
end;
6..9 :
begin
case lowercase(Personality) of
'laid back': Respond1 := ['Yo!', 'Sup?', 'Sup man?', 'Sup dawg', 'Yo dawg', 'What''s happenin?', 'Hola'];
'polite': Respond1 := ['Hello.', 'Good day to you.', 'It''s nice to see you!', 'G''day mate', 'How are you doing today?'];
'bored': Respond1 := ['Ohaider!', 'Hi.', 'Y0z!', 'Lolwut it''s you!', 'Koneecheewah', 'h3110', 'H to the E to the L to the L to the O', 'Well then, H to the I'];
'angry': Respond1 := ['What?', 'Wha''dyawant', 'Leave me alone!', 'Go away!', 'Hi noob', 'Was I talking to you?', 'Stupid noob, leave me alone!'];
end;
case Random(4) of
0..2 : TypeSend(AddMistakes(Respond1[Random(GetArrayLength(Respond1))], 20));
end;
TimeMarkerNow:=0;
Marktime(TimeMarkerNow);
Responds := Responds + 1;
end;
10..13 :
begin
case lowercase(Personality) of
'laid back': Respond1 := ['dood, funneh!', 'hehe', 'l0lz'];
'polite': Respond1 := ['That was funny!', 'Please tell another joke, that was very funny!', 'Heh'];
'bored': Respond1 := ['roflc0pt3rz', 'lool', 'roflzzz', 'lmao!'];
'angry': Respond1 := ['What''s so funny, punk?', 'Stop laughing, that was horrible'];
end;
case Random(4) of
0..2 : TypeSend(AddMistakes(Respond1[Random(GetArrayLength(Respond1))], 20));
end;
TimeMarkerNow:=0;
Marktime(TimeMarkerNow);
Responds := Responds + 1;
end;
14..15 :
begin
case lowercase(Personality) of
'laid back': Respond1 := ['Tis ', 'Yo, my mining lvl is ', '', 'My level be ', 'It be '];
'polite': Respond1 := ['Thanks for asking', 'It is ', ''];
'bored': Respond1 := ['Lolz, it''s ', 'dood! My mining level is ', '', 'Aren''t you smart? It''s obviously 99, duh!', 'Lolcat sayz it be ', 'Lolwut! My level be '];
'angry': Respond1 := ['Whats it matter? if you must know its ', 'Bah. ', ''];
end;
case Random(4) of
0..2 : TypeSend(AddMistakes(Respond1[Random(GetArrayLength(Respond1))] + IntToStr(GetSkillInfo('mining', True)), 20));
end;
TimeMarkerNow:=0;
Marktime(TimeMarkerNow);
Responds := Responds + 1;
end;
False: Exit;
end;
end;
end;
end;
if Responds = RespondsToChangeAt then
begin
Responds := 0;
case lowercase(Personality) of
'laid back' : Personality := LaidBackToWhat;
'polite' : Personality := PoliteToWhat;
'bored' : Personality := BoredToWhat;
'angry' : Personality := AngryToWhat;
end;
end;
end;
end;