pwnaz0r
2007-08-21 23:14:51
Tree Variable Type
First I Should Explain
Any is the ChatTree.
Levels is the Levels (AKA not Chatstarter).
[1] is the Level (Levels 1 - 4).
[2] is the Class Number. Class is the Conversation being followed. All the conversations coincide with their class numbers.
[3] Is the random chat phrase. Every Level has 16 (atm) random chat phrases and they are split into the four different conversation classes.
This is the general layout. I am trying to get it out there and functional and then, people will be able to create their own ChatTrees for different scripts and alot more will be added.
My Idea.
It is basically a "family tree" of each conversation type. It will originally have 5 types of conversations(happy, mad, excited, leveled, and activities). There will be an array of 4 "Conversation Starters". They will be the "top" of the trees. They will then have around 4-6 responses each. There will be then be 4 responses for this layer,etc ,etc until the conversation is though to be long enough. They will hen be formatted to lock the conversations and pick the various responses.
How The System will work.
Finding a working system for this will not be easy. However, this is my idea. Since SCAR cannot (as far as I know) break out of any task at the moment it recieves a query, it will be of course included in the script. This will prove to be useful to us as the scripts will not respond to each other at the exact second they recieve the message, which is more human-like. If a conversation is wished to be started, the SCAR will "post a query" on a database. It will then be accepted by the first available bot that is free (bots will search the query list until a conversation is requested with a bot or the user specifies to start a conversation.) Therefore, there will be many bots answering queries as well as Posting them. From there, it will just be adding "Players[CurrentPlayer].Name", and the SCAR will go through the tree of conversations until it finally reaches an endpoint.
Problems :
If the chat moves to fast or the procedure is not called enough, SCAR may not find the pm. Therefore we will have to set a timeout.
I do not have the time except on the weekends to format this (or I may not have posted until now). Anyway, I need you, the SRL members to help me on this, submit ideas, and add conversations.
I could possibly make the database but I am not the best at PHP, MySQL, HTTP or any other type of internet based scripting so I will want and need some1 who can script much more effectively than I to make that database while myself and other scripters work on the SRL section.
Adding Conversations :
Class Of Conversation(Happy,Sad) :
ConversationStarters :
Response level 1 :
Etc, Etc
Type
Tree = record
ChatStarters : array of String;
Levels : array [0..3] of array [0..3] of array [0..15] of string;
end;
Type
Chat = record
ChatClass : integer;
ClassPath : array of Integer;
Strings : array of String;
ChatLevel : Integer;
ChatStarter : integer;
end;
First I Should Explain
Any.Levels[1][2][3]
Any is the ChatTree.
Levels is the Levels (AKA not Chatstarter).
[1] is the Level (Levels 1 - 4).
[2] is the Class Number. Class is the Conversation being followed. All the conversations coincide with their class numbers.
[3] Is the random chat phrase. Every Level has 16 (atm) random chat phrases and they are split into the four different conversation classes.
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- ยป ChatBase Routines --//
//-----------------------------------------------------------------//
{.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
SaySkill : string;
SkillNum, I : integer;
RandomName : string;
Saying : String;
Happy : Tree;
Excited : Tree;
Leveled : Tree;
Mad : Tree;
Activities : Tree;
CurrentSkillLevel : String;
TestTP : array of integer;
rndDots : integer;
HappyChat : Chat;
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
end;
Procedure LoadChatStarters;
begin
SetArrayLength(Happy.ChatStarters,4);
SetArrayLength(Excited.ChatStarters,4);
SetArrayLength(Leveled.ChatStarters,4);
SetArrayLength(Mad.ChatStarters,4);
SetArrayLength(Activities.ChatStarters,4);
Happy.ChatStarters[0] := 'Hey!!!';
Happy.ChatStarters[1] := 'Whats up';
Happy.ChatStarters[2] := 'Finally you are on';
Happy.ChatStarters[3] := 'Yo';
Excited.ChatStarters[0] := 'Dude!';
Excited.ChatStarters[1] := 'WTF!';
Excited.ChatStarters[2] := 'You won''t believe what just happened';
Excited.ChatStarters[3] := 'Whoa!'
Leveled.ChatStarters[0] := 'Dang I just leveled!'
Leveled.ChatStarters[1] := 'w00t level ' + CurrentSkillLevel;
Leveled.ChatStarters[2] := 'Level ' + CurrentSkillLevel + ' ' + SaySkill;
Leveled.ChatStarters[3] := 'Finally level ' + CurrentSkillLevel + ' ' + SaySkill;
Mad.ChatStarters[0] := 'Dude Wtf, why haven''t you been on?'
Mad.ChatStarters[1] := 'Dangit!';
Mad.ChatStarters[2] := 'Omg';
Mad.ChatStarters[3] := 'Wow are you kidding me';
Activities.ChatStarters[0] := 'Hey do you wanna go see a movie tonight?';
Activities.ChatStarters[1] := 'Hey what was for homework?'
Activities.ChatStarters[2] := 'I think ' + RandomName + ' likes me lol';
Activities.ChatStarters[3] := 'Dang i''m so bored. nothing to do';
end;
Procedure LoadHappyChat;
var
tmpInt, tmpInt2 : integer;
begin
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[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[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[1][3][0] := 'Hey';
Happy.Levels[1][3][1] := 'Hey!!!';
Happy.Levels[1][3][2] := 'Yo';
Happy.Levels[1][3][3] := '=p Hey';
// [1]
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[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[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[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?';
// [2]
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.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.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.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...';
// [3]
end;
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 := Random(3);
HappyChat.ChatStarter := RsltArray[0];
SetArrayLength(HappyChat.ClassPath,4)
For I := 0 to 3 do
HappyChat.ClassPath[I] := RsltArray[I];
end;
end;
end;
Function ConfigureChat( Which : integer; Display : boolean ) : Chat;
// 0 : Random
// 1 : Happy
// 2 :
// 3 :
// 4 :
// 5 :
var
tmpInt, tmpInt2, tmpInt3 : Integer;
tmpStr : string;
begin
HappyChat.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(' 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('[---------------------------------------]');
For I := 0 to GetDebugLineCount do
begin
end;
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;
end;
end;
procedure SetupSRLChat;
begin
SkillNum := 1;
CurrentSkillLevel := '0';
Saying := ' ';
SaySkill := ' ';
RandomName := 'Ashley';
MouseSpeed := 15; //To prevent from Divide by zero errors.
LoadChatStarters;
GetAllLevels;
end;
begin
DeclarePlayers;
SetupSRLChat;
ConfigureChat(1,true);
end.
This is the general layout. I am trying to get it out there and functional and then, people will be able to create their own ChatTrees for different scripts and alot more will be added.
My Idea.
It is basically a "family tree" of each conversation type. It will originally have 5 types of conversations(happy, mad, excited, leveled, and activities). There will be an array of 4 "Conversation Starters". They will be the "top" of the trees. They will then have around 4-6 responses each. There will be then be 4 responses for this layer,etc ,etc until the conversation is though to be long enough. They will hen be formatted to lock the conversations and pick the various responses.
How The System will work.
Finding a working system for this will not be easy. However, this is my idea. Since SCAR cannot (as far as I know) break out of any task at the moment it recieves a query, it will be of course included in the script. This will prove to be useful to us as the scripts will not respond to each other at the exact second they recieve the message, which is more human-like. If a conversation is wished to be started, the SCAR will "post a query" on a database. It will then be accepted by the first available bot that is free (bots will search the query list until a conversation is requested with a bot or the user specifies to start a conversation.) Therefore, there will be many bots answering queries as well as Posting them. From there, it will just be adding "Players[CurrentPlayer].Name", and the SCAR will go through the tree of conversations until it finally reaches an endpoint.
Problems :
If the chat moves to fast or the procedure is not called enough, SCAR may not find the pm. Therefore we will have to set a timeout.
I do not have the time except on the weekends to format this (or I may not have posted until now). Anyway, I need you, the SRL members to help me on this, submit ideas, and add conversations.
I could possibly make the database but I am not the best at PHP, MySQL, HTTP or any other type of internet based scripting so I will want and need some1 who can script much more effectively than I to make that database while myself and other scripters work on the SRL section.
Adding Conversations :
Class Of Conversation(Happy,Sad) :
ConversationStarters :
Response level 1 :
Etc, Etc