Brief Intro On Results
In Scar you are going to need to know how to use results.
Have you ever seen in a script, something like this:
Run the following script-
SCAR Code:
Program New;
Function Results: boolean;
var
x: integer;
begin
x := 5 //declares the x variable to the number 5
if x > 2 then //if x is greater than 2 it continues
begin
Writeln('YAY');
Result := true; //since x was greater than 2, it resulted as true=yes
end;
end;
begin
if Results = true then //if the Result was true it will cleardebug etc.
ClearDebug;
end.
Now that is a basic example of using a result. But, you don't have to type in if Results = true then blah blah
You can simply write if Results then blah blah
It automatically checks if the result was true, so if in the Function Results, it resulted false, it would not clear the debug etc.
Now, let's try using a false result too:
Run the following script-
SCAR Code:
Program New;
Function Results: boolean;
var
x: integer;
begin
x := 5 //declares the x variable to the number 5
if x = 2 then //if x equals 5 then it does the following
begin
Writeln('YAY');
Result := true; //since x was greater than 2, it resulted as true=yes
end;
if x < 10 then //if x is less than 10 itdoes the following
begin
Writeln('aww, x was less than 10..');
Result := false;
end;
end;
begin
if Results then //if the Result was true it will cleardebug etc.
begin
ClearDebug;
Writeln('......');
end;
end.
As you notice, when you run this script the debug box will not be cleared and it will not write in : ........
but if you change to it will clear the debug and write in : ...........
Isn't that neat?
If you start writing runescape scripts it will help a lot, for example:
SCAR Code:
program New;
Function FindsColor:boolean;
var
color: integer;
begin
color := 6914286; //declares color
if FindColor(x, y, Color, MSX1, MSY1, MSX2, MSY2)then //if scar finds the color on the Mainscreen of runescape then it does the rest...
begin
Writeln('found the color');
Result := true;
end;
end;
begin
if FindsColor then
DoTheRestOfTheRunescapeScript; //:p
end.
Have you ever notice that some functions say:
That means the functions results as a numerical value aka integer.
This can be helpful in many situations when you are scripting for runescape:
SCAR Code:
program New;
Function FindsColor: integer; //notice: it results as an integer
var
color: integer;
begin
color := 6914286; //declares color
if FindColor(x, y, Color, MSX1, MSY1, MSX2, MSY2)then //if scar finds the color on the Mainscreen of runescape then it does the rest...
begin
Writeln('found the color');
Result := color;
end;
end;
begin
if FindsColor = 6914286 then //if the color was the same color it will continue.
DoTheRestOfTheScript; //:p
end.
Now you probably notice that was really precise. You probably won't be able to get the exact colors on runescape, so some people do if FindsColor > 1. That just means some form of color was found since 0 = black.
Without functions resulting as integers autocoloring wouldn't be as easy as it is.
Notice in RadialWalk, the color sometimes you use:
SCAR Code:
RadialWalk(FindVarrockRoadColor, blah.....
That's because the function in AutoColor.scar called FindVarrockRoadColor results as an integer[the actual colour]. The Result on an integer can look like:
Result := FinalColor; //finalcolor is declared as an integer in the script
I know this tutorial is a little brief and it might be missing some information, but I hope you learn something from this.
~~ END ~~
- Smarter Child