PDA

View Full Version : AutoTalker Learning Script.



turbobk
02-19-2008, 03:27 AM
TBKAutoTalker

This is a learning script for anyone who wants to learn how to make an autotalker.

It doesn't go through step by step of how to make one, but it is pretty basic with failsafe's and correct standard's so anyone who already know's a little bit about SCAR but not that much will most likely learn a bit off of this script.

This can only be posted on http://www.srl-forums.com

This is the sample so you don't have to download it.
However if you would like to download it, the Script is attached at the bottom.
program TBKSimpleTalker; //Made By: Turbobk.

{.include SRL/SRL.scar}

{ THIS SCRIPT WAS MADE AS A LEARNING INSTRUMENT
FOR ALL THE PEOPLE TRYING TO LEARN HOW TO
SCAR SCRIPT / MAKE AUTOTALKERS ON SRL FORUMS.

THIS SCRIPT CAN ONLY BE POSTED ON
http://www.srl-forums.com

FEEL FREE TO USE PARTS FROM THIS SCRIPT AS
YOU WISH. JUST DONT TAKE THEM AS SAY THERE YOURS. =P

HOPE YOU LEARN SOMETHING FROM THIS.
HAVE FUN!! =) }

var
CheckCount : Integer;

const
UseColors = False; // Use's a specifically set color. True / False
Color = ''; // Color to use.
// Type in the COLOR! NOT the number!
// OPTIONS ARE:
// ----------------
// 1. 'flash1' .
// 2. 'flash2' .
// 3. 'flash3' .
// 4. 'glow1' .
// 5. 'glow2' .
// 6. 'glow3' .
// 7. 'cyan' .
// 8. 'green' .
// 9. 'purple' .
// 10. 'red' .
// 11. 'white' .
//-----------------

TalkWait = 6000; // Time to wait between talking (In MS).
// Add's a random of 1 second to it.
// Set to '0' for NO wait time.

UseText1 = False; // Send (Text1)? True / False
Text1 = ''; // Type what to say inbetween the ''s.

UseText2 = False; // Send (Text2)? True / False
Text2 = ''; // Type what to say inbetween the ''s.

UseText3 = False; // Send (Text3)? True / False
Text3 = ''; // Type what to say inbetween the ''s.

UseText4 = False; // Send (Text4)? True / False
Text4 = ''; // Type what to say inbetween the ''s.

UseText5 = False; // Send (Text5)? True / False
Text5 = ''; // Type what to say inbetween the ''s.

//************************************************** **************************\\
// SCRIPT BELOW ||
//************************************************** **************************//

//----------------------------------------------------------------------------\\
// CHECKS THAT ALL TEXT LINES ARE NOT SET TO FALSE ||
//----------------------------------------------------------------------------//

procedure CheckFalse;
begin
CheckCount := 0;
begin
if (UseText1 = False) then
CheckCount := CheckCount + 1;
end;
begin
if (UseText2 = False) then
CheckCount := CheckCount + 1;
end;
begin
if (UseText3 = False) then
CheckCount := CheckCount + 1;
end;
begin
if (UseText4 = False) then
CheckCount := CheckCount + 1;
end;
begin
if (UseText5 = False) then
CheckCount := CheckCount + 1;
end;
begin
if (CheckCount = 5) then
begin
WriteLN('@@ You can''t set all the line''s to False. @@');
WriteLN('@@ Or there would be no point running this script. @@');
WriteLN('@@ Please set atleast 1 line to true to continue. @@');
TerminateScript;
end;
end;
WriteLN('Check count successful.');
end;

//----------------------------------------------------------------------------\\

//----------------------------------------------------------------------------\\
//CHECKS IF YOU SET USETEXT TO 'TRUE' BUT HAVNT ENTERED ANY TEXT IN THE LINE. ||
//----------------------------------------------------------------------------//

