SRL Archive - SRL Archives

ChatBase Beta (Base Setup)


pwnaz0r

2007-08-24 22:19:58

Well after working awhile, I think the base code is finally done. It contains different functions for the SRL ChatBase and is already made into a compiling script. All you have to do is set the constant (Line 30) and press go. It should compile a list of the Tree it takes and then print the conversation out. Until I get the ChatBase database finished up (with the help of Fakawi of course ;) ), this should start to be fully developed and ready to be used.

There is one problem however, do not use the LeveledChat functions (3). It will most likely give you a "Invalid Skill Number" runtime error. I am currently working on fixing this ;). Have Fun!

P.S. feel free to add conversations or request them (although if they are requested, that doesn't necessary mean I will make them. It takes along time to compile even one conversation.)


//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- » ChatBase Routines --//
//-----------------------------------------------------------------//

// » Procedure LoadChatStarters; | By Pwnaz0r
// » Procedure LoadHappyChat; | By Pwnaz0r
// » Procedure LoadExcitedChat; | By Pwnaz0r
// » Procedure LoadLeveledChat; | By Pwnaz0r
// » Procedure LoadMadChat; | By Pwnaz0r
// » Procedure LoadActivitiesChat; | By Pwnaz0r
// » Function FindIntName(Int : Integer) : String; | By Pwnaz0r
// » Function FindStatInt(SkillName : string) : integer; | By Pwnaz0r
// » Function HiScores(var Rslt : String; Player, Skill: string): Boolean; | By jhildy edited by Pwnaz0r
// » Procedure ConfigureStatMessage; | By Pwnaz0r
// » procedure ConfigureRandomTreePath( Which : integer; Display : boolean ); | By Pwnaz0r
// » Procedure DisplayChatStats( ChatPath : Chat ); | By Pwnaz0r
// » Function ConfigureChat( Which : integer; Display : boolean ) : Chat; | By Pwnaz0r
// » Function RndName : string; | By Pwnaz0r, Some Names from BuckleyInDaHouse
// » procedure SetupSRLChat; | By Pwnaz0r

// Choosing Chat Integers
// 0 = Random
// 1 = Happy
// 2 = Excited
// 3 = Leveled (Currently out of order)
// 4 = Mad
// 5 = Activities

Const ChatInt = 5;

{.include SRL/SRL.scar}


Type
Tree = record
ChatStarters : array of String;
Levels : array [0..3] of array [0..3] of array [0..3] of string;
end;

Type
Chat = record
ChatClass : integer;
ClassPath : array of Integer;
Strings : array of String;
ChatLevel : Integer;
ChatStarter : integer;
end;


var
SkillNum, I : integer;
RandomName : string;
Saying : String;
Happy : Tree;
Excited : Tree;
Leveled : Tree;
Mad : Tree;
Activities : Tree;
CurrentSkill : integer;
CurrentSkillLevel : String;
HappyChat, ExcitedChat, LeveledChat, MadChat, ActivitiesChat : Chat;


Procedure DeclarePlayers;
begin

HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :='';
Players[0].Pass :='';
end;

{*******************************************************************************
Procedure LoadChatStarters;
By : Pwnaz0r
Description: Loads Chat Starters
*******************************************************************************}

Procedure LoadChatStarters;
begin

SetArrayLength(Happy.ChatStarters,4);
SetArrayLength(Excited.ChatStarters,4);
SetArrayLength(Leveled.ChatStarters,4);
SetArrayLength(Mad.ChatStarters,4);
SetArrayLength(Activities.ChatStarters,4);

end;

{*******************************************************************************
Procedure LoadHappyChat;
By : Pwnaz0r
Description: Loads HappyChat
*******************************************************************************}

Procedure LoadHappyChat;
begin


Happy.ChatStarters[0] := 'Hey!!!';

Happy.Levels[1][0][0] := 'Yo';
Happy.Levels[1][0][1] := 'Hey!!!';
Happy.Levels[1][0][2] := 'Hey...';
Happy.Levels[1][0][3] := 'Hey';

Happy.Levels[2][0][0] := 'Whats up';
Happy.Levels[2][0][1] := 'Whats going on';
Happy.Levels[2][0][2] := 'Whats up man';
Happy.Levels[2][0][3] := 'What are you up to';

Happy.Levels[3][0][0] := 'Nm';
Happy.Levels[3][0][1] := 'nothing';
Happy.Levels[3][0][2] := 'meh, nothing';
Happy.Levels[3][0][3] := 'Nothin';

//-------------------------------------------------//

Happy.ChatStarters[1] := 'Whats up';

Happy.Levels[1][1][0] := 'Nm U?';
Happy.Levels[1][1][1] := 'Nm Hbu?';
Happy.Levels[1][1][2] := 'Nothin u?';
Happy.Levels[1][1][3] := 'Gah. Nothing important. You?';

Happy.Levels[2][1][0] := 'Nm';
Happy.Levels[2][1][1] := 'Hah I''m just chillin';
Happy.Levels[2][1][2] := 'Just Messing around';
Happy.Levels[2][1][3] := 'Just got done with practice ;)';

Happy.Levels[3][1][0] := 'O cool';
Happy.Levels[3][1][1] := 'Kewl';
Happy.Levels[3][1][2] := 'O kewl';
Happy.Levels[3][1][3] := 'O...';

//-------------------------------------------------//


Happy.ChatStarters[2] := 'Finally you are on';

Happy.Levels[1][2][0] := 'Sry had alot of homework';
Happy.Levels[1][2][1] := 'Yeah. Had practice today';
Happy.Levels[1][2][2] := '=p I been gone all day';
Happy.Levels[1][2][3] := 'Well hi to you too';

Happy.Levels[2][2][0] := 'Whatever :p What''s up';
Happy.Levels[2][2][1] := 'Anyways What''s Up';
Happy.Levels[2][2][2] := ':p What''s up';
Happy.Levels[2][2][3] := 'Whats up';

Happy.Levels[3][2][0] := 'Just tired. Didn''t get to much sleep';
Happy.Levels[3][2][1] := 'Um I''m hungry brb :p';
Happy.Levels[3][2][2] := 'Ha I''m just tired';
Happy.Levels[3][2][3] := 'The Sky ;)';

//-------------------------------------------------//

Happy.ChatStarters[3] := 'Yo';

Happy.Levels[1][3][0] := 'Hey';
Happy.Levels[1][3][1] := 'Hey!!!';
Happy.Levels[1][3][2] := 'Yo';
Happy.Levels[1][3][3] := '=p Hey';

Happy.Levels[2][3][0] := 'What be up';
Happy.Levels[2][3][1] := 'what''s crackin';
Happy.Levels[2][3][2] := 'whats up?';
Happy.Levels[2][3][3] := 'What are you doing?';

Happy.Levels[3][3][0] := 'Just tired. Didn''t get to much sleep';
Happy.Levels[3][3][1] := 'Nm Brb';
Happy.Levels[3][3][2] := 'The Sky ;)';
Happy.Levels[3][3][3] := 'Nm...';

end;

{*******************************************************************************
Procedure LoadExcitedChat;
By : Pwnaz0r
Description: Loads ExcitedChat
*******************************************************************************}

Procedure LoadExcitedChat;
begin

Excited.ChatStarters[0] := 'Dude!';

Excited.Levels[1][0][0] := '...?';
Excited.Levels[1][0][1] := 'Wtf lol';
Excited.Levels[1][0][2] := '???';
Excited.Levels[1][0][3] := 'what';

Excited.Levels[2][0][0] := 'I just remembered I have a project due today!';
Excited.Levels[2][0][1] := 'I just remembered... I own';
Excited.Levels[2][0][2] := 'Hey...';
Excited.Levels[2][0][3] := 'I''m already almost at my next lvl';

Excited.Levels[3][0][0] := 'lol';
Excited.Levels[3][0][1] := 'lol?';
Excited.Levels[3][0][2] := 'ha';
Excited.Levels[3][0][3] := 'LMAO';


//-------------------------------------------------//

Excited.ChatStarters[1] := 'Dude I think ' + RandomName + ' likes me!';

Excited.Levels[1][1][0] := 'really?';
Excited.Levels[1][1][1] := 'rly?';
Excited.Levels[1][1][2] := 'R u serious';
Excited.Levels[1][1][3] := 'No way.';

Excited.Levels[2][1][0] := 'She said she did today';
Excited.Levels[2][1][1] := 'Her friend told me she did';
Excited.Levels[2][1][2] := 'I found a note on my desk today lol';
Excited.Levels[2][1][3] := 'Dead serious';

Excited.Levels[3][1][0] := 'dang!!';
Excited.Levels[3][1][1] := 'ask her out then';
Excited.Levels[3][1][2] := 'she''s so hot';
Excited.Levels[3][1][3] := 'Sweet';

//-------------------------------------------------//

Excited.ChatStarters[2] := 'You won''t believe what just happened';

Excited.Levels[1][2][0] := 'what?';
Excited.Levels[1][2][1] := 'I bet I can :)';
Excited.Levels[1][2][2] := 'Wat';
Excited.Levels[1][2][3] := '?';

Excited.Levels[2][2][0] := 'I just realized I''m the coolest person ever!';
Excited.Levels[2][2][1] := 'I was just elected most cool';
Excited.Levels[2][2][2] := 'I was just elected better than you';
Excited.Levels[2][2][3] := 'I own u';

Excited.Levels[3][2][0] := 'No...just no';
Excited.Levels[3][2][1] := ':p';
Excited.Levels[3][2][2] := 'Um ok?';
Excited.Levels[3][2][3] := 'If you say so';

//-------------------------------------------------//

Excited.ChatStarters[3] := 'I think I did really good on today''s quiz';

Excited.Levels[1][3][0] := 'Really?';
Excited.Levels[1][3][1] := 'Rly?';
Excited.Levels[1][3][2] := 'I think I failed';
Excited.Levels[1][3][3] := 'Me too ;)';

Excited.Levels[2][3][0] := 'Seriously I knew everything';
Excited.Levels[2][3][1] := 'I knew everything on there';
Excited.Levels[2][3][2] := 'I did awesome';
Excited.Levels[2][3][3] := '';

Excited.Levels[3][3][0] := 'Cool';
Excited.Levels[3][3][1] := 'Cool...';
Excited.Levels[3][3][2] := '';
Excited.Levels[3][3][3] := '';


end;


{*******************************************************************************
function FindIntName(Int : Integer) : String;
By : Pwnaz0r
Description: Find the Name Associated with skill number (SRL Player Array)
*******************************************************************************}

function FindIntName(Int : Integer) : String;
begin

Case Int of
1 : Result := 'attack';
2 : Result := 'strength';
3 : Result := 'defence';
4 : Result := 'range';
5 : Result := 'prayer';
6 : Result := 'magic';
7 : Result := 'runecrafting';
8 : Result := 'hitpoints';
9 : Result := 'agility';
10 : Result := 'herblore';
11 : Result := 'theiving';
12 : Result := 'crafting';
13 : Result := 'fletching';
14 : Result := 'slayer';
15 : Result := 'mining';
16 : Result := 'smithing';
17 : Result := 'fishing';
18 : Result := 'cooking';
19 : Result := 'firemaking';
20 : Result := 'woodcutting';
21 : Result := 'farming';
end;

end;

{*******************************************************************************
Procedure LoadLeveledChat;
By : Pwnaz0r
Description: Loads LevelChat
*******************************************************************************}

Procedure LoadLeveledChat;
begin

Leveled.ChatStarters[0] := 'Dang I just leveled!';

Leveled.Levels[1][0][0] := 'Really sweet';
Leveled.Levels[1][0][1] := 'Awesome';
Leveled.Levels[1][0][2] := 'cool';
Leveled.Levels[1][0][3] := ':p nice';

Leveled.Levels[2][0][0] := 'Whew along way to go though';
Leveled.Levels[2][0][1] := 'Only ' + IntToStr(random(99) + 1) + ' Mill experience to go ';
Leveled.Levels[2][0][2] := 'Still Got along way to go';
Leveled.Levels[2][0][3] := 'Along way to 99 though';

Leveled.Levels[3][0][0] := 'lol';
Leveled.Levels[3][0][1] := ':p';
Leveled.Levels[3][0][2] := 'ha';
Leveled.Levels[3][0][3] := 'lmao';

//-------------------------------------------------//

CurrentSkillLevel := IntToStr(GetSkilLLevel(FindIntName(CurrentSkill)));

Leveled.ChatStarters[1] := 'w00t level ' + CurrentSkillLevel;

Leveled.Levels[1][1][0] := 'Cool';
Leveled.Levels[1][1][1] := 'Awesome';
Leveled.Levels[1][1][2] := 'Sweet';
Leveled.Levels[1][1][3] := 'Nice';

Leveled.Levels[2][1][0] := '';
Leveled.Levels[2][1][1] := '';
Leveled.Levels[2][1][2] := '';
Leveled.Levels[2][1][3] := '';

Leveled.Levels[3][1][0] := '';
Leveled.Levels[3][1][1] := '';
Leveled.Levels[3][1][2] := ':p';
Leveled.Levels[3][1][3] := '';

//-------------------------------------------------//


Leveled.ChatStarters[2] := 'Level ' + CurrentSkillLevel + ' ' + FindIntName(CurrentSkill);

Leveled.Levels[1][2][0] := 'Nice';
Leveled.Levels[1][2][1] := 'Cool';
Leveled.Levels[1][2][2] := 'Awesome';
Leveled.Levels[1][2][3] := 'hardcore ;)';

Leveled.Levels[2][2][0] := 'yeah it took awhile';
Leveled.Levels[2][2][1] := 'took days';
Leveled.Levels[2][2][2] := 'it took forever';
Leveled.Levels[2][2][3] := 'That took forever';

Leveled.Levels[3][2][0] := 'Hah';
Leveled.Levels[3][2][1] := 'Lol';
Leveled.Levels[3][2][2] := 'lmao...';
Leveled.Levels[3][2][3] := '';

//-------------------------------------------------//

Leveled.ChatStarters[3] := 'Finally level ' + CurrentSkillLevel + ' ' + FindIntName(CurrentSkill);

Leveled.Levels[1][3][0] := 'Congratz';
Leveled.Levels[1][3][1] := 'Gratz';
Leveled.Levels[1][3][2] := 'Congradulations';
Leveled.Levels[1][3][3] := 'Nice';

Leveled.Levels[2][3][0] := 'thnx';
Leveled.Levels[2][3][1] := 'ty';
Leveled.Levels[2][3][2] := 'tyvm';
Leveled.Levels[2][3][3] := '';

Leveled.Levels[3][3][0] := '';
Leveled.Levels[3][3][1] := '';
Leveled.Levels[3][3][2] := '';
Leveled.Levels[3][3][3] := '';

end;

{*******************************************************************************
Procedure LoadMadChat;
By : Pwnaz0r
Description: Loads MadChat
*******************************************************************************}

Procedure LoadMadChat;
begin

Mad.ChatStarters[0] := 'Dude Wtf, why haven''t you been on?';

Mad.Levels[1][0][0] := 'I had a class';
Mad.Levels[1][0][1] := 'I had alot of homework';
Mad.Levels[1][0][2] := 'I was on a date';
Mad.Levels[1][0][3] := 'I had to do chores';

Mad.Levels[2][0][0] := 'and thats more important than me';
Mad.Levels[2][0][1] := 'and thats more important than runescape';
Mad.Levels[2][0][2] := 'lmao';
Mad.Levels[2][0][3] := 'haha';

Mad.Levels[3][0][0] := 'uh';
Mad.Levels[3][0][1] := '';
Mad.Levels[3][0][2] := '';
Mad.Levels[3][0][3] := 'uh';

//-------------------------------------------------//

Mad.ChatStarters[1] := 'Dangit!';

Mad.Levels[1][1][0] := 'what';
Mad.Levels[1][1][1] := 'Wat';
Mad.Levels[1][1][2] := 'wats the matter';
Mad.Levels[1][1][3] := 'what happened';

Mad.Levels[2][1][0] := 'I lost alot of money';
Mad.Levels[2][1][1] := 'I just remembered we have a quiz tomorrow';
Mad.Levels[2][1][2] := 'We got a project due tomorrow';
Mad.Levels[2][1][3] := 'My mom says I can''t go to the party';

Mad.Levels[3][1][0] := '...';
Mad.Levels[3][1][1] := 'lmao!';
Mad.Levels[3][1][2] := 'lmfao';
Mad.Levels[3][1][3] := 'hahaha';

//-------------------------------------------------//


Mad.ChatStarters[2] := 'Omg';

Mad.Levels[1][2][0] := '?';
Mad.Levels[1][2][1] := 'hmm?';
Mad.Levels[1][2][2] := 'what';
Mad.Levels[1][2][3] := '';

Mad.Levels[2][2][0] := 'I hate school';
Mad.Levels[2][2][1] := 'I hate being tired';
Mad.Levels[2][2][2] := 'Homework is so dumb';
Mad.Levels[2][2][3] := 'I can''t get the answer to number ' + IntToStr(random(45) + 1);

Mad.Levels[3][2][0] := '';
Mad.Levels[3][2][1] := ' ';
Mad.Levels[3][2][2] := '...';
Mad.Levels[3][2][3] := '';

//-------------------------------------------------//

Mad.ChatStarters[3] := 'Omg!';

Mad.Levels[1][3][0] := 'what';
Mad.Levels[1][3][1] := '?';
Mad.Levels[1][3][2] := 'hmm';
Mad.Levels[1][3][3] := 'hmmm?';

Mad.Levels[2][3][0] := 'What be up';
Mad.Levels[2][3][1] := 'what''s crackin';
Mad.Levels[2][3][2] := 'whats up?';
Mad.Levels[2][3][3] := 'What are you doing?';

Mad.Levels[3][3][0] := 'um nothing';
Mad.Levels[3][3][1] := '';
Mad.Levels[3][3][2] := 'ya nothing....';
Mad.Levels[3][3][3] := 'Gah';

end;

{*******************************************************************************
Procedure LoadActivitiesChat;
By : Pwnaz0r
Description: Loads MadChat
*******************************************************************************}

Procedure LoadActivitiesChat;
var
xx, xxx : integer;
begin


Activities.ChatStarters[0] := 'Hey do you wanna go see a movie tonight?';

Activities.Levels[1][0][0] := 'Sure';
Activities.Levels[1][0][1] := 'I guess';
Activities.Levels[1][0][2] := 'I dn';
Activities.Levels[1][0][3] := 'Maybe';

XX := random(11) + 1;
XXX := random(58) + 1;

Activities.Levels[2][0][0] := 'How about ' + IntToStr(xx) + ':' + IntToStr(xxx) + '?';
Activities.Levels[2][0][1] := 'k';
Activities.Levels[2][0][2] := '';
Activities.Levels[2][0][3] := '';

Activities.Levels[3][0][0] := '';
Activities.Levels[3][0][1] := '';
Activities.Levels[3][0][2] := '';
Activities.Levels[3][0][3] := '';

//-------------------------------------------------//

Activities.ChatStarters[1] := 'Hey what was for homework?'

Activities.Levels[1][1][0] := 'I dn alot';
Activities.Levels[1][1][1] := 'a bunch';
Activities.Levels[1][1][2] := 'Page ' + IntToStr(random(600) + 1) + ', 1 - ' + IntToStr(random(50) + 2);
Activities.Levels[1][1][3] := 'I dn';

Activities.Levels[2][1][0] := 'dang';
Activities.Levels[2][1][1] := 'dangit';
Activities.Levels[2][1][2] := 'aw man';
Activities.Levels[2][1][3] := '...';

Activities.Levels[3][1][0] := ':p';
Activities.Levels[3][1][1] := 'lol';
Activities.Levels[3][1][2] := '';
Activities.Levels[3][1][3] := '';

//-------------------------------------------------//


Activities.ChatStarters[2] := 'I think ' + RandomName + ' likes me lol';

Activities.Levels[1][2][0] := 'You kidding right?';
Activities.Levels[1][2][1] := 'Really? Why';
Activities.Levels[1][2][2] := 'awesome! Why';
Activities.Levels[1][2][3] := 'Sweet y?';

Activities.Levels[2][2][0] := 'She told me';
Activities.Levels[2][2][1] := 'Her friend told me';
Activities.Levels[2][2][2] := 'I just think she does';
Activities.Levels[2][2][3] := 'i dn I just do';

Activities.Levels[3][2][0] := 'o ok';
Activities.Levels[3][2][1] := 'o';
Activities.Levels[3][2][2] := 'cool';
Activities.Levels[3][2][3] := '';

//-------------------------------------------------//

Activities.ChatStarters[3] := 'Dang i''m so bored. nothing to do';

Activities.Levels[1][3][0] := 'me 2';
Activities.Levels[1][3][1] := ':p';
Activities.Levels[1][3][2] := '=p';
Activities.Levels[1][3][3] := 'lol';

Activities.Levels[2][3][0] := '';
Activities.Levels[2][3][1] := '';
Activities.Levels[2][3][2] := '';
Activities.Levels[2][3][3] := '';

Activities.Levels[3][3][0] := '';
Activities.Levels[3][3][1] := '';
Activities.Levels[3][3][2] := '';
Activities.Levels[3][3][3] := '';

end;

{*******************************************************************************
function FindStatInt(SkillName : string) : integer;
By : Pwnaz0r
Description: Finds the integer of a stat name (SRL Player Array)
*******************************************************************************}

function FindStatInt(SkillName : string) : integer;
begin

Result := 0;

Case LowerCase(SkillName) of
'attack' : Result := 1;
'strength' : Result := 2;
'defence' : Result := 3;
'range' : Result := 4;
'prayer' : Result := 5;
'magic' : Result := 6;
'runecrafting' : Result := 7;
'hitpoints' : Result := 8;
'agility' : Result := 9;
'herblore' : Result := 10;
'theiving' : Result := 11;
'crafting' : Result := 12;
'fletching' : Result := 13;
'slayer' : Result := 14;
'mining' : Result := 15;
'smithing' : Result := 16;
'fishing' : Result := 17;
'cooking' : Result := 18;
'firemaking' : Result := 19;
'woodcutting' : Result := 20;
'farming' : Result := 21;
end;

end;

{*******************************************************************************
Function HiScores(var Rslt : String; Player, Skill: string): Boolean;
By : jhildy edited by Pwnaz0r for efficiency
Description: Checks Hiscores for stats
*******************************************************************************}

Function HiScores(var Rslt : String; Player, Skill: string): Boolean;
var
s, ss : String;
begin
s := Getpage('Http://hiscore.runescape.com/hiscorepersonal.ws?user1='+Player);
case Lowercase(skill) of
'attack':s:=between('Attack','Defence',s);
'defence':s:=between('Defence','Strength',s);
'strength':s:=between('Strength','Hitpoints',s);
'hitpoints':s:=between('Hitpoints','Ranged',s);
'ranged','range': s:=between('Ranged','Prayer',s);
'prayer':s:=between('Prayer','Magic',s);
'magic':s:=between('Magic','Cooking',s);
'cooking':s:=between('Cooking','Woodcutting',s);
'woodcutting':s:=between('Woodcutting','Fletching',s);
'fletching':s:=between('Fletching','Fishing',s);
'fishing':s:=between('Fishing','Firemaking',s);
'firemaking':s:=between('Firemaking','Crafting',s);
'crafting':s:=between('Crafting','Smithing',s);
'smithing':s:=between('Smithing','Mining',s);
'mining':s:=between('Mining','Herblore',s);
'herblore':s:=between('Herblore','Agility',s);
'agility':s:=between('Agility','Thieving',s);
'thieving':s:=between('Thieving','Slayer',s);
'slayer':s:=between('Slayer','Farming',s);
'farming':s:=between('Farming','Runecraft',s);
'runecraft':s:=between('Runecraft','Hunter',s);
'hunter':s:=between('Hunter','Construction',s);
'construction':s:=between('Construction','footer',s);
end;
case (Pos('Not Ranked',s)=0) of
true: begin
delete(s,1,52);
ss:=Getnumbers(s);
delete(ss,3,50);
result := True;
Rslt := ss;
end;
false: begin
result := False;
Rslt := 'Not ranked';
end;
end;
end;

{*******************************************************************************
Procedure ConfigureStatMessage;
By : Pwnaz0r
Description: Configures a Stat Message
*******************************************************************************}

Procedure ConfigureStatMessage;
begin

If HiScores(CurrentSkillLevel, Players[CurrentPlayer].Name, FindIntName(CurrentSkill)) then
begin
end else
begin
CurrentSkillLevel := IntToStr(GetSkillLevel(FindIntName(CurrentSkill)));
end;

If ((FindStatInt(CurrentSkillLevel)) <= 0) then
begin
RaiseException(erCustomError, 'Invalid Skill Name');
end;
end;

{*******************************************************************************
procedure ConfigureRandomTreePath( Which : integer; Display : boolean );
By : Pwnaz0r
Description: Creates a random tree path
*******************************************************************************}

procedure ConfigureRandomTreePath( Which : integer; Display : boolean );
var
I : integer;
RsltArray : array [0..3] of integer;
tmpInt, tmpInt2, tmpInt3, tmpInt4 : integer;
begin

For I := 0 to 3 do // Levels
begin

Case I of
0 :
begin
RsltArray[0] := Random(4);
tmpInt := RsltArray[0];
If Display then Writeln('Path Lane[0] = ' + IntToStr(tmpInt));
end;
1 :
begin
RsltArray[1] := Random(4);
tmpInt2 := RsltArray[1];
If Display then Writeln('Path Lane[1] = ' + IntToStr(tmpInt2));
end;
2 :
begin
RsltArray[2] := Random(4);
tmpInt3 := RsltArray[2];
If Display then Writeln('Path Lane[2] = ' + IntToStr(tmpInt3));
end;
3 :
begin
RsltArray[3] := Random(4);
tmpInt4 := RsltArray[3];
If Display then Writeln('Path Lane[3] = ' + IntToStr(tmpInt4));
end;
end;
end;

case Which of
1 :
begin
HappyChat.ChatClass := RsltArray[0];
HappyChat.ChatStarter := RsltArray[0];
SetArrayLength(HappyChat.ClassPath,4)
For I := 0 to 3 do
HappyChat.ClassPath[i] := RsltArray[i];
end;
2 :
begin
ExcitedChat.ChatClass := RsltArray[0];
ExcitedChat.ChatStarter := RsltArray[0];
SetArrayLength(ExcitedChat.ClassPath,4)
For I := 0 to 3 do
ExcitedChat.ClassPath[i] := RsltArray[i];
end;
3 :
begin
LeveledChat.ChatClass := RsltArray[0];
LeveledChat.ChatStarter := RsltArray[0];
SetArrayLength(LeveledChat.ClassPath,4)
For I := 0 to 3 do
LeveledChat.ClassPath[i] := RsltArray[i];
end;
4 :
begin
MadChat.ChatClass := RsltArray[0];
MadChat.ChatStarter := RsltArray[0];
SetArrayLength(MadChat.ClassPath,4)
For I := 0 to 3 do
MadChat.ClassPath[i] := RsltArray[i];
end;
5 :
begin
ActivitiesChat.ChatClass := RsltArray[0];
ActivitiesChat.ChatStarter := RsltArray[0];
SetArrayLength(ActivitiesChat.ClassPath,4)
For I := 0 to 3 do
ActivitiesChat.ClassPath[i] := RsltArray[i];
end;
end;
end;

{*******************************************************************************
Procedure DisplayChatStats( ChatPath : Chat );
By : Pwnaz0r
Description: Used to display ChatStats
*******************************************************************************}

Procedure DisplayChatStats( ChatPath : Chat );
begin
end;

{*******************************************************************************
Function ConfigureChat( Which : integer; Display : boolean ) : Chat;
By : Pwnaz0r
Description: Used to configure a conversation
*******************************************************************************}

Function ConfigureChat( Which : integer; Display : boolean ) : Chat;
// 0 : Random
// 1 : Happy
// 2 : Excited
// 3 : Leveled
// 4 : Mad
// 5 : Activities
var
tmpInt, tmpInt2, tmpInt3 : Integer;
begin

HappyChat.ChatLevel := 1;
ExcitedChat.ChatLevel := 1;
LeveledChat.ChatLevel := 1;
MadChat.ChatLevel := 1;
ActivitiesChat.ChatLevel := 1;

If (Which > 5) or (Which < 0) then RaiseException(erCustomError, 'Bad Chat Name');

If Which = 0 then
begin
Which := RandomRange(1,5);
end;

LoadChatStarters;

Case Which of
1 :
begin
LoadHappyChat;
ConfigureRandomTreePath(1,False);
If Display then
begin
ClearDebug;
Writeln('[----------------------------------------]');
Writeln('[ Happy ]');
Writeln('[----------------------------------------]');
Writeln(' Chat Starter : ' + IntToStr(HappyChat.ChatStarter));
Writeln(' Chat Class : ' + IntToStr(HappyChat.ChatClass));
Writeln(' Class Path [Level 1] : ' + IntToStr(HappyChat.ClassPath[1]));
Writeln(' Class Path [Level 2] : ' + IntToStr(HappyChat.ClassPath[2]));
Writeln(' Class Path [Level 3] : ' + IntToStr(HappyChat.ClassPath[3]));
Writeln('[----------------------------------------]');
Writeln(' ');
for I := 0 to 5 do
begin
Case I of
0 :
begin
tmpInt := HappyChat.ChatStarter;
Writeln('CS : ' + Happy.ChatStarters[tmpInt]);
end;
1,2,3 :
begin
tmpInt := HappyChat.ClassPath[i];
tmpInt2 := HappyChat.ChatClass;
tmpInt3 := HappyChat.ChatLevel;
Writeln('CP[' + IntToStr(I) + '] : ' + Happy.Levels[(tmpInt3)][(tmpInt2)][(tmpInt)]);
HappyChat.ChatLevel := HappyChat.ChatLevel + 1;
end;
end;
end;
end;
end;
2 :
begin
LoadExcitedChat;
ConfigureRandomTreePath(2,False);
If Display then
begin
ClearDebug;
Writeln('[----------------------------------------]');
Writeln('[ Excited ]');
Writeln('[----------------------------------------]');
Writeln(' Chat Starter : ' + IntToStr(ExcitedChat.ChatStarter));
Writeln(' Chat Class : ' + IntToStr(ExcitedChat.ChatClass));
Writeln(' Class Path [Level 1] : ' + IntToStr(ExcitedChat.ClassPath[1]));
Writeln(' Class Path [Level 2] : ' + IntToStr(ExcitedChat.ClassPath[2]));
Writeln(' Class Path [Level 3] : ' + IntToStr(ExcitedChat.ClassPath[3]));
Writeln('[----------------------------------------]');
Writeln(' ');
for I := 0 to 5 do
begin
Case I of
0 :
begin
tmpInt := ExcitedChat.ChatStarter;
Writeln('CS : ' + Excited.ChatStarters[tmpInt]);
end;
1,2,3 :
begin
tmpInt := ExcitedChat.ClassPath[i];
tmpInt2 := ExcitedChat.ChatClass;
tmpInt3 := ExcitedChat.ChatLevel;
Writeln('CP[' + IntToStr(I) + '] : ' + Excited.Levels[(tmpInt3)][(tmpInt2)][(tmpInt)]);
ExcitedChat.ChatLevel := ExcitedChat.ChatLevel + 1;
end;
end;
end;
end;
end;
3 :
begin
LoadLeveledChat;
ConfigureStatMessage;
ConfigureRandomTreePath(3,False);
If Display then
begin
ClearDebug;
Writeln('[----------------------------------------]');
Writeln('[ Leveled ]');
Writeln('[----------------------------------------]');
Writeln(' Chat Starter : ' + IntToStr(LeveledChat.ChatStarter));
Writeln(' Chat Class : ' + IntToStr(LeveledChat.ChatClass));
Writeln(' Class Path [Level 1] : ' + IntToStr(LeveledChat.ClassPath[1]));
Writeln(' Class Path [Level 2] : ' + IntToStr(LeveledChat.ClassPath[2]));
Writeln(' Class Path [Level 3] : ' + IntToStr(LeveledChat.ClassPath[3]));
Writeln('[----------------------------------------]');
Writeln(' ');
for I := 0 to 5 do
begin
Case I of
0 :
begin
tmpInt := LeveledChat.ChatStarter;
Writeln('CS : ' + Leveled.ChatStarters[tmpInt]);
end;
1,2,3 :
begin
tmpInt := LeveledChat.ClassPath[i];
tmpInt2 := LeveledChat.ChatClass;
tmpInt3 := LeveledChat.ChatLevel;
Writeln('CP[' + IntToStr(I) + '] : ' + Leveled.Levels[(tmpInt3)][(tmpInt2)][(tmpInt)]);
ExcitedChat.ChatLevel := ExcitedChat.ChatLevel + 1;
end;
end;
end;
end;
end;
4 :
begin
LoadMadChat;
ConfigureRandomTreePath(4,False);
If Display then
begin
ClearDebug;
Writeln('[----------------------------------------]');
Writeln('[ Mad ]');
Writeln('[----------------------------------------]');
Writeln(' Chat Starter : ' + IntToStr(MadChat.ChatStarter));
Writeln(' Chat Class : ' + IntToStr(MadChat.ChatClass));
Writeln(' Class Path [Level 1] : ' + IntToStr(MadChat.ClassPath[1]));
Writeln(' Class Path [Level 2] : ' + IntToStr(MadChat.ClassPath[2]));
Writeln(' Class Path [Level 3] : ' + IntToStr(MadChat.ClassPath[3]));
Writeln('[----------------------------------------]');
Writeln(' ');
for I := 0 to 5 do
begin
Case I of
0 :
begin
tmpInt := MadChat.ChatStarter;
Writeln('CS : ' + Mad.ChatStarters[tmpInt]);
end;
1,2,3 :
begin
tmpInt := MadChat.ClassPath[i];
tmpInt2 := MadChat.ChatClass;
tmpInt3 := MadChat.ChatLevel;
Writeln('CP[' + IntToStr(I) + '] : ' + Mad.Levels[(tmpInt3)][(tmpInt2)][(tmpInt)]);
MadChat.ChatLevel := MadChat.ChatLevel + 1;
end;
end;
end;
end;
end;
5 :
begin
LoadActivitiesChat;
ConfigureRandomTreePath(5,False);
If Display then
begin
ClearDebug;
Writeln('[----------------------------------------]');
Writeln('[ Activities ]');
Writeln('[----------------------------------------]');
Writeln(' Chat Starter : ' + IntToStr(ActivitiesChat.ChatStarter));
Writeln(' Chat Class : ' + IntToStr(ActivitiesChat.ChatClass));
Writeln(' Class Path [Level 1] : ' + IntToStr(ActivitiesChat.ClassPath[1]));
Writeln(' Class Path [Level 2] : ' + IntToStr(ActivitiesChat.ClassPath[2]));
Writeln(' Class Path [Level 3] : ' + IntToStr(ActivitiesChat.ClassPath[3]));
Writeln('[----------------------------------------]');
Writeln(' ');
for I := 0 to 5 do
begin
Case I of
0 :
begin
tmpInt := ActivitiesChat.ChatStarter;
Writeln('CS : ' + Activities.ChatStarters[tmpInt]);
end;
1,2,3 :
begin
tmpInt := ActivitiesChat.ClassPath[i];
tmpInt2 := ActivitiesChat.ChatClass;
tmpInt3 := ActivitiesChat.ChatLevel;
Writeln('CP[' + IntToStr(I) + '] : ' + Activities.Levels[(tmpInt3)][(tmpInt2)][(tmpInt)]);
ActivitiesChat.ChatLevel := ActivitiesChat.ChatLevel + 1;
end;
end;
end;
end;
end;
end;
end;

{*******************************************************************************
function RndName : string;
By : Pwnaz0r, some names by BuckleyInDaHouse
Description: Returns a random female name
*******************************************************************************}

function RndName : string;
var
tmpInt : integer;
begin

tmpInt := randomrange(1,32);

Case tmpInt Of
0 : result := 'Caroline';
1 : result := 'Ally';
2 : result := 'Alli';
3 : result := 'Ashley';
4 : result := 'Cristina';
5 : result := 'Natalie';
6 : result := 'Bethany';
7 : result := 'Jenna';
8 : result := 'Genna';
9 : result := 'Mary';
10 : result := 'Claire';
11 : result := 'Anna';
12 : result := 'Alana';
13 : result := 'Cristi';
14 : result := 'Sarah';
15 : result := 'Kaylee';
16 : result := 'Faith';
17 : result := 'Amand';
18 : result := 'Jessica';
19 : result := 'Hannah';
20 : result := 'Emma';
21 : result := 'Emily';
22 : result := 'Alexis';
23 : result := 'Olivia';
24 : result := 'Elizabeth';
25 : result := 'Sarah';
26 : result := 'Samantha';
27 : result := 'Brianna';
28 : result := 'Taylor';
29 : result := 'Chloe';
30 : result := 'Sophia';
31 : result := 'Michelle';
32 : result := 'Kimberly';
end;

end;

{*******************************************************************************
procedure SetupSRLChat;
By : Pwnaz0r
Description: Sets up the SRL ChatBase functions.
*******************************************************************************}

procedure SetupSRLChat;
begin

SkillNum := 1;
CurrentSkillLevel := '0';
Saying := ' ';
CurrentSkillLevel := '';
CurrentSkill := 1;
RandomName := 'Ashley';
RandomName := RndName;
MouseSpeed := 15; //To prevent from Divide by zero errors.
LoadChatStarters;
GetAllLevels;

end;

begin
DeclarePlayers;
SetupSRLChat;
ConfigureChat(ChatInt,true);
end.

Santa_Clause

2007-08-24 22:29:56

Ooo how 1337!

pwnaz0r

2007-08-24 22:32:23

Hah. It's not completely finished as far as chat goes. It only has 4 responses to each 4 ChatStarters but it gets the job done. All the phrases match pretty well and it is random enough ;). I wanted to post this not because its finished, but to show SRL how I was planning it to be, and get their ideas and thoughts.

Santa_Clause

2007-08-24 22:36:03

I see. The array of array of array of strings is just confusing…:p

pwnaz0r

2007-08-24 22:38:28

From: SantaClause
I see. The array of array of array of strings is just confusing…:p


You should have seen it before I cleaned it up ;)

