SRL Archive - OSR Outdated Tutorials

Making a basic auto-talker


Richard

2008-04-09 10:59:05

Making a basic auto-talker


I've noticed that many people like to make auto-talkers as a first script, they are simple, easy to use, and its a great way to get into scripting.


1: When you open SCAR

When you first open up SCAR you should get something that looks like this:

program New;
begin
end.

This is very simple to explain, program is the scripts name, begin is the start of the script, end. is the end.

We are making an auto-talker so lets call it Talk. So we'll have

program Talk;
begin
end.


2: Including SRL

If you want to make a script less detecable then the best way is to use SRL as an include, it has functions that use human-like movements so will be alot less detecable.

To put SRL into our we need a line that looks something like this:

{.include SRL/SRL.scar}

We need to put that underneath the program name, but before anything else.

So we'll have:

program Talk;
{.include SRL/SRL.scar}

begin
end.

So thats SRL included, moving on…


3: The constants and variables

The constant basically means something that will stay the same when running the whole script. When putting constants into scripts we put all of them under a little subheading called "Const". So lets put that in…

program Talk;
{.include SRL/SRL.scar}

Const

begin
end.

Now we have to put something in the const section, the text that we want to write. When we use text in scar its known as a "string" and it is marked with using apostrophes ('). So we want our text const, lets call it text. We'll need to put = in there to show what the text is, or what the text equals. So we should now have this:

program Talk;
{.include SRL/SRL.scar}

Const
Text = 'Hello World!'

begin
end.

Now we also want to add how many times we want it to type, this has to be an "integer" or whole number. When using integer we don't need anything around them, they just sit on there own. So lets call this integer "Times". So we now have:

program Talk;
{.include SRL/SRL.scar}

Const
Text = 'Hello World!';
Times = 10;

begin
end.


Now we have the constants done, we need to move onto variables, variables is something that changes, or varies. We lable them in scar like consts, just we put Var at the top instead. Another thing you must learn is that with vars you need to put what type of var they are (Boolean = True or False, Strings = text storage, Integer = whole number, Extended = number with decimal places). Now we are going to need a counter for how many times it has typed. Lets call this "Typed", and this is going to be an integer, so we our script should now look like this:

program Talk;
{.include SRL/SRL.scar}

Var
Typed: Integer;

Const
Text = 'Hello World!';
Times = 10;

begin
end.


4: Making it Talk

Now the most important thing about a script is that it does what it is suposed to, so in our case, it should talk.

Now, for it to talk we need to add a talking function, a good "human-like" talking function is TypeSend. It types like a human and all you need to do it put the text after it in brackets.

But, we don't want to put the text in there as we already have the text in our const section. So all we need to do is this:

TypeSend(Text);

Now lets put that into a whole little procedure of its own. Procedures are like miny programs that you can then put into your main loop. They work just like main loops except you label them "procedure" instead of program, and instead of having end. you have end; as you don't want it to end the whole script.

So, lets put our talking bit into our new procedure:

procedure TalkIt;
begin
TypeSend(Talk);
end;

Now, thats all great, but it will only type once, so we need it to repeat itself, we need to start the loop by putting Repeat, and end it by putting Until, and then you add some information for the util bit.

So we should have:

procedure TalkIt;
begin
Repeat
TypeSend(Text);
Until(False);
end;

You'll see we've put Until(False) in there, that means it will repeat and never stop, unless you manually stop the script. We want it to stop after its typed a certain ammount of times. Now you may remember we had the variable called Typed, now we want the variable to add on 1 every time it types, we do this by putting:

Typed := Typed + 1;

Now, we want this to be put once everytime it types, so we'll have to put this after TypeSend(Text), but before the Until. So… we should have:

procedure TalkIt;
begin
Repeat
TypeSend(Text);
Typed := Typed + 1;
Until(False);
end;

Now, we need it to stop when it reaches the Const "Times" that we set, so we'll need this line.

Until(Typed >= Times);

So we need to replace the Until(False) line. So the procedure should now look like this:

procedure TalkIt;
begin
Repeat
TypeSend(Text);
Typed := Typed + 1;
Until(Typed >= Times);
end;

Now we have the talking bit done, moving onto the last bit…


5: Putting it all together

So far we should have a script that looks something like this:

program Talk;
{.include SRL/SRL.scar}

Var
Typed: Integer;

Const
Text = 'Hello World!';
Times = 10;


procedure TalkIt;
begin
Repeat
TypeSend(Text);
Typed := Typed + 1;
Until(Typed >= Times);
end;


begin
end.

Now, first of all we need to put something that sets up SRL, this is very simple to do, all you need is SetupSRL, we put this into our mainloop (the begin end. bit). So we'll have:

program Talk;
{.include SRL/SRL.scar}

Var
Typed: Integer;

Const
Text = 'Hello World!';
Times = 10;


procedure TalkIt;
begin
Repeat
TypeSend(Text);
Typed := Typed + 1;
Until(Typed >= Times);
end;


begin
SetupSRL;
end.

Now we need to do something that activates the client, guess what this procedure looks like? ActivateClient :). So we'll put this after SetupSRL.

program Talk;
{.include SRL/SRL.scar}

Var
Typed: Integer;

Const
Text = 'Hello World!';
Times = 10;


