PDA

View Full Version : All In One Beginner's Guide To Scar Scripting



xaviar
07-05-2008, 07:31 AM
Hi! If you are looking at this you probably want to learn to scar script. I'm going to teach you the basics in easy to understand steps.

NOTE:Scripting takes time to learn so if you have no paitience this is probably not for you. Also NEVER buy scar it is a free download!

Alright lets get started. First you need to download scar. Do not download from 3rd Party Sites.

http://freddy1990.com/scar.php

Next you need to download Subversion (Also known as SVN). It updates your Srl and lets you pick which version you want to use you can download it here.

http://subversion.tigris.org/files/documents/15/39559/svn-1.4.5-setup.exe

Then open scar go to tools then all the way down to options.
Click on the bottom tab that says SRL Download. Then Check the bubble that says Subversion Respritory then click checkout and a MS DOS window will pop up leave it alone and let it finish. Then hit ok and go to file. Go down and click Download includes.
Congradulations youve successfuly downloaded scar


I am about to save you a lot of time.Open a new file and copy this into it overtop of everything else

program New;
{.include SRL/SRL.scar}
var
const
begin
end.

Then go to File and Click Save As Default.

Now to learn Basic scar functions!

Ok now space out the words like this.

program New; //Change new To the name of Your Script
{.include SRL/SRL.scar}


var //Variables are things in your script that have Certain meanings




const //Constants are things that Always Stay the same in your Scripts



procedure name; //The Procedures in your script are the Functions that your script will preform
begin //Begin tells scar to begin the procedure




end. //End with a period ends the whole script end with a ; after it ends a procedure


Alright in the above script i added explinations to the keywords in a script


Ok for your first script we will be making a message sender! It may sound boring but in no time you will be making better and more complex scripts

We are going to say hello in this script.

program MyFirstScript; //Change new To the name of Your Script
{.include SRL/SRL.scar} //This adds the include file SRL to your script which you will find usefull i the future


var //Variables are not used in this script.




const //The Constant in this script is going to be the message we send in this case Hello!
Word1='Hello!'; //This Tells Scar that 'Word1'=Hello! or in other words that when you type Word1 it really
//A string is a word in 'Quotes' that is pink. A string is a word or phrase.

procedure SayHi; //This is the procedure explaining what we are doing 'Saying Hello'
begin
Writeln(s:string) //This is a function that writes a string (Our Constant) Into Chat
end; //This will end the procedure SayHi


end. //End with a period ends the whole script end with a ; after it ends a procedure



This may look like a lot but it's all very simple just read the instrucions in green.

Summary
A string= A word or phrase
A Program=The Scripts Purpose
A Procedure=What Carries out Functions
A function=What the bot does(Ex:Writeln makes it talk)
A constant(const)=Something that is always the same in a script
A variable(var)=Is something that declares the value of something(Ex:x, y: is an integer(number) these always are at 0 by default.

Allright now back to your first script. Open up a new File.(Dont worry About the other one i was useing it to explain each part)

Ok first Make it look like this by deleting out var and the include and adding a procedure.

program New;



const

procedure Myscript;
begin



end.

Now to add your constant which is going to be what you are going to say to someone.


const
Word1='This is my First Script';


It should now look like this.


program New;

const
Word1='This Is My First Script';

procedure Myscript;
begin


end.


Now To add our function Writeln()
You put it right under begin

program New;

const
Word1='This Is My First Script';

procedure Myscript;
begin
Writeln(Word1);

end.

What this function does is Writes your constant (Word1) into the window.
Now After your Writeln(Word1); hit enter to type end; under it like this.

program New;

const
Word1='This Is My First Script';

procedure Myscript;
begin
Writeln(Word1);
end;


end.





Now what if you wanted it to be writen over and over? Thats what im about to show you. We will be using the function repeat and a procedure known as a loop. This will be what runs your script.


program New;

const
Word1='This Is My First Script';

procedure Myscript;
begin
Writeln(Word1);
end;

procedure loop;
begin
repeat //This tells it to repeat the procedures below
myscript; //This is the procedure that will be repeating itself
until (false) //this tells how long the procedure will loop (false repeats forever)
end; //End ends the loop procedure
begin; //This runs the loop
loop;
end. //This end ends your script

This may look like alot but its really simple. The reason we create macros is to do something over and over to gain/achieve something. That is what the loop procedure does. Repeat is the function that makes the procedures listed below it repeat over until you say. Until is a modifier that tells it to repeat until (when you say). When False is in the brackets it will repeat forever.


Now to test your first script. First before you can run it you have to make sure it can compile. If it doesn't compile go back and see what you did wrong. To compile your script go to the script tab and click compile or hit CTRL+F9. If it sucessfully compiles congradulations you've made it to the end!
Alright now you need to select where you want to write this(Do not do this in runescape yet because of what it says). Down in the Debug box where it says sucessfully compiled will be good for now. select it by dragging the Crosshair on the scar toolbar down to the box. Delete everything in that box


http://i210.photobucket.com/albums/bb273/xaviarrob/Srl-Tutorial-1.jpg



Once you have Done this hit play and you should see the box Fill with This is my first script. Congradulations you are finished.

If you need more help with these send me a message i'll be happy to help you. Rep++ if ou think this guide is usefull. Feel free to comment! Good Luck! Dont pound to hard guys this is guide for beginners. :D



:google: If you can't find something search forums:google:

PhantomCode
07-05-2008, 07:39 AM
Sorry, but not a great tut.

You need to explain how to get SCAR and SRL better. You didn't even mention SVN!
Also, your recommended default script leaves a lot to want.
All of your examples are badly set out, they don't conform to the official standards (http://www.villavu.com/forum/showthread.php?t=3293 <-- Read 'em!)

When False is in the quotes it will repeat forever
You mean brackets, right?

All in all, it needs a fair bit more work to get it up to scratch. :)

PvH
07-05-2008, 07:41 AM
Nice guide,
I didn't learn anything from it, but its good to see you created a tutorial:)
But I got some suggestions, you loor mainloop is messed up, it won't do anything!
Your mainloop is:

begin
end.

That does nothing:p

Replace it with:

begin; //Begin is here so when you compile your script it functions
loop; // Does the loop procedure
end. //This end ends your script



Also, improve your standards, I fixed them for you;)

program New;

const
Word1='This Is My First Script';

procedure Myscript;
begin
Writeln(Word1);
end;

procedure loop;
begin
repeat //This tells it to repeat the procedures below
myscript; //This is the procedure that will be repeating itself
until (false) //this tells how long the procedure will loop (false repeats forever)
end; //End ends the loop procedure

begin; //Begin is here so when you compile your script it functions
loop; // Does the loop procedure
end. //This end ends your script


Good job!

PvH

xaviar
07-05-2008, 07:48 AM
thanks for advice guys im new to making guides im learning while i ype lol and its 2 in the morning which doesnt help

Naum
07-05-2008, 10:11 AM
Sorry, but not a great tut.

You need to explain how to get SCAR and SRL better. You didn't even mention SVN!
Also, your recommended default script leaves a lot to want.
All of your examples are badly set out, they don't conform to the official standards (http://www.villavu.com/forum/showthread.php?t=3293 <-- Read 'em!)



You can talk, ever made a tutorial yourself?

Nice tutorial looks fine, somethings that beginners can use. Well Done
Rep++