Santa_Clause

2007-08-24 22:47:49

I'd rather not…:p

Tim0suprem0

2007-08-24 22:54:14

Dude I think Kimberley likes me!

pwnaz0r

2007-08-24 23:59:34

Hah I think so too ;)

Santa_Clause

2007-08-25 00:07:45

Lmao!!

Stand back!

pwnaz0r

2007-08-25 01:04:19

:p ok but seriously, do either of you have any ideas for me?

Santa_Clause

2007-08-25 01:15:53

Perhaps, to apply for Dev?

pwnaz0r

2007-08-25 01:18:09

From: SantaClause
Perhaps, to apply for Dev?

:p. Um I meant about the ChatBase

Santa_Clause

2007-08-25 01:31:31

Perhaps, something that stores the username of the person you talked to…so you don't start responding to yourself?

pwnaz0r

2007-08-25 01:34:15

From: SantaClause
Perhaps, something that stores the username of the person you talked to…so you don't start responding to yourself?


Hah that will come in good time. Once the database is made. It will not talk to itself because ChatStarter and CP[3] will be assigned to the main bot and CP[1] and CP[3] will be assigned to the secondary bot.

jhildy

2007-08-25 16:34:10

are you still going to need php for this. I can't help but im just curious. Also if you need something scar related ill be happy to help in any way possible. this idea seems like it will work extremely well.