procedure CheckText;
begin
begin
if (UseText1 = True) and (Text1 = '') then
begin
WriteLN('@@ You have set ''UseText1'' to ''True'' and have not entered any text in ''Text1''. @@');
WriteLN('@@ So you would be typing nothing into the Runescape window. @@');
WriteLN('@@ If you want to use this line then please add some text, or set ''UseText1'' to ''False''. @@');
TerminateScript;
end;
end;
begin
if (UseText2 = True) and (Text2 = '') then
begin
WriteLN('@@ You have set ''UseText2'' to ''True'' and have not entered any text in ''Text2''. @@');
WriteLN('@@ So you would be typing nothing into the Runescape window. @@');
WriteLN('@@ If you want to use this line then please add some text, or set ''UseText2'' to ''False''. @@');
TerminateScript;
end;
end;
begin
if (UseText3 = True) and (Text3 = '') then
begin
WriteLN('@@ You have set ''UseText3'' to ''True'' and have not entered any text in ''Text3''. @@');
WriteLN('@@ So you would be typing nothing into the Runescape window. @@');
WriteLN('@@ If you want to use this line then please add some text, or set ''UseText3'' to ''False''. @@');
TerminateScript;
end;
end;
begin
if (UseText4 = True) and (Text4 = '') then
begin
WriteLN('@@ You have set ''UseText4'' to ''True'' and have not entered any text in ''Text4''. @@');
WriteLN('@@ So you would be typing nothing into the Runescape window. @@');
WriteLN('@@ If you want to use this line then please add some text, or set ''UseText4'' to ''False''. @@');
TerminateScript;
end;
end;
begin
if (UseText5 = True) and (Text5 = '') then
begin
WriteLN('@@ You have set ''UseText5'' to ''True'' and have not entered any text in ''Text5''. @@');
WriteLN('@@ So you would be typing nothing into the Runescape window. @@');
WriteLN('@@ If you want to use this line then please add some text, or set ''UseText5'' to ''False''. @@');
TerminateScript;
end;
end;
WriteLN('All text correctly set.');
end;

//----------------------------------------------------------------------------\\

//----------------------------------------------------------------------------\\
// THE WAITING INBETWEEN TALKS. ||
//----------------------------------------------------------------------------//

procedure TWait;
begin
begin
if (TalkWait = 0) then
begin
Wait(0 + random(0)); // Lol.
end;
end;
begin
if not (TalkWait = 0) then
begin
Wait(TalkWait + random(1000));
end;
end;
end;

//----------------------------------------------------------------------------\\

//----------------------------------------------------------------------------\\
// CHECKS IF YOU SET 'USECOLORS' TO 'TRUE' AND HAVNT ENTERED IN A COLOR. ||
//----------------------------------------------------------------------------//

procedure CheckColor;
begin
if (UseColors = True) and (Color = '') then
begin
WriteLN('@@ You have set ''UseColors'' to ''True'' and have not set a ''Color''. @@');
WriteLN('@@ Please set a color or set ''UseColors'' to ''False''. @@');
TerminateScript;
end;
end;

//----------------------------------------------------------------------------\\

//----------------------------------------------------------------------------\\
// THE COLOR PROCEDURE ||
//----------------------------------------------------------------------------//

procedure Colors;
begin
if not UseColors then Exit;
begin
if (Color = 'cyan') then
begin
SendText('cyan:');
Exit;
end;
end;
begin
if (Color = 'flash1') then
begin
SendText('flash1:');
Exit;
end;
end;
begin
if (Color = 'flash2') then
begin
SendText('flash2:');
Exit;
end;
end;
begin
if (Color = 'flash3') then
begin
SendText('flash3:');
Exit;
end;
end;
begin
if (Color = 'glow1') then
begin
SendText('glow1:');
Exit;
end;
end;
begin
if (Color = 'glow2') then
begin
SendText('glow2:');
Exit;
end;
end;
begin
if (Color = 'glow3') then
begin
SendText('glow3:');
Exit;
end;
end;
begin
if (Color = 'green') then
begin
SendText('green:');
Exit;
end;
end;
begin
if (Color = 'purple') then
begin
SendText('purple:');
Exit;
end;
end;
begin
if (Color = 'red') then
begin
SendText('red:');
Exit;
end;
end;
begin
if (Color = 'white') then
begin
SendText('white:');
Exit;
end;
end;
end;