procedure TalkIt;
begin
Repeat
TypeSend(Text);
Typed := Typed + 1;
Until(Typed >= Times);
end;


begin
SetupSRL;
ActivateClient;
end.

Now all we need to do is call the procedure of the talking. So we'll add TalkIt; after the ActivateClient bit. Now we should have a finished script that looks something like this:

program Talk;
{.include SRL/SRL.scar}

Var
Typed: Integer;

Const
Text = 'Hello World!';
Times = 10;


procedure TalkIt;
begin
Repeat
TypeSend(Text);
Typed := Typed + 1;
Until(Typed >= Times);
end;


begin
SetupSRL;
ActivateClient;
TalkIt;
end.



So there you go, you've made an auto-talker! Have fun on your road to script greatness!

Naum

2008-04-09 11:00:45

Well done. I think you need the quote that ToF got.
Rep++

Richard

2008-04-09 11:07:11

Yes, I do need that quote… I'll go bug hyper to say it on here :D

Dustein

2008-04-09 11:49:07

Finally! A good home-made way to annoy my friends!

Torrent of Flame

2008-04-09 13:03:17

:D I have been mentioned.

But, No offence here DR, it is very detailed and such, but once again there is already tutorials that explain this type of thing.

Your a great tutorial writer and such, but you wont get that cup like this..

Haha only joking even though you probs can see this text anyway.. Rep++ man. That quote is MINE though. All mine. Great tutorial you deserve that cup =]

Richard

2008-04-09 13:12:22

I don't care about the tut writers cup tbh, and where is there a tut explaining how to make an autotalker?

Just because you've got it doesn't mean you are the tut writer master…

Torrent of Flame

2008-04-09 13:33:17

White text. Had YOU fooled that time. Text said:

Haha only joking even though you probs can see this text anyway.. Rep++ man. That quote is MINE though. All mine. Great tutorial you deserve that cup =]

Richard

2008-04-09 13:36:13

Whoops, I didn't see that because you post was too long for iSpy. Sorry man, I was just pissed with this cos I had to re-write the whole thing because when I was nearly finished we had a power cut…

W00t 52 rep. Look what the message is when you hover over my green box :p

Torrent of Flame

2008-04-09 13:41:16

Haha. Thats ok ;) I knew you did read it :P

Richard

2008-04-09 13:43:35

I actually didn't read it cos I was out playing football with a mate for a bit and left iSpy on, ahhs wells. At least "Dude Richard will become famous soon enough" ;)

EDIT: I knows about how much rep you have :p, between 10 and 30 hehe.

Torrent of Flame

2008-04-09 14:16:21

0_o How dos you know that? :p

^^ I have 27.

Naum

2008-04-09 15:31:21

Sigh read his rep tut :)

Richard

2008-04-09 16:35:45

When you hover over you green box under your name it says a message, and if it says "*name* is on a distinguised road" it means they are on 10-30. If it says "*name* can access the script section" means they are 30-50 (back when you became a member at 30 rep). And "*name* will become famous soon enough" is 50-100 (what i'm on now) and Naum thinks that might mean that you used to become a dev. Oh, and 400+ is "*name* is just really nice" but people think anyone who has that cheated :p (Wizzy and nielsie have it).

Mark

2008-05-11 22:53:40

ive never been a big fan of auto talker i think most of them make you stand out as a bot more than anything but i still think there a working progress there gettin a better and better during the weeks im just waiting for there to be a random talker hat actually asks a question and actually remembers its asked. Has any of you come across to autoers stook in the lolloop where a certain auto talker hears the words lol adn talks back to the other autoer saying lmfao,lol,rolf,ect and they just stand there repeating off them selves its actualy quit funny…….

FagetHax0r

2008-05-14 07:35:54

Yes there needs to become a bot who can ask questions and go on

ShowerThoughts

2008-05-14 08:44:18

From: Dude Richard
When you hover over you green box under your name it says a message, and if it says "*name* is on a distinguised road" it means they are on 10-30. If it says "*name* can access the script section" means they are 30-50 (back when you became a member at 30 rep). And "*name* will become famous soon enough" is 50-100 (what i'm on now) and Naum thinks that might mean that you used to become a dev. Oh, and 400+ is "*name* is just really nice" but people think anyone who has that cheated :p (Wizzy and nielsie have it).


Thanks, didn't know that

Immaminor

2008-05-16 23:18:02

Thanks bunches. Great Tut.

Jotzon

2008-11-11 12:54:28

Did i do something wrong?

{.Script Info:
# ScriptName = Qazar 1.0
# Author = Jotzon
# Description = :)
# Version = 1
# Date = 11/11/08
# Comments =
/Script Info}
program AutoTalker;
{.include SRL/SRL.scar}

Var
Typed: Integer;

Const
Text = 'Hello Runescapers'
Times = 5;


procedure TalkIt;
begin
Repeat
TypeSend(Talk);
Typed := Typed + 1;
Until(Typed >= Times);
end;


begin
SetupSRL;
ActivateClient;
TalkIt;
end.


I get this error:
Line 9: [Error] (9:1): Unable to register function function FindGapsTPA(TPA : TPointArray; MinPixels: Integer): T2DPointArray; in script C:\Documents and Settings\Administrator\Bureaublad\Qazar.scar
Failed when compiling


Thanks for this Tutorial, i love to learn scar or other scripting.