pwnaz0r

2007-08-25 16:38:21

Yeah i personally am not using just using php, i'm using SQL but fakawi may be using PHP for the stats site thing o.O?

Pancakes

2007-08-26 03:56:41

Forgive my ignorance, but what exactly does this do?

Looks complicated, to say the least :p

Hugolord

2007-08-26 04:37:43

From: Pancakes
Forgive my ignorance, but what exactly does this do?

Looks complicated, to say the least :p


it says a definition inside if you read it ;)

Santa_Clause

2007-08-26 05:34:58

Also, why do you only have girls names?

n3ss3s

2007-08-26 12:59:23

Perhaps, to apply for Dev?

Haha.

The hardest part propably is when creating, to remember what dimensions what slot is the correct one for something lol :D

EDIT: When I look at it I can imagine it in the SRL > SRL > Core > AutoRespond which is currently empty?

pwnaz0r

2007-08-26 14:24:54

From: SantaClause
Also, why do you only have girls names?


Because I always put "she" said she likes me. It didn't seem worth the trouble to add guys names because it is more likely the runescape character is a guy.

jhildy

2007-08-26 15:50:00

when this is completely done i think it would work a lot better as a plugin.

pwnaz0r

2007-08-26 17:56:27

Probably ;)

WT-Fakawi