//----------------------------------------------------------------------------\\

//----------------------------------------------------------------------------\\
// CHECKS IF YOU SET A CORRECT COLOR NAME. ||
//----------------------------------------------------------------------------//

procedure CheckColName;
begin
if UseColors then
if not (Color = '') or (Color = 'cyan') or (Color = 'flash1') or
(Color = 'flash2') or (Color = 'flash3') or (Color = 'glow1') or
(Color = 'glow2') or (Color = 'glow3') or (Color = 'green') or
(Color = 'purple') or (Color = 'red') or (Color = 'white') then
begin
WriteLN('@@ '+(color)+', is NOT a correct color name. @@');
WriteLN('@@ Please choose a correct color from the option''s at line 25. @@');
TerminateScript;
end;
end;

//----------------------------------------------------------------------------\\

//----------------------------------------------------------------------------\\
// PUTS ALL THE CHECKING PROCEDURES INTO ONE. ||
//----------------------------------------------------------------------------//

procedure Checks;
begin
CheckFalse;
Wait(random(200));
CheckText;
Wait(random(200));
CheckColor;
Wait(random(200));
CheckColName;
Wait(random(200));
begin
if not (UseColors = False) and not (Color = '') then
begin
WriteLN('Using color '''+(Color)+'''.');
end;
end;
Wait(random(200));
end;

//----------------------------------------------------------------------------\\

//----------------------------------------------------------------------------\\
// THE TALKING PROCEDURE ||
//----------------------------------------------------------------------------//

procedure Talk;
begin
begin
if not UseText1 then Exit;
TWait;
Colors;
TypeSend(Text1);
WriteLN('Sent Text: '''+(Text1)+'''.');
WriteLN('----------------------------------');
end;
begin
if not UseText2 then Exit;
begin
TWait;
Colors;
TypeSend(Text2);
WriteLN('Sent Text: '''+(Text2)+'''.');
WriteLN('----------------------------------');
end;
end;
begin
if not UseText3 then Exit;
begin
TWait;
Colors;
TypeSend(Text3);
WriteLN('Sent Text: '''+(Text3)+'''.');
WriteLN('----------------------------------');
end;
end;
begin
if not UseText4 then Exit;
begin
TWait;
Colors;
TypeSend(Text4);
WriteLN('Sent Text: '''+(Text4)+'''.');
WriteLN('----------------------------------');
end;
end;
begin
if not UseText5 then Exit;
begin
TWait;
Colors;
TypeSend(Text5);
WriteLN('Sent Text: '''+(Text5)+'''.');
WriteLN('----------------------------------');
end;
end;
end;

//----------------------------------------------------------------------------\\

//----------------------------------------------------------------------------\\
// THE MAINLOOP PROCEDURE ||
//----------------------------------------------------------------------------//

procedure LoopyLoop;
begin
SetupSRL;
ClearDebug;
Checks;
repeat
Talk;
until(false);
end;

//----------------------------------------------------------------------------\\

//----------------------------------------------------------------------------\\
// THE REAL MAINLOOP ||
//----------------------------------------------------------------------------//

begin
LoopyLoop;
end.

//----------------------------------------------------------------------------\\
{ TBKSimpleTalker Made By: Turbobk. }
//----------------------------------------------------------------------------//


Thanks and I hope you learn a bit off of this.
Turbobk. :)

Da 0wner
02-19-2008, 05:00 AM
Edit: Nevermind i found it. But you could do

typesend(color + effect + text);

Cazax
02-19-2008, 12:43 PM
Maybe you should explain more, begginers just copy + paste.

stampede10343
02-19-2008, 01:13 PM
you should really learn cases... instead of: if(something = true)then
dosomething;

//or

begin
case Text Of
'cyan': TypeSend('Cyan:');// like that
end;
end;


EDIT: "Text" can be a const or a variable

Da 0wner
02-19-2008, 11:10 PM
You don't have to do Something = True just put if Something then...Etc.

You just have to make it a boolean so it results in true or false. Thanks,

~Kyle~