pwnaz0r
11-21-2007, 08:59 PM
SCAR Method
While scripting in any computer language, problems will arise. This holds especially true while scripting in SCAR, as Runescape has made it extremely difficult to solve things such as the various randoms, the Mainscreen shifting, and the minimap being offset a little bit. These are not only annoying but could be the factor that halts your progress on that script you were working on! Few problems arise that cannot be solved. Since so many scripters struggle with this, I have devised the SCAR Method, or simple steps you can take to solve any/all problems that can arise in SCAR. Please note that it will take time to solve certain difficult problems :).
The Actual SCAR Method
Understand Your Problem
To start out, state your problem. Think about what it will take to solve this problem. Here are a few things you can consider.
Will it take speed?
Will it take accuracy?
Should there be failsafes?
About how long should it take?
of course, there are many more, but you need to understand you problem. For instance, let's say you are a computer manufacturer. You would need to know what your customer wants before you start to build his/her computer right? Else your customer will not be satisfied, same holds true with SCAR.
The Logic Behind the SCAR Method
This was based off the Scientific Method. It requires thinking, collecting data, expierementing, and starting over again. The following is the the key line to solving all problems:
If a human can do it, so can SCAR
Think of it logically, how does the human solve it. The way the human solves it will not only give you the most accurate results, but isn't it also fitting that it will be the most humanlike, thus the least detectable?
Let me prove my point a little more, since some are skeptic. What can SCAR not do? Three things(at least):
It cannot think for itself (use logic, adjust to problems).
It cannot make its own decisions.
It cannot adjust to different problems.
Lets list some of the things it can do better than a human
Faster math.
More accurate Colorfinding.
Quicker than average human
Let me string these together in one sentence.
SCAR can do almost everything faster than a human and is more accurate in most things, such as moving a mouse to a position or finding a color with exact tolerance. However, it needs a human's logic to solve. That is the purpose of scripting overall, you are giving a program human logic and reason, thus double both of your abilities. This tutorial is designed to teach you how to effectively tell SCAR how to do things and why. This is what sets the greatest scripters apart from the average scripters.
If you don't think this is right, then your are only decreasing your chances at solving a problem. The so called "Unsolvable Randoms" can be solved, it only takes time and effort.
Step One - Research the problem
Research is your best friend while solving problems. Identify characteristics that will help you solve the problem, such as differences in objects, color schemes, the best ColroSpace to use with your problem (HSL, CMYK, RGB, HSV, etc.), what the enviroment is like around your problem, etc. Also, be sure to note how a human solves your problem, and include this in your research.
I highly recommend you write this information down somewhere, most likely on forums, where you can recieve feedback from other members as well as have your research at your fingertips.
If you have already researched this and this is your second go around at this, then conduct what is called counter research. Counter research is going down your list of facts and asking the following questions:
How often is this held true(constant)?
Is it benefitial to solving my problem? If not, could it be?
Ask yourself what would happen if that did not hold true. Would you have a different way to do it?
After asking yourself these questions, research the same thing and see if you come up with the same results.
Step Two - Develop A Hypothesis
for those who don't have good english, a Hypothesis is simply an idea of how to solve a problem. It is not necessarily right, just an idea. Again, base this off your research. This is the step where you have to think.
It could or could not work. Try to be as logical as you can. Make an accurate function, as accurate as you can get it. Start very specific with your variables, then widen out as they return false (here is an example):
Say you are trying to make a perfect Iron Ore finder. You have collected Iron Ore colors from each world and their max tolerance ranges. Start accurate with your variable, which in this case would be your tolerance. Test your function while switching worlds, and as they return false, widen the tolerance, until you can find a tolerance that finds it in every world. If you happen to find that tolerance / color, you have solved your problem, no? If not, you will have to do it a different way.
To develop this procedure, you will need to take a further on in this tutorial about some of your options.
Step Three - Test your Procedure(s)
This stage is also crucial to solving problems. You need to know exactly what is wrong with the procedure you have made, so not to make that mistake again. It may take a while, but it will be worth it. If you do not know how to find problems with your script, then please see the section further on in the tutorial about debugging your procedure :).
Once you have figured out what is wrong with your procedure, ask your self how it can be fixed? Why did you think it would work when you first made this procedure? Remember, the key to solving problems in SCAR is understanding.
Step Four - Forming Conclusions
Last but not least, you will need to form a conclusion on how to do what you did wrong, right (:)). I will discuss tips below on how to do this effectively :D.
Using the SCAR Method effectively
Think before you act
One of the keys to using the SCAR method is you must think that you can do it before you can do it. I could develop a paragraph telling you why you must do this using pschology and logic, but that is for another day perhaps. Simply, you have to build your self up before you *touch the sky* (wow I made that up myself :D).
Under Construction, no posting.
Repitition is the key to learning
This is what one of my teachers used to tell me. Sometimes you must repeat the SCAR method over and over before you find a solution. This is how it was designed to work, and thus how you should apply it :D
Keys to Solving Problems
This is probably the section that will be most benefitial to you as a scripter. It will go in depth on the functions you can use and their speeds, discussing different angles to look at things and how to do some things you may not have known :D.
Stacking
I don't know what others might call it, but I refer to it as stacking. I like to think that I gave it a name and actually identified it as a method of scripting, but I am probably wrong. If I am, don't rain on my parade (:)).
Stacking is simply using if-then statements to make a more accurate finder. In stacking, you do not use the and statement, for it will defeat the purpose of it. Stacking was designed to break out when something is not found. In an and statement, SCAR searches all of them, and the boolean result is based on if all returned true.
For instance this would be wrong:
if(FindBlue) and (FindRed) and (FindGreen) and (FindYellow)then
a better way to do this would be:
if(FindBlue)then
if(FindRed)then
if(FindGreen)then
if(FindYellow)then
because that loop will break if one is not found, thus saving the time that it takes to search them all.
If you know exactly where a DTM will be (like, say in the first slot of your inventory), you can use this method to make a "stationary" DTM, although I do not think it would be benefitial to make a "DTM Finder" out of this.
Now I will List some of the qualities of things for you.
DTMS
Fairly Fast
Lagg Client if used too often.
Accuracy depends on points selected
Bitmaps
Slow
Lagg Client if used too often.
Must be 100% accurate(unless using BitmapDeformed, not reccomended)
Bitmap Masks
Medium fast
Lagg Client if used too often.
Almost 100% accurate. Good for stationary objects in inventory.
FindColors
Fast (with scanlines)
Least lag of all when used often.
Accuracy depends on if color is found.
Dont forget counting!
Countcolor and CountColorTolerance are two of the greatest things you can use in SCAR. When all else fails, try pixel counting!
I hope you have enjoyed my tutorial. Best of luck solving all problems,
Pwnaz0r
While scripting in any computer language, problems will arise. This holds especially true while scripting in SCAR, as Runescape has made it extremely difficult to solve things such as the various randoms, the Mainscreen shifting, and the minimap being offset a little bit. These are not only annoying but could be the factor that halts your progress on that script you were working on! Few problems arise that cannot be solved. Since so many scripters struggle with this, I have devised the SCAR Method, or simple steps you can take to solve any/all problems that can arise in SCAR. Please note that it will take time to solve certain difficult problems :).
The Actual SCAR Method
Understand Your Problem
To start out, state your problem. Think about what it will take to solve this problem. Here are a few things you can consider.
Will it take speed?
Will it take accuracy?
Should there be failsafes?
About how long should it take?
of course, there are many more, but you need to understand you problem. For instance, let's say you are a computer manufacturer. You would need to know what your customer wants before you start to build his/her computer right? Else your customer will not be satisfied, same holds true with SCAR.
The Logic Behind the SCAR Method
This was based off the Scientific Method. It requires thinking, collecting data, expierementing, and starting over again. The following is the the key line to solving all problems:
If a human can do it, so can SCAR
Think of it logically, how does the human solve it. The way the human solves it will not only give you the most accurate results, but isn't it also fitting that it will be the most humanlike, thus the least detectable?
Let me prove my point a little more, since some are skeptic. What can SCAR not do? Three things(at least):
It cannot think for itself (use logic, adjust to problems).
It cannot make its own decisions.
It cannot adjust to different problems.
Lets list some of the things it can do better than a human
Faster math.
More accurate Colorfinding.
Quicker than average human
Let me string these together in one sentence.
SCAR can do almost everything faster than a human and is more accurate in most things, such as moving a mouse to a position or finding a color with exact tolerance. However, it needs a human's logic to solve. That is the purpose of scripting overall, you are giving a program human logic and reason, thus double both of your abilities. This tutorial is designed to teach you how to effectively tell SCAR how to do things and why. This is what sets the greatest scripters apart from the average scripters.
If you don't think this is right, then your are only decreasing your chances at solving a problem. The so called "Unsolvable Randoms" can be solved, it only takes time and effort.
Step One - Research the problem
Research is your best friend while solving problems. Identify characteristics that will help you solve the problem, such as differences in objects, color schemes, the best ColroSpace to use with your problem (HSL, CMYK, RGB, HSV, etc.), what the enviroment is like around your problem, etc. Also, be sure to note how a human solves your problem, and include this in your research.
I highly recommend you write this information down somewhere, most likely on forums, where you can recieve feedback from other members as well as have your research at your fingertips.
If you have already researched this and this is your second go around at this, then conduct what is called counter research. Counter research is going down your list of facts and asking the following questions:
How often is this held true(constant)?
Is it benefitial to solving my problem? If not, could it be?
Ask yourself what would happen if that did not hold true. Would you have a different way to do it?
After asking yourself these questions, research the same thing and see if you come up with the same results.
Step Two - Develop A Hypothesis
for those who don't have good english, a Hypothesis is simply an idea of how to solve a problem. It is not necessarily right, just an idea. Again, base this off your research. This is the step where you have to think.
It could or could not work. Try to be as logical as you can. Make an accurate function, as accurate as you can get it. Start very specific with your variables, then widen out as they return false (here is an example):
Say you are trying to make a perfect Iron Ore finder. You have collected Iron Ore colors from each world and their max tolerance ranges. Start accurate with your variable, which in this case would be your tolerance. Test your function while switching worlds, and as they return false, widen the tolerance, until you can find a tolerance that finds it in every world. If you happen to find that tolerance / color, you have solved your problem, no? If not, you will have to do it a different way.
To develop this procedure, you will need to take a further on in this tutorial about some of your options.
Step Three - Test your Procedure(s)
This stage is also crucial to solving problems. You need to know exactly what is wrong with the procedure you have made, so not to make that mistake again. It may take a while, but it will be worth it. If you do not know how to find problems with your script, then please see the section further on in the tutorial about debugging your procedure :).
Once you have figured out what is wrong with your procedure, ask your self how it can be fixed? Why did you think it would work when you first made this procedure? Remember, the key to solving problems in SCAR is understanding.
Step Four - Forming Conclusions
Last but not least, you will need to form a conclusion on how to do what you did wrong, right (:)). I will discuss tips below on how to do this effectively :D.
Using the SCAR Method effectively
Think before you act
One of the keys to using the SCAR method is you must think that you can do it before you can do it. I could develop a paragraph telling you why you must do this using pschology and logic, but that is for another day perhaps. Simply, you have to build your self up before you *touch the sky* (wow I made that up myself :D).
Under Construction, no posting.
Repitition is the key to learning
This is what one of my teachers used to tell me. Sometimes you must repeat the SCAR method over and over before you find a solution. This is how it was designed to work, and thus how you should apply it :D
Keys to Solving Problems
This is probably the section that will be most benefitial to you as a scripter. It will go in depth on the functions you can use and their speeds, discussing different angles to look at things and how to do some things you may not have known :D.
Stacking
I don't know what others might call it, but I refer to it as stacking. I like to think that I gave it a name and actually identified it as a method of scripting, but I am probably wrong. If I am, don't rain on my parade (:)).
Stacking is simply using if-then statements to make a more accurate finder. In stacking, you do not use the and statement, for it will defeat the purpose of it. Stacking was designed to break out when something is not found. In an and statement, SCAR searches all of them, and the boolean result is based on if all returned true.
For instance this would be wrong:
if(FindBlue) and (FindRed) and (FindGreen) and (FindYellow)then
a better way to do this would be:
if(FindBlue)then
if(FindRed)then
if(FindGreen)then
if(FindYellow)then
because that loop will break if one is not found, thus saving the time that it takes to search them all.
If you know exactly where a DTM will be (like, say in the first slot of your inventory), you can use this method to make a "stationary" DTM, although I do not think it would be benefitial to make a "DTM Finder" out of this.
Now I will List some of the qualities of things for you.
DTMS
Fairly Fast
Lagg Client if used too often.
Accuracy depends on points selected
Bitmaps
Slow
Lagg Client if used too often.
Must be 100% accurate(unless using BitmapDeformed, not reccomended)
Bitmap Masks
Medium fast
Lagg Client if used too often.
Almost 100% accurate. Good for stationary objects in inventory.
FindColors
Fast (with scanlines)
Least lag of all when used often.
Accuracy depends on if color is found.
Dont forget counting!
Countcolor and CountColorTolerance are two of the greatest things you can use in SCAR. When all else fails, try pixel counting!
I hope you have enjoyed my tutorial. Best of luck solving all problems,
Pwnaz0r