2007-08-26 18:33:49

From: pwnaz0r
Yeah i personally am not using just using php, i'm using SQL but fakawi may be using PHP for the stats site thing o.O?


The original idea was to have SCAR send and recieve SQL-queries via php. The SQL database (ChatBase) contains full convos, all you need to do is "hook" onto a convo and synchronise Private Chat with another bot. The synchronisation is all handled by the server, and all SCAR recieves are strings of text.

We skipped the project since is was difficult to maintain synchronisation when multiple requests recieved at servers door. I gave pwnaz0r the original ChatBase sql-database and he has made this wonderful looking apparatus.

I think all you need to do to make your thing work pwnaz0r, is give the opposite party a signal for a convo (a letter of the alphabet perhaps?, and convo "more or less synchronised". Note that a system like this can overtake your script and can thus mess up timing, so make it short. The sequence would be:

RC <- checks for logging in of friends and is part of findnormalrandoms

  • A friend logs in (RC)
  • Goto friendslist
  • Send first private msg (Letter of alphabet)
  • Start convo
  • Set time out and inc(Chat) and return to script.

You could still get the text from a server, or central stored textfiles, or even live from a irc-channel, lots of possibilities here :)

But did you have in mind pwnaz0r to further develop this?

Great looking code, btw :)

jhildy

