pwnaz0r
03-03-2007, 06:36 PM
UNRIVALED GUIDE TO SCRIPTING
If you Like this Tut then plz rep me :D
Pwnaz0r - Pwnaz0r@hotmail.com
Description
This IS Under Progress but you are now allowed to post.
I will be covering every aspect of scar we can think of.
Always Looking For New Things to Add so Just Post Here :)
TABLE OF CONTENTS
[LEFT]
Begginers
The Basics
Understanding SCAR
Your First Script
Those Annoying Errors
Finding Color
AntiBan
Building Proggies
Scripting Standards
Functions - Creating And Understanding
Developing And Maintaining A SCAR Script
Intermediate
DTMS
BitMaps
Arrays
Radial Walking -- Highly Needed :p
Some Advanced Procedures
Making Your Own functions
Advanced
Some Components
Making Custom Var Types
Forms
Begginers
The Basics
Ok Well The Basics Are Very Simple Yet At the same time Complex. To Understand the Idea of these "Objects" instantly, you must be open minded. So while you're reading this guide, anything is possible atm. Try to grasp the basic Concept of this chapter. It is not hard but you must be "Open Minded" if you have never scripted before.
CONSTANTS AND VARIABLES
Ok Now Take Heart. If you have never scripted, this will be confusing. It is not hard at all but because your brain has never seen this before, it may take you awhile to understand. Now there are two types "Objects in SCAR". Constants and Variables. These are simply Names for Storing Information. Now the difference between the two is that a constant DOES NOT CHANGE THROUGHOUT THE SCRIPT. A Variable CAN CHANGE THROUGHOUT THE SCRIPT. Ok Now so if you don't get that read it again.Most of you probably take some kind of math with variables, trying to find the missing number. All a variable is, is a number that can change.
For Example
a constant would be like
Number = 1;
From that point on in the script, the Word "Number" would store the number one and it would never change. This is useful for Usernames and passwords, while logging in.
A Variable However can change.
Most people have trouble with variables as the can't grasp the concept so just be open minded. This would be an example of a variable
banks : integer;
Ok now don't worry about the
: integer;
Just yet. All you need to see is the banks. This word stores the amount of times you have banked. Hopefully You have grasped this concept but if you haven't, I'm always on msn as said earlier(pwnaz0r@hotmail.com) or try JAD (runescapeMacro@hotmail.com)
now
Declaring Constants and Variables
Alright well , think of SCAR As a car. When you want the car to go, you press the gas. When you want it to stop, the brakes , etc. But it also has the engine you know nothing about(or you don't know about yet :D). Well in SCAR, You have to state or "Declare" the constants and variables. All you are doing is setting the value of the variable/constant. The only way I can explain is by showing you.
This is what you would do to "Declare" a constant. Most people like to do this right under the program line. This is what you do.
const
Name = 'Clay';
Now lets break this down. I Put "Const" because I want it to Label "Name" as a constant. Then i set the Value of "Name" as a Set of our letters called a string. The only reason i have the
' '
around My name is because thats what tells SCAR it is a string. Anyway we will learn that later. Now, On to declaring a variable.
var
Banked : integer;
ok now this is where we learn about the
: integer;
While using SCAR There are four types of variables. Remeber to be open minded here.
[LIST]
Integer - Probably the most common, Is Used For Regular Numbers - Examples : 1, 34 , 3354
Extended - These are numbers that are not whole - Examples 6.4, -35, 5.553
Boolean - This can result True or False - Examples : True, False
Strings : This was mentioned earlier, a strip of characters - Examples: 'Clay', 'McDonalds', ' Greg'
Deeper Explaination
Ok Now If You understand the types above then skip this section. This is where alot of people seem to have some trouble. It is not all that hard to understand these. Basically, we will use the examples of talking to a person to understand them. Ok now an integer is like your teacher asking you " What is 1 + 1 ?". You would answer 2 unless you're dumb :D. That would be an integer, because it is in fact a whole number. It is not negative and does not have a decimal. Now an extended would be be more like your teacher asking you " What is 7.4 + 6.3 ?". If you add these up you get 13.7 which does have a decimal so it would have to be extended. Boolean is a true/false question on a test. An example would be your teacher asking you " Is Pwnaz0r Awesome?". You would undoubtedly say "True". Lastly, The string would be like your teacher asking you to read from a book(kind of). This variable is usually the easiest. Anyways, the example would be you reading the text " Jack and Jill Went Up The Hill".
Alright Now i think you may understand Constants and Variables by now. If you do, pat yourself on the back. It wont get any harder than that :D. If you don't understand, Message Me on MSN (At the top) or JAD (Also at the top).
Now, we will move on to what we call "Procedures". Procedures are like instructions. They tell scar what to do. So we are going to Move on the making your first Script.
YOUR FIRST SCRIPT
ok, lets open our SCAR. You should get this.
http://img267.imageshack.us/img267/4079/firstscarscreenha8.png (http://imageshack.us)
Now Lets Put Some Spaces Like This (Does not have to be exact). We are doing this to add room for our scripting :).
http://img459.imageshack.us/img459/8388/spacesea4.png (http://imageshack.us)
Now we are going to declare a constant. Most Scripters put it under the program line so lets put it there. Type
const
Name = '(INSERT NAME HERE)';
So it should look like this.
http://img513.imageshack.us/img513/2997/98968129me6.png (http://imageshack.us)
Now The basic Command For writing a line in the Box At the bottom left(the DebugBox) is called Writeln. (WRITELN - some people say WRITEIN it has an L not an I). so lets make a procedure named "Talk".
http://img338.imageshack.us/img338/975/83914644oj1.png (http://imageshack.us)
Ok now let me explain everything.
Now the line
Procedure Talk
Says that the folowing is a procedure;
The line
begin
Tells SCAR what to start doing in the Procedure "Talk.
The Line
Writeln(' Hi My Name Is ' + Name);
Tells Scar To Write " Hi My Name Is " and then your name. You kinda haveta remember how this is done.
The Line
end;
Tells SCAR that this is the end of the instructions for the procedure "Talk".
Now Add The Word "Talk" To The MainLoop. (MAIN LOOP- Tells SCAR In What order to do things). So in the end, this is what your script should look like.
http://img407.imageshack.us/img407/1922/93107852qu1.png (http://imageshack.us)
Ok Now Press Play. If you don't know where play is, keep reading below. This should be what your SCAR program looks like after you have pressed play
http://img410.imageshack.us/img410/8937/82193080gv9.png (http://imageshack.us)
UnderStanding SCAR
BONUS CHAPTER
Well I Did not list this chapter in the table of contents because i want you to learn everything only if you read the entire release.
Here Are Some Explainations of SCAR.
http://img255.imageshack.us/img255/6856/newscriptni9.png (http://imageshack.us)-Clicking this will result In a blank script.
http://img443.imageshack.us/img443/2769/newscriptqr9.png (http://imageshack.us)- This will Open An existing script.
http://img443.imageshack.us/img443/4280/newscriptxd0.png (http://imageshack.us)- This will Open any script from the web(only ones on Kaitneiks(Outdated)).
http://img45.imageshack.us/img45/2600/newscriptau5.png (http://imageshack.us)-- Will Save A Script.
http://img253.imageshack.us/img253/1116/newscripthf3.png (http://imageshack.us)-- Will Cut Text
http://img168.imageshack.us/img168/7389/newscriptyq9.png (http://imageshack.us)-- Will Copy Text
http://img254.imageshack.us/img254/5253/newscriptot8.png (http://imageshack.us)--Paste
http://img171.imageshack.us/img171/1938/newscriptny7.png (http://imageshack.us)--Will Search The Script
http://img259.imageshack.us/img259/2012/newscriptoi6.png (http://imageshack.us)--Will Play the script
http://img259.imageshack.us/img259/4443/newscriptqr7.png (http://imageshack.us)--Pauses Script
http://img261.imageshack.us/img261/3762/newscriptnc1.png (http://imageshack.us)--Stop
http://img162.imageshack.us/img162/6299/newscriptyf9.png (http://imageshack.us)--Step Into
http://img162.imageshack.us/img162/9857/newscriptxq6.png (http://imageshack.us)--Step Over
http://img19.imageshack.us/img19/9082/newscripthc7.png (http://imageshack.us)--Color Picker
http://img337.imageshack.us/img337/3356/newscriptiy0.png (http://imageshack.us)--CLears The Debug Box
http://img154.imageshack.us/img154/5462/newscriptzb7.png (http://imageshack.us)--Turns Report Box On Or Off
http://img154.imageshack.us/img154/224/newscriptgx5.png (http://imageshack.us)-_Drag These CrossHairs to Select Client
Those Annoying Errors
This Is Taken From JAD's Guide and Modified But I do Have permission to use it and this is half his tutorial Since he is an Uber Bro So Im just going to copy, paste, and modify.
ERROR 1 : Close round expected in script.
Pwnaz0r : Well This Means that You haven't put enough parenthesis around the fucntion that you called. EX.
If(FindBitMap(~~~~~) then
I didnt fill in the parameter but see? There are to Parenthesis in the front and one in the back.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
JAD :Solution: Count your parenthesis on the line which the error occurs. for
example: if (FindColorSpiralTolerance(x, y, RockColor, 0, 0, 249, 179, Tol) then
see whats wrong with that? you have 2 ( ('s but only 1 ) to close it. you'd need to put 2 at the end of that like this:
if (FindColorSpiralTolerance(x, y, RockColor, 0, 0, 249, 179, Tol)) then
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR 2 : Include file C:Program FilesSCAR 2.03includesSRL/SRL.scar does not exist.
Pwnaz0r : You did not include the file right or the file does not exists. You can fix this by always making sure the file exists and your sources are right.
{.include srl/srl.scar}
JAD : Solution: this is the biggest error of all time. all you need to do for this is read the tutorial for installing SRL in the Install SRL forum.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
ERROR 3 : Semicolon (';') expected in script
Pwnaz0r : This is very common when first beggining to script. All you have to do is put a semcolon at the end of the line stated.
var
InSane : boolean;//See the semicolon?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
JAD :Solution: this used to happen to me A LOT when i didn't put a ";" after my variables. just remember to do so.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
ERROR 4 : Unknown identifier (A WORD HERE) in script
Pwnaz0r : Etheir you messed up in typing or the procedure/function/variables/constant does not exist.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~
JAD : Solution: this means that you did either did not type something write, you called a procedure that does not exist, you called for a variable that does not exist or you did no include an include, and call for it to setup at end of script (example if you needed to setup SRL in the main loop you need SetupSRL; in script and the include after program name)
so if this happens just check what either what variable you used, usually you just spelled it wrong above where you declared it. check spelling of it. check procedure name and check name of procedure you called for.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~
ERROR 5 : Duplicate Identifier in script
Pwnaz0r : You have named two things the same name in script or they are already used in an include. Just change the name of the function/procedure/variable/constant
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~
JAD : Solution: to fix this i used x for an example. lets say you used i as your variable, then you made a procedure/function called i. this would not work because i is already used as a variable in the script, so you cannot name that as a procedure.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~
Error 6: Identifier expected in script.
Pwnaz0r : Something Is messed up with begins and ends. Count them and make sure they are right throughout the script.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~
JAD : Solution: count your begins and ends in your script, and make sure for each begin, you have an "end;" also make sure for each repeat you have an until.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~
ERROR 7 : 'BEGIN' expected in script.
Pwnaz0r : check to make sure you have a begging at the begging of all procedures, and mainloop. Also, sometimes, when you state vars before a begin in an procedure/function, you forgot to put var in front of it.
procedure Example;
kfjf : integer;
begin
See How it doesnt say var? This is how you would fix it.
Procedure Example;
var
kfjf L integer;
begin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JAD : solution : make sure you have a begin at the beginning of your procedure.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error 8: Invalid number of parameters in script
Pwnaz0r : You Have not filled in the correct parameters for the script.
If(FindColorTolerance(x,y,65336,1,1,100,100))then
This is a common one. People forgit to include the tolerance at the end.
If(FindColorTolerance(x,y,65336,1,1,100,100,15))th en
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JAD : this is ussually caused if you put too many numbers, parenthesis and things like that in script. if you put MMouse(x,y,0,0,0,) it would probably say invalid number of parameters. so just check whats needed in the command, and if theres anything extra thats not needed.
Finding Color
Ok Now there are various Ways To Find Color. Two Main Categories Though.
With Tolerance and Without. Tolerance is just like finding a color similar to it. The higher the tolerance, the more different the color can be.
MOST COMMON COLOR FINDING PROCEDURES
FindColor
FindColorTolerance
FindColorSpiral
FindColorSpiralTolerance
All do pretty much the same thing. Now All you have to do it pick a color for it to find. Use the color picker(Icon listed above in Understanding Scar) and pick a color. I cannot Show you how to do this because the screen is frozen and you can't take a screen shot but this is what should show up in the debug box after you have picked a color.
Color Picked: 16777215 at (243, 139)
That is just an example. 16777215 would be th color and (243, 139) are the coordinates. Now all you have to do is add that to a procedure.
procedure GoToColor;
begin
If(FindColor(x,y, 16777215 , 0 , 0 , 100 , 100))then
begin
Writeln('Found The Color');
end;
end;
Not very hard eh? Anyways, Colors are a really easy way to find things in scar.
ANTI BAN
Well this Is A Big Topic. Making your own antiban is crucial to your script. Now , you can make it simple at first, but more complex later. I think for begginers at least 8 lines(including begin and end) is good in an antiban procedure. Now here are some of the most commonly used antiban procedures.
procedure RotateEvery(mins: Integer);
procedure RandomChatEvery(mins: Integer);
procedure RandomRClickEvery(mins: Integer);
procedure LeaveScreenEvery(mins: Integer);
procedure HoverSkill(Skill: String; Click: Boolean);
procedure PickUpMouseEvery(mins: Integer);
procedure AntiBan;
Anyways, Make Your antiban procedure any name you like and put some of those in there :). Call it when you want to antiban :).
Building Proggies
Ok well progress reports are not hard. Here is the basic SRL Multiplayer Progress report.
procedure PlayerStats;
var
Active: string;
i : Integer;
begin
Writeln('***************************************** ***********');
Writeln(' Name : '+ Players[CurrentPlayer].Name);
Writeln(' Number : '+ IntToStr(CurrentPlayer));
Writeln(' Worked : '+ IntToStr (Players[CurrentPlayer].Worked)+' minutes.');
Writeln(' Banked : '+ IntToStr (Players[CurrentPlayer].Banked) + ' loads.');
Writeln(' Location: '+ Players[CurrentPlayer].loc);
Writeln(' Level : '+ IntToStr(Players[CurrentPlayer].Integer1));
Writeln('***************************************** ***********');
for i := 0 to HowManyPlayers - 1 do
begin
if(Players[i].Active = True)then
Active := 'True'
else
Active := 'False';
Writeln (IntToStr(i) + ' : '+Players[i].Name + ' = ' + Active + '. - Lvl: '+IntToStr(Players[i].Integer1)+
'. - B :'+IntToStr (Players[i].Banked)+' times.'+
' - '+IntToStr (Players[i].Worked)+' mins.'+' - Loc: '+Players[i].loc);
end;
Writeln('***************************************** ************');
end;
I would modify that to your likeing or change Chars/Design :)
Scripting Standards
Scripting Standards are one of the things good scripters use to keep their scripts neat + organized. Some scripters make their own scripting standards after awhile but there is a, what you could call, "Universal Scripting Standards Code".Basically it consists of double spacing after each begin and backspacing twice between each end. Here are some examples of Bad Scripting standards.
BAD SCRIPTING STANDARDS
http://img258.imageshack.us/img258/5715/badscripting1lb1.png (http://imageshack.us)
GOOD SCRIPTING STANDARDS
http://img265.imageshack.us/img265/864/goodscripting1kw4.png (http://imageshack.us)
OR MY PERSONAL SCRIPTING STANDARDS
http://img340.imageshack.us/img340/9236/goodscripting2ll5.png (http://imageshack.us)
See How the First Looks Messy And And Jumbled Up But the Latter 2 Look Neat and tidy? Anyways At the Bottom, I have attached A personal Script Standardizer. All you do is download it, open your script in it, and look at the drop down menus until you see something like "Standardize all"
Functions - Creating And Understanding
Ok now functions are like procedures that give you results. they can be any of the 4 types listed in vars section. Like if you wanted to see if SCAR finds a color it would be listed like this.
function DidWeFindColor : boolean;//Boolean because it results true or false;
begin
result := false;// read below
If(FindColor(x,y,(YourColor),1,1,100,100))then result := true
end;
Ok, now see how I put result := false at the beggining? Well it will stay false unless it finds the color. So its kinda easier. Then you may use that like this.
If(DidWeFindColor= true)then
begin
Writeln(' We Found Color!'):
End;
You can also make other functions but you will learn they are very easy as you move along. If you don't understand how to make them now then dnt try it now. You will understand eventually.
Maintaining And Developing A Script
I DID TAKE THIS FROM MY OTHER TUTORIAL FOUND HERE
http://www.villavu.com/forum/showthread.php?t=6300
How To Organize and Develop A SRL/Scar Based Script Through Neatness To Get it Done Faster/ Better
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index
I. Getting Started
II. Using Basic Tools
III. Scripting Standards
IV. Making An Outline
V. Orgranizing The MainLoop
VI. Publishing A Script
VII. Conculsion
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chapter One Getting Started
Ok, Youre probably reading this tutorial because your scripting is messy, you have trouble finding things, or your just plain bored. This tutorial will go into an explainaton on how I like to keep my scripts organized / make an outline so I don't forget things, don't loose things, etc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chapter Two Using Basic Tools
Well For this Tutorial all you really need are 4 things.
- A Computer -
- Notepad(Or any other writing Program -
- Scar -
- Knowledge Of Scripting -
I am going to go ahead and get you to do the follow things
- Create A folder on the desktops named " My Scripts " or something similar to that -
- Open Up Scar -
- Open Up Your Writing Program -
My Example Will Be A PowerChopper
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chapter Three Scripting Standards
Well Scripting Standards are the way us scripters keep our scripting
LOOK AT THE BOTTOM OF THE PAGE FOR A STANDARDIZER GOTTEN FROM HEY321 or
~~~~~~~~~~~~~~~~~~~~~~~~
http://www.villavu.com/forum/showthread.php?t=5195?t=6042
http://www.villavu.com/forum/showthread.php?t=3293?t=3997
http://www.villavu.com/forum/showthread.php?t=4676?t=5496
^^^^^^^^^^^^^^^^^^^^^
Go To These Tutorials If you don't understand Scripting Standards. Some scripters have their own standards that they create. In my opinion, if its neat, its good enough for me.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chapter Four Making An Outline
Ok well this is where we really start the tutorial. So you have everything ready and you understand scripting standards. To start your outline, you need to know what you want to make. So at the top of your writing program, put your title/idea in Bold.
http://img141.imageshack.us/img141/430/examplezn4.png (http://imageshack.us)
After that, Make your basic Outline. This FORCES you to know what you want to do with the script
http://img339.imageshack.us/img339/7579/examplest5.png (http://imageshack.us)
** NOTE ** notice how I use " * " to make personal notes for myself
This Tells you Exactly What to do with the Script. Now, You begin a detailed version of Your outline. Like So
http://img337.imageshack.us/img337/8262/exampleqs2.png (http://imageshack.us)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Red Dots = I like To put special Symbols when indicating a custom procedure
Black Line = See How I fill in the X when its done?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chapter Five Organizing The Mainloop
Now you have to Organize your mainloop. I don't really know how to explain this as each scripter has his/her own style but, this is how I would organize mine.
http://img147.imageshack.us/img147/2947/doijb3.png (http://imageshack.us)
Intermediate
DTMS
Ok Well I Love DTMs. They Are a Scripters Best Friend. They are very easy to make and almost infalliable. To get to the DTM Maker, Do these steps.
Select RS Window
Go to Tools --> DTM Editor...
THE KEY!! ONLY MOVE THE MOUSE OVER THE OUTLINE COLOR 65336!! THIS IS WHAT IS CALLED A STATIC COLOR. IT DOES NOT CHANGE!!!
Now every point you click in the picture is recorded. A DTM(Deformable Template Module) checks for colors and their distances between them. But colors change in rs. Thats why you only choose the color 65336. Here is a picture of a Basic DTM Being Made.
Make The DTM, (See all the colors in the top right? they are all 65336).
http://img187.imageshack.us/img187/8805/dtmwu4.png (http://imageshack.us)
Go To File --> Save
Save It Where You can find it and let it have a good name.
then go to
Test --> FindDTM
at the top of you screen(its a drop down menu)
Go to your DTM.
If it doesnt find your DTM, then make a new one , else great job!
Now go to File, DTMToText and close the screen. The DTM Will be in the DebugBox.
[LEFT]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MAIN SRL RELATED FUNCTIONS
FindDTM(DTM, x,y, x1, y1, x2, y2) // Finds A DTM in the Specified params. records Position at the vars you specify.
FindDtmIn(var FX, FY: Integer; DTM, X1, Y1, X2, Y2: Integer) // Basically Same thing as above.
//To Click A DTM just say something like
If(FindDTMIn(x,y,(DTM Name Here),X1, Y1, X2, Y2)) then
begin
Mouse(x,y,0,0,true);
end;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BitMaps
BitMaps Are also a highly effective way to find things. They are like a picture. Actually they are a picture. I personally think Bitmaps Are inaccurate and would rather use advanced color finding or DTM's but i will explain anyway.
Well All A BitMap Is, Is a picture So first we need to take a screen shot.
Press the Button "Print Screen". It should be somewhere directly above the arrow keys but maybe higher. This will take a screen Shot of the screen. Now. Go to Paint(or any other picture editing program) and go to Edit --> Paste.
Now Use the cropping tool to cut the image down to its lowest size.(Use The Magnifier if needed). Make The BackGround Black then save. Now open back up SCAR.
Go To Script --> PictureToStr
Now Click Open
Select Your File
Press OK
Now you have the BitMap String in your debug. State that in your script and you can use any BitMap Function for it.
Arrays
Ok now Arrays are basically a series of variables.
How to Declare them
If you know the length of the array, then you can say it like this.
var
ColorArray : array [0..5] of integer;
ExtArray : array [0..2] of extended;
BoolArray : Array [0..10] of boolean;
stringarray : array [5..8] of string;
If You don't(like if your adding colors as you go) then it should be stated like this
Var
ColorArray : array of integer;
Some functions for arrays:
GetArrayLength((ArrayName));
This will get the current length of the array.
SetArrayLength((ArrayName),ArrayLenght));
This is useful for updating arrays as you go. So an example of an updating array would be
procedure UpDateArray;
var
I : integer;
ColorArray : array of integer;
begin
If(FindColor(x,y,98347,1,1,100,100))then
begin
I := GetArrayLength(ColorArray);
SetArrayLength(ColorArray, I + 1);// I + 1 so it will be 1 higher than the
// previous array length.
Colorarray[I + 1] := GetColor(x,y);
end;
end;
RADIALWALKING
Ah yes, the all famous radialwalking. The enigma that most srl members do not understand. It will be explained fully and completely here.
Radialwalking is the best form of walking in my opinion. What Radiawalk Basically does is search for a color on the mini map. Now the MiniMap is a circle, no?. There are 360 degrees in an angle. What Radialwalk does is search
between the angles you specify for a color and picks the farthest color from the center. Now Lets Explain The Command and how it works by use of pictures...
RadialWalk(Color,StartRadial,EndRadial,Radius,ModX , ModY);
Ok Now
COLOR = The color your searching for.
StartRadial = The radius to start at.
EndRadial = The radius to end at.
Radius = How Many Pixels from the center?
ModX = random x
ModY = random y
http://img20.imageshack.us/img20/5126/radialwalk1rq6.png (http://imageshack.us)
Imagine this is the minimap. Those Are The Angles roughly that the mini map is composed of.
Now if you wanted to search for a white color from 0 to 90, you would make your radiawalk like this
RadialWalk( {WhiteColor} , 0, 90, 70, 0 , 0);
It would search the color in this area.
http://img178.imageshack.us/img178/7295/radialwalk1we4.png (http://imageshack.us)
starting from 0 to 90. Like so.
(SRY for the bad picture, I got it straight from YakMan's RadialWalker Aid.)
http://img88.imageshack.us/img88/328/radialwalk1uc0.png (http://imageshack.us)
If it finds the color White, it Will Click it and exit.
Using RadialRoadWalk is useful yet I prefer to do it like so :D
procedure ClickRoad;
var
tmpRoad : integer;
begin
tmpRoad := FindRoadColor;
RadialWalk(tmpRoad,~~~~~~);
end;
USING YAKMANS RADIWALK HELPER
HIGHLY SUGGESTED!!
It works amazingly. Here is kinda a mini tutorial on it.
While In SCAR, Go TO Open
Click on Includes in The " Main Menu " of SCAR(where you downloaded srl)
go to includes --> SRL --> scripts --> Yakman's RadialWalk Helper
Open it
Press Play
Make sure you are logged in to RS
Move The Window Over to The Side, Out Of the way of the minimap
Press "CAPTURE FROM CLIENT" on the right hand side
It Should Take A Picture Of The MiniMap
Now Move The Mouse Over the Mini Map TO The Starting Radial And Click Like so. The Line should stick there.
http://img237.imageshack.us/img237/4541/radialwalk2zp6.png (http://imageshack.us)
Only Use The "Radial" not "Radial2" unless you plan on over lapping(not really recommended).
Fill in the Boxes with Radius , Start Radius and End Radius and hit "Show Path". It Should show you how it will search. If you like it , hit "Stop" and hit "Print Procedure". Then Close the box.
Now Look in the debug Box. It has your command already made out!!
Advanced Procedures
Ok now Advanced Procedures are very useful in scripting. I Like to think of Advanced Procedures Having the folowing :
AntiBan
Undetectable
Higly Accurate
They Are Kind Of "Spur Of The Moment" Ideas. The folowing would be an example.
procedure findrock;
begin
If(FindColorSpiral(x,y,color,x1,y1,x2,y2))then
begin
If(FindColorSprial(x,y,color2,x+15, Y+15, x -15, y - 15))then
begin
Writeln('Found');
end;
end;
end;
EDIT:
Ok Well Many People do not understand this so let me go through this procedure where you can. Ok, When you call the first FindColor Spiral,it stores the position of the color at x,y correct?. Well when you call the second FindColorSpiral, the box it creates wil be with 15 pixels of the first color found. Hopefully that will clear things up for you ;).
Basically What this will do is find a color on th main screen. If it finds the second color within a box of the first color, it will write found see?. Base commands on other commands results as so and add failsafes and your good to go. :)
Making Your Own Functions
Well Making your own functions is what intermediate-advanced scripters do.
To Make the functions you want, you need to understand the 4 types of vars. Now Lets say you wanted to make an AxeHead Finder. You would make an outline (Maintaining and Developing a script Above). And get at it. I would suggest using DTMs Or advanced procedures(above) to get a Axe Head Finder Done. Take into consideration all things that happen durring runtime of the procedure. For instance, The Axe Head often lands under the white dots of people on the minimap, and is usually covered by a person. So if it doesnt find it on the first try, make sure it radialwalks (or any other form of minimap walking) to a white dot.
[CENTER]
ADVANCED
YEAH, These are gunna make your head hurt unless your good :D
Some Components
Well As You Probably Know, Many Components/Classes were imported from Delphi.
These are listed in the SCAR manual. Here are some basic definitions.
TGroupBox - The TGroupBox component represents a standard group box, used to group related controls on a form.
TLabel - Use TLabel to add text or a bitmap that the user can’t edit to a form.
TEdit - Use a TEdit object to put a standard edit control on a form.
TMemo - Use TMemo to put a standard multiline edit control on a form.
TComboBox - A TComboBox component is an edit box with a scrollable drop-down list attached to it.
TButton - Use TButton to put a standard push button on a form.
TCheckBox - A TCheckBox component presents an option for the user.
TRadioButton - Use TRadioButton to add a radio button to a form.
TListBox - Use TListBox to display a scrollable list of items that users can select, add, or delete.
TScrollBar - Use TScrollBar to add a free-standing scroll bar to a form.
TImage - Use TImage to display a graphical image on a form.
TPanel - Use TPanel to put an empty panel on a form.
TTimer - TTimer is used to simplify calling the system timer functions.
TForm - form (window) component.
TApplication - TApplication encapsulates a windowed application.
TMenuItem - Use TMenuItem to specify the appearance and behavior of an item in a menu.
TMenu - Use TMenu as a base class when defining a component that represents a collection of menu items.
TMainMenu - Use TMainMenu to provide the main menu for a form.
TPopupMenu - Use TPopupMenu to define the pop-up menu that appears when the user clicks on a control with the right mouse button.
TCanvas - Use TCanvas as a drawing surface for objects that draw an image of themselves.
Now that is straight from the SCAR Manual. Some Of these components Uses will be listed here:
TGroupBox - Used In Forms, Used To Organize
TLabel - Form Component that the user cant edit.
TImage - In My Opinion, the best Picture Component For Forms.
TRadioButton - Radio Button
TCheckBox - Check Box
TButton - a button
TCanvas - Obviously The Canvas of the Forms.
Again that was a very simple list. Now The main reason i made this section was to Discuss the TPoint component so from here on out, thats what its gunna do. TPoint Is Basically, in simple terms, a collective var type that has 2 SubVars. X and Y.
Example Using These:
procedure GetPos;
var
MyPoint : TPoint;
xx, yy : integer;
begin
GetMouse(xx,yy);
MyPoint.X := xx;
MyPoint.Y := yy;
end;
All that procedure does is store the Position of X and Y to the TPoint. I Used TPoint quite alot in my UberAlcher(not finished yet). There is also TPointArray Which Is Good For Storing Positions.
procedure MakeATPointArray;
var
ThePoints : TPointArray;
XX : integer;
YY : integer;
I : extended;
begin
I := -1;
GetMousePos(XX,YY);
repeat
XX := XX + 1;
YY := YY + 1;
I :+ I + 1;
SetArrayLength(ThePoints, I)l
ThePoints[I].X := XX;
ThePoints[I].Y := YY;
until(i = 25);
end;
That procedure doesnt really do anything useful just an example :D
Making Custom Var Types
Well As Seen Above, TPoint is a var type. But did you know you can create your own? This is what the player array is composed of. To declare a new var type, Just add it before your first procedure in script. "Type" is the word used to declare a new var type. The Example should explain everything.
THIS WAS TAKEN FROM MY UBER ALCHER
Type
AntiBannage = record
TalkingRatio : integer;
MovingRatio : integer;
MisClickRatio : integer;
StatsBoxRatio : integer;
end;
and i used it in this way.
procedure AntiBanLand;
var
AntiBanN : AntiBannage;
begin
ABR := 5;
//--------------------------
AntiBanN.TalkingRatio := 1 + random(ABR * 10);
AntiBanN.MovingRatio := 1 + random(ABR * 5);
AntiBanN.MisClickRatio := 1 + random(50);
//--------------------------
Case AntiBanN.TalkingRatio of
1 : begin
end;
end;
//--------------------------
Case AntiBanN.MovingRatio of
1 : begin
SleepAndMoveMouse(1500+random(3000));
ReportVars[1] := ReportVars[1] + 1;
end;
4 : begin
SleepAndMoveMouse(1000+random(2000));
ReportVars[1] := ReportVars[1] + 1;
end;
8 : begin
PickUpMouse;
ReportVars[1] := ReportVars[1] + 1;
end;
10 : begin
AlmostLogOut;
ReportVars[1] := ReportVars[1] + 1;
end;
end;
//--------------------------
Case AntiBanN.MisClickRatio of
1 : begin
GameTab(6);
GameTab(7);
ReportVars[1] := ReportVars[1] + 1;
end;
end;
//--------------------------
HoverEvery(15 + random(10),'Magic');
end;
That is for antiban. Anyways This is a very easy thing to do, I just thought I may want to put it under Advanced because in my opinion, you really shouldn't use it unless you are advanced :D.
Forms
Ah Yes, Forms. They are quite an enigma for even an the best of scripters. But they are actually quite simple. I think that the form creator is a great tool for creating for but only for the basic structure. I have edited a form that greatly exceeds the form makers abilities because the formmaker does not include all form components. However, I will be discussing how to manually create a form and how to create one via form maker.
STANDARD FORM PROCEDURES
Ok well lets go ahead and get this out of the way. These are always to be put after your main InIt procedure.
procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;
procedure ShowFormModal;
begin
frmDesign.ShowModal;
end;
procedure SafeShowFormModal;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;
USING FORM EDITOR
Well The Form Editor Leaves out Many Components But here it is anyway.
To Get To The Form Editor :
Open SCAR
Go To Tools --> FormEditor...
Now You Should Get 3 Boxes.(frmDesign),(frmDesigner),(Object Inspector).
Ok Now In the Forum Designer, You can choose from a variety of options.
These Are Not Hard. All you do it click the button on the frm Designer and then click where you want it on the frm Design. (You can edit the size of the form but adjusting the frm Design window. If you can't do this very simple thing of designing a basic form, see other tuts about it and come back. This only goes into detail, explaining how forms work.
Now This Is my Example Form;
frmDesign := CreateForm;
frmDesign.Left := 250;
frmDesign.Top := 114;
frmDesign.Width := 696;
frmDesign.Height := 480;
frmDesign.Caption := 'frmDesign';
frmDesign.Color := clBtnFace;
frmDesign.Font.Color := clWindowText;
frmDesign.Font.Height := -11;
frmDesign.Font.Name := 'MS Sans Serif';
frmDesign.Font.Style := [];
frmDesign.Visible := True;
frmDesign.PixelsPerInch := 96;
Label1 := TLabel.Create(frmDesign);
Label1.Parent := frmDesign;
Label1.Left := 498;
Label1.Top := 278;
Label1.Width := 32;
Label1.Height := 13;
Label1.Caption := 'Label1';
Button1 := TButton.Create(frmDesign);
Button1.Parent := frmDesign;
Button1.Left := 296;
Button1.Top := 189;
Button1.Width := 75;
Button1.Height := 25;
Button1.Caption := 'Button1';
Button1.TabOrder := 8;
CheckBox1 := TCheckBox.Create(frmDesign);
CheckBox1.Parent := frmDesign;
CheckBox1.Left := 48;
CheckBox1.Top := 46;
CheckBox1.Width := 97;
CheckBox1.Height := 17;
CheckBox1.Caption := 'CheckBox1';
CheckBox1.TabOrder := 9;
GroupBox1 := TGroupBox.Create(frmDesign);
GroupBox1.Parent := frmDesign;
GroupBox1.Left := 34;
GroupBox1.Top := 215;
GroupBox1.Width := 185;
GroupBox1.Height := 105;
GroupBox1.Caption := 'GroupBox1';
GroupBox1.TabOrder := 10;
Memo1 := TMemo.Create(frmDesign);
Memo1.Parent := frmDesign;
Memo1.Left := 323;
Memo1.Top := 44;
Memo1.Width := 185;
Memo1.Height := 89;
Memo1.Lines.Add('Memo1');
Memo1.TabOrder := 11;
Not Anything Special, Just has many components Form Creator gives you.
Now, Lets just break down one form add-in.
Memo1 := TMemo.Create(frmDesign);
Memo1.Parent := frmDesign;
Memo1.Left := 323;
Memo1.Top := 44;
Memo1.Width := 185;
Memo1.Height := 89;
Memo1.Lines.Add('Memo1');
Memo1.TabOrder := 11;
Ok Now the first line.
Memo1 := TMemo.Create(frmDesign);
Creates A TMemo called Memo1 in (frmDesign).<-- frmDesign is the default name of you form.
The Second Line,
Memo1.Parent := frmDesign;
Tells SCAR that Memo1 will be placed in frmDesign(in other words, no in a group box, etc).
Lines 3-7
Memo1.Left := 323;
Memo1.Top := 44;
Memo1.Width := 185;
Memo1.Height := 89;
Tell Scar the Parameters For Memo1
Line 8
Memo1.Lines.Add('Memo1');
Is Specific Command For a TMemo. All Components have their own commands because thats what makes them different components.
What I like to do when editing my form manually is split up the sections so here is my example .
frmDesign := CreateForm;
frmDesign.Left := 250;
frmDesign.Top := 114;
frmDesign.Width := 696;
frmDesign.Height := 480;
frmDesign.Caption := 'frmDesign';
frmDesign.Color := clBtnFace;
frmDesign.Font.Color := clWindowText;
frmDesign.Font.Height := -11;
frmDesign.Font.Name := 'MS Sans Serif';
frmDesign.Font.Style := [];
frmDesign.Visible := True;
frmDesign.PixelsPerInch := 96;
//------------------
Label1 := TLabel.Create(frmDesign);
Label1.Parent := frmDesign;
Label1.Left := 498;
Label1.Top := 278;
Label1.Width := 32;
Label1.Height := 13;
Label1.Caption := 'Label1';
//------------------
Button1 := TButton.Create(frmDesign);
Button1.Parent := frmDesign;
Button1.Left := 296;
Button1.Top := 189;
Button1.Width := 75;
Button1.Height := 25;
Button1.Caption := 'Button1';
Button1.TabOrder := 8;
//------------------
CheckBox1 := TCheckBox.Create(frmDesign);
CheckBox1.Parent := frmDesign;
CheckBox1.Left := 48;
CheckBox1.Top := 46;
CheckBox1.Width := 97;
CheckBox1.Height := 17;
CheckBox1.Caption := 'CheckBox1';
CheckBox1.TabOrder := 9;
//------------------
GroupBox1 := TGroupBox.Create(frmDesign);
GroupBox1.Parent := frmDesign;
GroupBox1.Left := 34;
GroupBox1.Top := 215;
GroupBox1.Width := 185;
GroupBox1.Height := 105;
GroupBox1.Caption := 'GroupBox1';
GroupBox1.TabOrder := 10;
//------------------
Memo1 := TMemo.Create(frmDesign);
Memo1.Parent := frmDesign;
Memo1.Left := 323;
Memo1.Top := 44;
Memo1.Width := 185;
Memo1.Height := 89;
Memo1.Lines.Add('Memo1');
Memo1.TabOrder := 11;
If you Like this Tut then plz rep me :D
Pwnaz0r - Pwnaz0r@hotmail.com
Description
This IS Under Progress but you are now allowed to post.
I will be covering every aspect of scar we can think of.
Always Looking For New Things to Add so Just Post Here :)
TABLE OF CONTENTS
[LEFT]
Begginers
The Basics
Understanding SCAR
Your First Script
Those Annoying Errors
Finding Color
AntiBan
Building Proggies
Scripting Standards
Functions - Creating And Understanding
Developing And Maintaining A SCAR Script
Intermediate
DTMS
BitMaps
Arrays
Radial Walking -- Highly Needed :p
Some Advanced Procedures
Making Your Own functions
Advanced
Some Components
Making Custom Var Types
Forms
Begginers
The Basics
Ok Well The Basics Are Very Simple Yet At the same time Complex. To Understand the Idea of these "Objects" instantly, you must be open minded. So while you're reading this guide, anything is possible atm. Try to grasp the basic Concept of this chapter. It is not hard but you must be "Open Minded" if you have never scripted before.
CONSTANTS AND VARIABLES
Ok Now Take Heart. If you have never scripted, this will be confusing. It is not hard at all but because your brain has never seen this before, it may take you awhile to understand. Now there are two types "Objects in SCAR". Constants and Variables. These are simply Names for Storing Information. Now the difference between the two is that a constant DOES NOT CHANGE THROUGHOUT THE SCRIPT. A Variable CAN CHANGE THROUGHOUT THE SCRIPT. Ok Now so if you don't get that read it again.Most of you probably take some kind of math with variables, trying to find the missing number. All a variable is, is a number that can change.
For Example
a constant would be like
Number = 1;
From that point on in the script, the Word "Number" would store the number one and it would never change. This is useful for Usernames and passwords, while logging in.
A Variable However can change.
Most people have trouble with variables as the can't grasp the concept so just be open minded. This would be an example of a variable
banks : integer;
Ok now don't worry about the
: integer;
Just yet. All you need to see is the banks. This word stores the amount of times you have banked. Hopefully You have grasped this concept but if you haven't, I'm always on msn as said earlier(pwnaz0r@hotmail.com) or try JAD (runescapeMacro@hotmail.com)
now
Declaring Constants and Variables
Alright well , think of SCAR As a car. When you want the car to go, you press the gas. When you want it to stop, the brakes , etc. But it also has the engine you know nothing about(or you don't know about yet :D). Well in SCAR, You have to state or "Declare" the constants and variables. All you are doing is setting the value of the variable/constant. The only way I can explain is by showing you.
This is what you would do to "Declare" a constant. Most people like to do this right under the program line. This is what you do.
const
Name = 'Clay';
Now lets break this down. I Put "Const" because I want it to Label "Name" as a constant. Then i set the Value of "Name" as a Set of our letters called a string. The only reason i have the
' '
around My name is because thats what tells SCAR it is a string. Anyway we will learn that later. Now, On to declaring a variable.
var
Banked : integer;
ok now this is where we learn about the
: integer;
While using SCAR There are four types of variables. Remeber to be open minded here.
[LIST]
Integer - Probably the most common, Is Used For Regular Numbers - Examples : 1, 34 , 3354
Extended - These are numbers that are not whole - Examples 6.4, -35, 5.553
Boolean - This can result True or False - Examples : True, False
Strings : This was mentioned earlier, a strip of characters - Examples: 'Clay', 'McDonalds', ' Greg'
Deeper Explaination
Ok Now If You understand the types above then skip this section. This is where alot of people seem to have some trouble. It is not all that hard to understand these. Basically, we will use the examples of talking to a person to understand them. Ok now an integer is like your teacher asking you " What is 1 + 1 ?". You would answer 2 unless you're dumb :D. That would be an integer, because it is in fact a whole number. It is not negative and does not have a decimal. Now an extended would be be more like your teacher asking you " What is 7.4 + 6.3 ?". If you add these up you get 13.7 which does have a decimal so it would have to be extended. Boolean is a true/false question on a test. An example would be your teacher asking you " Is Pwnaz0r Awesome?". You would undoubtedly say "True". Lastly, The string would be like your teacher asking you to read from a book(kind of). This variable is usually the easiest. Anyways, the example would be you reading the text " Jack and Jill Went Up The Hill".
Alright Now i think you may understand Constants and Variables by now. If you do, pat yourself on the back. It wont get any harder than that :D. If you don't understand, Message Me on MSN (At the top) or JAD (Also at the top).
Now, we will move on to what we call "Procedures". Procedures are like instructions. They tell scar what to do. So we are going to Move on the making your first Script.
YOUR FIRST SCRIPT
ok, lets open our SCAR. You should get this.
http://img267.imageshack.us/img267/4079/firstscarscreenha8.png (http://imageshack.us)
Now Lets Put Some Spaces Like This (Does not have to be exact). We are doing this to add room for our scripting :).
http://img459.imageshack.us/img459/8388/spacesea4.png (http://imageshack.us)
Now we are going to declare a constant. Most Scripters put it under the program line so lets put it there. Type
const
Name = '(INSERT NAME HERE)';
So it should look like this.
http://img513.imageshack.us/img513/2997/98968129me6.png (http://imageshack.us)
Now The basic Command For writing a line in the Box At the bottom left(the DebugBox) is called Writeln. (WRITELN - some people say WRITEIN it has an L not an I). so lets make a procedure named "Talk".
http://img338.imageshack.us/img338/975/83914644oj1.png (http://imageshack.us)
Ok now let me explain everything.
Now the line
Procedure Talk
Says that the folowing is a procedure;
The line
begin
Tells SCAR what to start doing in the Procedure "Talk.
The Line
Writeln(' Hi My Name Is ' + Name);
Tells Scar To Write " Hi My Name Is " and then your name. You kinda haveta remember how this is done.
The Line
end;
Tells SCAR that this is the end of the instructions for the procedure "Talk".
Now Add The Word "Talk" To The MainLoop. (MAIN LOOP- Tells SCAR In What order to do things). So in the end, this is what your script should look like.
http://img407.imageshack.us/img407/1922/93107852qu1.png (http://imageshack.us)
Ok Now Press Play. If you don't know where play is, keep reading below. This should be what your SCAR program looks like after you have pressed play
http://img410.imageshack.us/img410/8937/82193080gv9.png (http://imageshack.us)
UnderStanding SCAR
BONUS CHAPTER
Well I Did not list this chapter in the table of contents because i want you to learn everything only if you read the entire release.
Here Are Some Explainations of SCAR.
http://img255.imageshack.us/img255/6856/newscriptni9.png (http://imageshack.us)-Clicking this will result In a blank script.
http://img443.imageshack.us/img443/2769/newscriptqr9.png (http://imageshack.us)- This will Open An existing script.
http://img443.imageshack.us/img443/4280/newscriptxd0.png (http://imageshack.us)- This will Open any script from the web(only ones on Kaitneiks(Outdated)).
http://img45.imageshack.us/img45/2600/newscriptau5.png (http://imageshack.us)-- Will Save A Script.
http://img253.imageshack.us/img253/1116/newscripthf3.png (http://imageshack.us)-- Will Cut Text
http://img168.imageshack.us/img168/7389/newscriptyq9.png (http://imageshack.us)-- Will Copy Text
http://img254.imageshack.us/img254/5253/newscriptot8.png (http://imageshack.us)--Paste
http://img171.imageshack.us/img171/1938/newscriptny7.png (http://imageshack.us)--Will Search The Script
http://img259.imageshack.us/img259/2012/newscriptoi6.png (http://imageshack.us)--Will Play the script
http://img259.imageshack.us/img259/4443/newscriptqr7.png (http://imageshack.us)--Pauses Script
http://img261.imageshack.us/img261/3762/newscriptnc1.png (http://imageshack.us)--Stop
http://img162.imageshack.us/img162/6299/newscriptyf9.png (http://imageshack.us)--Step Into
http://img162.imageshack.us/img162/9857/newscriptxq6.png (http://imageshack.us)--Step Over
http://img19.imageshack.us/img19/9082/newscripthc7.png (http://imageshack.us)--Color Picker
http://img337.imageshack.us/img337/3356/newscriptiy0.png (http://imageshack.us)--CLears The Debug Box
http://img154.imageshack.us/img154/5462/newscriptzb7.png (http://imageshack.us)--Turns Report Box On Or Off
http://img154.imageshack.us/img154/224/newscriptgx5.png (http://imageshack.us)-_Drag These CrossHairs to Select Client
Those Annoying Errors
This Is Taken From JAD's Guide and Modified But I do Have permission to use it and this is half his tutorial Since he is an Uber Bro So Im just going to copy, paste, and modify.
ERROR 1 : Close round expected in script.
Pwnaz0r : Well This Means that You haven't put enough parenthesis around the fucntion that you called. EX.
If(FindBitMap(~~~~~) then
I didnt fill in the parameter but see? There are to Parenthesis in the front and one in the back.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
JAD :Solution: Count your parenthesis on the line which the error occurs. for
example: if (FindColorSpiralTolerance(x, y, RockColor, 0, 0, 249, 179, Tol) then
see whats wrong with that? you have 2 ( ('s but only 1 ) to close it. you'd need to put 2 at the end of that like this:
if (FindColorSpiralTolerance(x, y, RockColor, 0, 0, 249, 179, Tol)) then
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR 2 : Include file C:Program FilesSCAR 2.03includesSRL/SRL.scar does not exist.
Pwnaz0r : You did not include the file right or the file does not exists. You can fix this by always making sure the file exists and your sources are right.
{.include srl/srl.scar}
JAD : Solution: this is the biggest error of all time. all you need to do for this is read the tutorial for installing SRL in the Install SRL forum.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
ERROR 3 : Semicolon (';') expected in script
Pwnaz0r : This is very common when first beggining to script. All you have to do is put a semcolon at the end of the line stated.
var
InSane : boolean;//See the semicolon?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
JAD :Solution: this used to happen to me A LOT when i didn't put a ";" after my variables. just remember to do so.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
ERROR 4 : Unknown identifier (A WORD HERE) in script
Pwnaz0r : Etheir you messed up in typing or the procedure/function/variables/constant does not exist.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~
JAD : Solution: this means that you did either did not type something write, you called a procedure that does not exist, you called for a variable that does not exist or you did no include an include, and call for it to setup at end of script (example if you needed to setup SRL in the main loop you need SetupSRL; in script and the include after program name)
so if this happens just check what either what variable you used, usually you just spelled it wrong above where you declared it. check spelling of it. check procedure name and check name of procedure you called for.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~
ERROR 5 : Duplicate Identifier in script
Pwnaz0r : You have named two things the same name in script or they are already used in an include. Just change the name of the function/procedure/variable/constant
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~
JAD : Solution: to fix this i used x for an example. lets say you used i as your variable, then you made a procedure/function called i. this would not work because i is already used as a variable in the script, so you cannot name that as a procedure.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~
Error 6: Identifier expected in script.
Pwnaz0r : Something Is messed up with begins and ends. Count them and make sure they are right throughout the script.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~
JAD : Solution: count your begins and ends in your script, and make sure for each begin, you have an "end;" also make sure for each repeat you have an until.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~
ERROR 7 : 'BEGIN' expected in script.
Pwnaz0r : check to make sure you have a begging at the begging of all procedures, and mainloop. Also, sometimes, when you state vars before a begin in an procedure/function, you forgot to put var in front of it.
procedure Example;
kfjf : integer;
begin
See How it doesnt say var? This is how you would fix it.
Procedure Example;
var
kfjf L integer;
begin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JAD : solution : make sure you have a begin at the beginning of your procedure.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error 8: Invalid number of parameters in script
Pwnaz0r : You Have not filled in the correct parameters for the script.
If(FindColorTolerance(x,y,65336,1,1,100,100))then
This is a common one. People forgit to include the tolerance at the end.
If(FindColorTolerance(x,y,65336,1,1,100,100,15))th en
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JAD : this is ussually caused if you put too many numbers, parenthesis and things like that in script. if you put MMouse(x,y,0,0,0,) it would probably say invalid number of parameters. so just check whats needed in the command, and if theres anything extra thats not needed.
Finding Color
Ok Now there are various Ways To Find Color. Two Main Categories Though.
With Tolerance and Without. Tolerance is just like finding a color similar to it. The higher the tolerance, the more different the color can be.
MOST COMMON COLOR FINDING PROCEDURES
FindColor
FindColorTolerance
FindColorSpiral
FindColorSpiralTolerance
All do pretty much the same thing. Now All you have to do it pick a color for it to find. Use the color picker(Icon listed above in Understanding Scar) and pick a color. I cannot Show you how to do this because the screen is frozen and you can't take a screen shot but this is what should show up in the debug box after you have picked a color.
Color Picked: 16777215 at (243, 139)
That is just an example. 16777215 would be th color and (243, 139) are the coordinates. Now all you have to do is add that to a procedure.
procedure GoToColor;
begin
If(FindColor(x,y, 16777215 , 0 , 0 , 100 , 100))then
begin
Writeln('Found The Color');
end;
end;
Not very hard eh? Anyways, Colors are a really easy way to find things in scar.
ANTI BAN
Well this Is A Big Topic. Making your own antiban is crucial to your script. Now , you can make it simple at first, but more complex later. I think for begginers at least 8 lines(including begin and end) is good in an antiban procedure. Now here are some of the most commonly used antiban procedures.
procedure RotateEvery(mins: Integer);
procedure RandomChatEvery(mins: Integer);
procedure RandomRClickEvery(mins: Integer);
procedure LeaveScreenEvery(mins: Integer);
procedure HoverSkill(Skill: String; Click: Boolean);
procedure PickUpMouseEvery(mins: Integer);
procedure AntiBan;
Anyways, Make Your antiban procedure any name you like and put some of those in there :). Call it when you want to antiban :).
Building Proggies
Ok well progress reports are not hard. Here is the basic SRL Multiplayer Progress report.
procedure PlayerStats;
var
Active: string;
i : Integer;
begin
Writeln('***************************************** ***********');
Writeln(' Name : '+ Players[CurrentPlayer].Name);
Writeln(' Number : '+ IntToStr(CurrentPlayer));
Writeln(' Worked : '+ IntToStr (Players[CurrentPlayer].Worked)+' minutes.');
Writeln(' Banked : '+ IntToStr (Players[CurrentPlayer].Banked) + ' loads.');
Writeln(' Location: '+ Players[CurrentPlayer].loc);
Writeln(' Level : '+ IntToStr(Players[CurrentPlayer].Integer1));
Writeln('***************************************** ***********');
for i := 0 to HowManyPlayers - 1 do
begin
if(Players[i].Active = True)then
Active := 'True'
else
Active := 'False';
Writeln (IntToStr(i) + ' : '+Players[i].Name + ' = ' + Active + '. - Lvl: '+IntToStr(Players[i].Integer1)+
'. - B :'+IntToStr (Players[i].Banked)+' times.'+
' - '+IntToStr (Players[i].Worked)+' mins.'+' - Loc: '+Players[i].loc);
end;
Writeln('***************************************** ************');
end;
I would modify that to your likeing or change Chars/Design :)
Scripting Standards
Scripting Standards are one of the things good scripters use to keep their scripts neat + organized. Some scripters make their own scripting standards after awhile but there is a, what you could call, "Universal Scripting Standards Code".Basically it consists of double spacing after each begin and backspacing twice between each end. Here are some examples of Bad Scripting standards.
BAD SCRIPTING STANDARDS
http://img258.imageshack.us/img258/5715/badscripting1lb1.png (http://imageshack.us)
GOOD SCRIPTING STANDARDS
http://img265.imageshack.us/img265/864/goodscripting1kw4.png (http://imageshack.us)
OR MY PERSONAL SCRIPTING STANDARDS
http://img340.imageshack.us/img340/9236/goodscripting2ll5.png (http://imageshack.us)
See How the First Looks Messy And And Jumbled Up But the Latter 2 Look Neat and tidy? Anyways At the Bottom, I have attached A personal Script Standardizer. All you do is download it, open your script in it, and look at the drop down menus until you see something like "Standardize all"
Functions - Creating And Understanding
Ok now functions are like procedures that give you results. they can be any of the 4 types listed in vars section. Like if you wanted to see if SCAR finds a color it would be listed like this.
function DidWeFindColor : boolean;//Boolean because it results true or false;
begin
result := false;// read below
If(FindColor(x,y,(YourColor),1,1,100,100))then result := true
end;
Ok, now see how I put result := false at the beggining? Well it will stay false unless it finds the color. So its kinda easier. Then you may use that like this.
If(DidWeFindColor= true)then
begin
Writeln(' We Found Color!'):
End;
You can also make other functions but you will learn they are very easy as you move along. If you don't understand how to make them now then dnt try it now. You will understand eventually.
Maintaining And Developing A Script
I DID TAKE THIS FROM MY OTHER TUTORIAL FOUND HERE
http://www.villavu.com/forum/showthread.php?t=6300
How To Organize and Develop A SRL/Scar Based Script Through Neatness To Get it Done Faster/ Better
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index
I. Getting Started
II. Using Basic Tools
III. Scripting Standards
IV. Making An Outline
V. Orgranizing The MainLoop
VI. Publishing A Script
VII. Conculsion
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chapter One Getting Started
Ok, Youre probably reading this tutorial because your scripting is messy, you have trouble finding things, or your just plain bored. This tutorial will go into an explainaton on how I like to keep my scripts organized / make an outline so I don't forget things, don't loose things, etc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chapter Two Using Basic Tools
Well For this Tutorial all you really need are 4 things.
- A Computer -
- Notepad(Or any other writing Program -
- Scar -
- Knowledge Of Scripting -
I am going to go ahead and get you to do the follow things
- Create A folder on the desktops named " My Scripts " or something similar to that -
- Open Up Scar -
- Open Up Your Writing Program -
My Example Will Be A PowerChopper
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chapter Three Scripting Standards
Well Scripting Standards are the way us scripters keep our scripting
LOOK AT THE BOTTOM OF THE PAGE FOR A STANDARDIZER GOTTEN FROM HEY321 or
~~~~~~~~~~~~~~~~~~~~~~~~
http://www.villavu.com/forum/showthread.php?t=5195?t=6042
http://www.villavu.com/forum/showthread.php?t=3293?t=3997
http://www.villavu.com/forum/showthread.php?t=4676?t=5496
^^^^^^^^^^^^^^^^^^^^^
Go To These Tutorials If you don't understand Scripting Standards. Some scripters have their own standards that they create. In my opinion, if its neat, its good enough for me.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chapter Four Making An Outline
Ok well this is where we really start the tutorial. So you have everything ready and you understand scripting standards. To start your outline, you need to know what you want to make. So at the top of your writing program, put your title/idea in Bold.
http://img141.imageshack.us/img141/430/examplezn4.png (http://imageshack.us)
After that, Make your basic Outline. This FORCES you to know what you want to do with the script
http://img339.imageshack.us/img339/7579/examplest5.png (http://imageshack.us)
** NOTE ** notice how I use " * " to make personal notes for myself
This Tells you Exactly What to do with the Script. Now, You begin a detailed version of Your outline. Like So
http://img337.imageshack.us/img337/8262/exampleqs2.png (http://imageshack.us)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Red Dots = I like To put special Symbols when indicating a custom procedure
Black Line = See How I fill in the X when its done?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chapter Five Organizing The Mainloop
Now you have to Organize your mainloop. I don't really know how to explain this as each scripter has his/her own style but, this is how I would organize mine.
http://img147.imageshack.us/img147/2947/doijb3.png (http://imageshack.us)
Intermediate
DTMS
Ok Well I Love DTMs. They Are a Scripters Best Friend. They are very easy to make and almost infalliable. To get to the DTM Maker, Do these steps.
Select RS Window
Go to Tools --> DTM Editor...
THE KEY!! ONLY MOVE THE MOUSE OVER THE OUTLINE COLOR 65336!! THIS IS WHAT IS CALLED A STATIC COLOR. IT DOES NOT CHANGE!!!
Now every point you click in the picture is recorded. A DTM(Deformable Template Module) checks for colors and their distances between them. But colors change in rs. Thats why you only choose the color 65336. Here is a picture of a Basic DTM Being Made.
Make The DTM, (See all the colors in the top right? they are all 65336).
http://img187.imageshack.us/img187/8805/dtmwu4.png (http://imageshack.us)
Go To File --> Save
Save It Where You can find it and let it have a good name.
then go to
Test --> FindDTM
at the top of you screen(its a drop down menu)
Go to your DTM.
If it doesnt find your DTM, then make a new one , else great job!
Now go to File, DTMToText and close the screen. The DTM Will be in the DebugBox.
[LEFT]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MAIN SRL RELATED FUNCTIONS
FindDTM(DTM, x,y, x1, y1, x2, y2) // Finds A DTM in the Specified params. records Position at the vars you specify.
FindDtmIn(var FX, FY: Integer; DTM, X1, Y1, X2, Y2: Integer) // Basically Same thing as above.
//To Click A DTM just say something like
If(FindDTMIn(x,y,(DTM Name Here),X1, Y1, X2, Y2)) then
begin
Mouse(x,y,0,0,true);
end;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BitMaps
BitMaps Are also a highly effective way to find things. They are like a picture. Actually they are a picture. I personally think Bitmaps Are inaccurate and would rather use advanced color finding or DTM's but i will explain anyway.
Well All A BitMap Is, Is a picture So first we need to take a screen shot.
Press the Button "Print Screen". It should be somewhere directly above the arrow keys but maybe higher. This will take a screen Shot of the screen. Now. Go to Paint(or any other picture editing program) and go to Edit --> Paste.
Now Use the cropping tool to cut the image down to its lowest size.(Use The Magnifier if needed). Make The BackGround Black then save. Now open back up SCAR.
Go To Script --> PictureToStr
Now Click Open
Select Your File
Press OK
Now you have the BitMap String in your debug. State that in your script and you can use any BitMap Function for it.
Arrays
Ok now Arrays are basically a series of variables.
How to Declare them
If you know the length of the array, then you can say it like this.
var
ColorArray : array [0..5] of integer;
ExtArray : array [0..2] of extended;
BoolArray : Array [0..10] of boolean;
stringarray : array [5..8] of string;
If You don't(like if your adding colors as you go) then it should be stated like this
Var
ColorArray : array of integer;
Some functions for arrays:
GetArrayLength((ArrayName));
This will get the current length of the array.
SetArrayLength((ArrayName),ArrayLenght));
This is useful for updating arrays as you go. So an example of an updating array would be
procedure UpDateArray;
var
I : integer;
ColorArray : array of integer;
begin
If(FindColor(x,y,98347,1,1,100,100))then
begin
I := GetArrayLength(ColorArray);
SetArrayLength(ColorArray, I + 1);// I + 1 so it will be 1 higher than the
// previous array length.
Colorarray[I + 1] := GetColor(x,y);
end;
end;
RADIALWALKING
Ah yes, the all famous radialwalking. The enigma that most srl members do not understand. It will be explained fully and completely here.
Radialwalking is the best form of walking in my opinion. What Radiawalk Basically does is search for a color on the mini map. Now the MiniMap is a circle, no?. There are 360 degrees in an angle. What Radialwalk does is search
between the angles you specify for a color and picks the farthest color from the center. Now Lets Explain The Command and how it works by use of pictures...
RadialWalk(Color,StartRadial,EndRadial,Radius,ModX , ModY);
Ok Now
COLOR = The color your searching for.
StartRadial = The radius to start at.
EndRadial = The radius to end at.
Radius = How Many Pixels from the center?
ModX = random x
ModY = random y
http://img20.imageshack.us/img20/5126/radialwalk1rq6.png (http://imageshack.us)
Imagine this is the minimap. Those Are The Angles roughly that the mini map is composed of.
Now if you wanted to search for a white color from 0 to 90, you would make your radiawalk like this
RadialWalk( {WhiteColor} , 0, 90, 70, 0 , 0);
It would search the color in this area.
http://img178.imageshack.us/img178/7295/radialwalk1we4.png (http://imageshack.us)
starting from 0 to 90. Like so.
(SRY for the bad picture, I got it straight from YakMan's RadialWalker Aid.)
http://img88.imageshack.us/img88/328/radialwalk1uc0.png (http://imageshack.us)
If it finds the color White, it Will Click it and exit.
Using RadialRoadWalk is useful yet I prefer to do it like so :D
procedure ClickRoad;
var
tmpRoad : integer;
begin
tmpRoad := FindRoadColor;
RadialWalk(tmpRoad,~~~~~~);
end;
USING YAKMANS RADIWALK HELPER
HIGHLY SUGGESTED!!
It works amazingly. Here is kinda a mini tutorial on it.
While In SCAR, Go TO Open
Click on Includes in The " Main Menu " of SCAR(where you downloaded srl)
go to includes --> SRL --> scripts --> Yakman's RadialWalk Helper
Open it
Press Play
Make sure you are logged in to RS
Move The Window Over to The Side, Out Of the way of the minimap
Press "CAPTURE FROM CLIENT" on the right hand side
It Should Take A Picture Of The MiniMap
Now Move The Mouse Over the Mini Map TO The Starting Radial And Click Like so. The Line should stick there.
http://img237.imageshack.us/img237/4541/radialwalk2zp6.png (http://imageshack.us)
Only Use The "Radial" not "Radial2" unless you plan on over lapping(not really recommended).
Fill in the Boxes with Radius , Start Radius and End Radius and hit "Show Path". It Should show you how it will search. If you like it , hit "Stop" and hit "Print Procedure". Then Close the box.
Now Look in the debug Box. It has your command already made out!!
Advanced Procedures
Ok now Advanced Procedures are very useful in scripting. I Like to think of Advanced Procedures Having the folowing :
AntiBan
Undetectable
Higly Accurate
They Are Kind Of "Spur Of The Moment" Ideas. The folowing would be an example.
procedure findrock;
begin
If(FindColorSpiral(x,y,color,x1,y1,x2,y2))then
begin
If(FindColorSprial(x,y,color2,x+15, Y+15, x -15, y - 15))then
begin
Writeln('Found');
end;
end;
end;
EDIT:
Ok Well Many People do not understand this so let me go through this procedure where you can. Ok, When you call the first FindColor Spiral,it stores the position of the color at x,y correct?. Well when you call the second FindColorSpiral, the box it creates wil be with 15 pixels of the first color found. Hopefully that will clear things up for you ;).
Basically What this will do is find a color on th main screen. If it finds the second color within a box of the first color, it will write found see?. Base commands on other commands results as so and add failsafes and your good to go. :)
Making Your Own Functions
Well Making your own functions is what intermediate-advanced scripters do.
To Make the functions you want, you need to understand the 4 types of vars. Now Lets say you wanted to make an AxeHead Finder. You would make an outline (Maintaining and Developing a script Above). And get at it. I would suggest using DTMs Or advanced procedures(above) to get a Axe Head Finder Done. Take into consideration all things that happen durring runtime of the procedure. For instance, The Axe Head often lands under the white dots of people on the minimap, and is usually covered by a person. So if it doesnt find it on the first try, make sure it radialwalks (or any other form of minimap walking) to a white dot.
[CENTER]
ADVANCED
YEAH, These are gunna make your head hurt unless your good :D
Some Components
Well As You Probably Know, Many Components/Classes were imported from Delphi.
These are listed in the SCAR manual. Here are some basic definitions.
TGroupBox - The TGroupBox component represents a standard group box, used to group related controls on a form.
TLabel - Use TLabel to add text or a bitmap that the user can’t edit to a form.
TEdit - Use a TEdit object to put a standard edit control on a form.
TMemo - Use TMemo to put a standard multiline edit control on a form.
TComboBox - A TComboBox component is an edit box with a scrollable drop-down list attached to it.
TButton - Use TButton to put a standard push button on a form.
TCheckBox - A TCheckBox component presents an option for the user.
TRadioButton - Use TRadioButton to add a radio button to a form.
TListBox - Use TListBox to display a scrollable list of items that users can select, add, or delete.
TScrollBar - Use TScrollBar to add a free-standing scroll bar to a form.
TImage - Use TImage to display a graphical image on a form.
TPanel - Use TPanel to put an empty panel on a form.
TTimer - TTimer is used to simplify calling the system timer functions.
TForm - form (window) component.
TApplication - TApplication encapsulates a windowed application.
TMenuItem - Use TMenuItem to specify the appearance and behavior of an item in a menu.
TMenu - Use TMenu as a base class when defining a component that represents a collection of menu items.
TMainMenu - Use TMainMenu to provide the main menu for a form.
TPopupMenu - Use TPopupMenu to define the pop-up menu that appears when the user clicks on a control with the right mouse button.
TCanvas - Use TCanvas as a drawing surface for objects that draw an image of themselves.
Now that is straight from the SCAR Manual. Some Of these components Uses will be listed here:
TGroupBox - Used In Forms, Used To Organize
TLabel - Form Component that the user cant edit.
TImage - In My Opinion, the best Picture Component For Forms.
TRadioButton - Radio Button
TCheckBox - Check Box
TButton - a button
TCanvas - Obviously The Canvas of the Forms.
Again that was a very simple list. Now The main reason i made this section was to Discuss the TPoint component so from here on out, thats what its gunna do. TPoint Is Basically, in simple terms, a collective var type that has 2 SubVars. X and Y.
Example Using These:
procedure GetPos;
var
MyPoint : TPoint;
xx, yy : integer;
begin
GetMouse(xx,yy);
MyPoint.X := xx;
MyPoint.Y := yy;
end;
All that procedure does is store the Position of X and Y to the TPoint. I Used TPoint quite alot in my UberAlcher(not finished yet). There is also TPointArray Which Is Good For Storing Positions.
procedure MakeATPointArray;
var
ThePoints : TPointArray;
XX : integer;
YY : integer;
I : extended;
begin
I := -1;
GetMousePos(XX,YY);
repeat
XX := XX + 1;
YY := YY + 1;
I :+ I + 1;
SetArrayLength(ThePoints, I)l
ThePoints[I].X := XX;
ThePoints[I].Y := YY;
until(i = 25);
end;
That procedure doesnt really do anything useful just an example :D
Making Custom Var Types
Well As Seen Above, TPoint is a var type. But did you know you can create your own? This is what the player array is composed of. To declare a new var type, Just add it before your first procedure in script. "Type" is the word used to declare a new var type. The Example should explain everything.
THIS WAS TAKEN FROM MY UBER ALCHER
Type
AntiBannage = record
TalkingRatio : integer;
MovingRatio : integer;
MisClickRatio : integer;
StatsBoxRatio : integer;
end;
and i used it in this way.
procedure AntiBanLand;
var
AntiBanN : AntiBannage;
begin
ABR := 5;
//--------------------------
AntiBanN.TalkingRatio := 1 + random(ABR * 10);
AntiBanN.MovingRatio := 1 + random(ABR * 5);
AntiBanN.MisClickRatio := 1 + random(50);
//--------------------------
Case AntiBanN.TalkingRatio of
1 : begin
end;
end;
//--------------------------
Case AntiBanN.MovingRatio of
1 : begin
SleepAndMoveMouse(1500+random(3000));
ReportVars[1] := ReportVars[1] + 1;
end;
4 : begin
SleepAndMoveMouse(1000+random(2000));
ReportVars[1] := ReportVars[1] + 1;
end;
8 : begin
PickUpMouse;
ReportVars[1] := ReportVars[1] + 1;
end;
10 : begin
AlmostLogOut;
ReportVars[1] := ReportVars[1] + 1;
end;
end;
//--------------------------
Case AntiBanN.MisClickRatio of
1 : begin
GameTab(6);
GameTab(7);
ReportVars[1] := ReportVars[1] + 1;
end;
end;
//--------------------------
HoverEvery(15 + random(10),'Magic');
end;
That is for antiban. Anyways This is a very easy thing to do, I just thought I may want to put it under Advanced because in my opinion, you really shouldn't use it unless you are advanced :D.
Forms
Ah Yes, Forms. They are quite an enigma for even an the best of scripters. But they are actually quite simple. I think that the form creator is a great tool for creating for but only for the basic structure. I have edited a form that greatly exceeds the form makers abilities because the formmaker does not include all form components. However, I will be discussing how to manually create a form and how to create one via form maker.
STANDARD FORM PROCEDURES
Ok well lets go ahead and get this out of the way. These are always to be put after your main InIt procedure.
procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;
procedure ShowFormModal;
begin
frmDesign.ShowModal;
end;
procedure SafeShowFormModal;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;
USING FORM EDITOR
Well The Form Editor Leaves out Many Components But here it is anyway.
To Get To The Form Editor :
Open SCAR
Go To Tools --> FormEditor...
Now You Should Get 3 Boxes.(frmDesign),(frmDesigner),(Object Inspector).
Ok Now In the Forum Designer, You can choose from a variety of options.
These Are Not Hard. All you do it click the button on the frm Designer and then click where you want it on the frm Design. (You can edit the size of the form but adjusting the frm Design window. If you can't do this very simple thing of designing a basic form, see other tuts about it and come back. This only goes into detail, explaining how forms work.
Now This Is my Example Form;
frmDesign := CreateForm;
frmDesign.Left := 250;
frmDesign.Top := 114;
frmDesign.Width := 696;
frmDesign.Height := 480;
frmDesign.Caption := 'frmDesign';
frmDesign.Color := clBtnFace;
frmDesign.Font.Color := clWindowText;
frmDesign.Font.Height := -11;
frmDesign.Font.Name := 'MS Sans Serif';
frmDesign.Font.Style := [];
frmDesign.Visible := True;
frmDesign.PixelsPerInch := 96;
Label1 := TLabel.Create(frmDesign);
Label1.Parent := frmDesign;
Label1.Left := 498;
Label1.Top := 278;
Label1.Width := 32;
Label1.Height := 13;
Label1.Caption := 'Label1';
Button1 := TButton.Create(frmDesign);
Button1.Parent := frmDesign;
Button1.Left := 296;
Button1.Top := 189;
Button1.Width := 75;
Button1.Height := 25;
Button1.Caption := 'Button1';
Button1.TabOrder := 8;
CheckBox1 := TCheckBox.Create(frmDesign);
CheckBox1.Parent := frmDesign;
CheckBox1.Left := 48;
CheckBox1.Top := 46;
CheckBox1.Width := 97;
CheckBox1.Height := 17;
CheckBox1.Caption := 'CheckBox1';
CheckBox1.TabOrder := 9;
GroupBox1 := TGroupBox.Create(frmDesign);
GroupBox1.Parent := frmDesign;
GroupBox1.Left := 34;
GroupBox1.Top := 215;
GroupBox1.Width := 185;
GroupBox1.Height := 105;
GroupBox1.Caption := 'GroupBox1';
GroupBox1.TabOrder := 10;
Memo1 := TMemo.Create(frmDesign);
Memo1.Parent := frmDesign;
Memo1.Left := 323;
Memo1.Top := 44;
Memo1.Width := 185;
Memo1.Height := 89;
Memo1.Lines.Add('Memo1');
Memo1.TabOrder := 11;
Not Anything Special, Just has many components Form Creator gives you.
Now, Lets just break down one form add-in.
Memo1 := TMemo.Create(frmDesign);
Memo1.Parent := frmDesign;
Memo1.Left := 323;
Memo1.Top := 44;
Memo1.Width := 185;
Memo1.Height := 89;
Memo1.Lines.Add('Memo1');
Memo1.TabOrder := 11;
Ok Now the first line.
Memo1 := TMemo.Create(frmDesign);
Creates A TMemo called Memo1 in (frmDesign).<-- frmDesign is the default name of you form.
The Second Line,
Memo1.Parent := frmDesign;
Tells SCAR that Memo1 will be placed in frmDesign(in other words, no in a group box, etc).
Lines 3-7
Memo1.Left := 323;
Memo1.Top := 44;
Memo1.Width := 185;
Memo1.Height := 89;
Tell Scar the Parameters For Memo1
Line 8
Memo1.Lines.Add('Memo1');
Is Specific Command For a TMemo. All Components have their own commands because thats what makes them different components.
What I like to do when editing my form manually is split up the sections so here is my example .
frmDesign := CreateForm;
frmDesign.Left := 250;
frmDesign.Top := 114;
frmDesign.Width := 696;
frmDesign.Height := 480;
frmDesign.Caption := 'frmDesign';
frmDesign.Color := clBtnFace;
frmDesign.Font.Color := clWindowText;
frmDesign.Font.Height := -11;
frmDesign.Font.Name := 'MS Sans Serif';
frmDesign.Font.Style := [];
frmDesign.Visible := True;
frmDesign.PixelsPerInch := 96;
//------------------
Label1 := TLabel.Create(frmDesign);
Label1.Parent := frmDesign;
Label1.Left := 498;
Label1.Top := 278;
Label1.Width := 32;
Label1.Height := 13;
Label1.Caption := 'Label1';
//------------------
Button1 := TButton.Create(frmDesign);
Button1.Parent := frmDesign;
Button1.Left := 296;
Button1.Top := 189;
Button1.Width := 75;
Button1.Height := 25;
Button1.Caption := 'Button1';
Button1.TabOrder := 8;
//------------------
CheckBox1 := TCheckBox.Create(frmDesign);
CheckBox1.Parent := frmDesign;
CheckBox1.Left := 48;
CheckBox1.Top := 46;
CheckBox1.Width := 97;
CheckBox1.Height := 17;
CheckBox1.Caption := 'CheckBox1';
CheckBox1.TabOrder := 9;
//------------------
GroupBox1 := TGroupBox.Create(frmDesign);
GroupBox1.Parent := frmDesign;
GroupBox1.Left := 34;
GroupBox1.Top := 215;
GroupBox1.Width := 185;
GroupBox1.Height := 105;
GroupBox1.Caption := 'GroupBox1';
GroupBox1.TabOrder := 10;
//------------------
Memo1 := TMemo.Create(frmDesign);
Memo1.Parent := frmDesign;
Memo1.Left := 323;
Memo1.Top := 44;
Memo1.Width := 185;
Memo1.Height := 89;
Memo1.Lines.Add('Memo1');
Memo1.TabOrder := 11;