2007-08-26 19:18:18

It seems like a great idea if it was to be completed… unless jagex found out about it in which they would have a new way to link players together and ban them.

pwnaz0r

2007-08-26 20:36:00

From: WT-Fakawi
The original idea was to have SCAR send and recieve SQL-queries via php. The SQL database (ChatBase) contains full convos, all you need to do is "hook" onto a convo and synchronise Private Chat with another bot. The synchronisation is all handled by the server, and all SCAR recieves are strings of text.

We skipped the project since is was difficult to maintain synchronisation when multiple requests recieved at servers door. I gave pwnaz0r the original ChatBase sql-database and he has made this wonderful looking apparatus.

I think all you need to do to make your thing work pwnaz0r, is give the opposite party a signal for a convo (a letter of the alphabet perhaps?, and convo "more or less synchronised". Note that a system like this can overtake your script and can thus mess up timing, so make it short. The sequence would be:

RC <- checks for logging in of friends and is part of findnormalrandoms
  • A friend logs in (RC)
  • Goto friendslist
  • Send first private msg (Letter of alphabet)
  • Start convo
  • Set time out and inc(Chat) and return to script.
You could still get the text from a server, or central stored textfiles, or even live from a irc-channel, lots of possibilities here :)

But did you have in mind pwnaz0r to further develop this?

Great looking code, btw :)

Thnx and Ok. Right now i'm sick. Anyways once I feel a little better( prolly a few days from now ) I'll start back at designing it. Um as far as what I had in mind, basically I thought it would just be posting the Class, The ClassPaths, and the Username. The secondary SCAR bot would then read the variables and chart out the conversation exactly like the first one, and wait until the ChatStarter had been said. I like the idea of IRC though. its creative.

From: jhildy
It seems like a great idea if it was to be completed… unless jagex found out about it in which they would have a new way to link players together and ban them.


It will be completed ;). and Jagex wouldn't find out because they are two remote usernames commicating.