PDA

View Full Version : SCAR Method



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

R0b0t1
11-21-2007, 09:28 PM
But the way a human may solve it, SCAR can not.


Anyway, nice thing you've made for those learning.

pwnaz0r
11-21-2007, 09:47 PM
I updated that section to prove my point, which I was going to do. Thus the


Under Construction, no posting

...

Sp0rky
11-21-2007, 10:35 PM
Very nice, extremely logical thinking. Similar to that of Scar's :p

Great thread for learners. Gj.

Dan Cardin
11-21-2007, 10:47 PM
ur tut = l33t(:D ), but it didnt hurt my brain:p...i still have a headache from the first 1the other 1 meaning the mouse tut :p

and u said that my brain would hurt from the other 2 :mad: (other 2 meaning this 1)
---------------------------------------------------------------------------------------------------------------------

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.

so 4 booleans are btter than 1:)

mastaraymond
11-21-2007, 10:52 PM
the other 1 meaning the mouse tut :p

and u said that my brain would hurt from the other 2 :mad: (other 2 meaning this 1)
---------------------------------------------------------------------------------------------------------------------
No its not about the amount of booleans, but its about the speed.
When you use a 'and and and and and' statement, it will go trough all these booleans, but if you do a 'if then if then if then' it will break out if it finds a boolean thats false, which sometimes increases the speed a lot, because it doesn't have to check them all.

Dan Cardin
11-22-2007, 12:07 AM
it was supposed to be a joke :(

pwnaz0r
11-22-2007, 12:34 AM
lol, well time to get on to my next tut.

bullzeye95
11-22-2007, 05:54 AM
it was supposed to be a joke :(

Don't you know, there's joke tags now?

I ask myself "how important is speed vs. accuracy" a lot.

the scar noob
11-22-2007, 12:04 PM
Don't you know, there's joke tags now?

I ask myself "how important is speed vs. accuracy" a lot.

That would be an endless discussion :rolleyes:

However, pwnaz0r, thanks for the tut mate, it seems that you're in a
'tut writing' phase?:)

You all should be very honestly (*cough* sporky *cough*), we actually can all learn from this, did you all write everything down and do every step pwnaz0r just explained to do?
I don't think so, not as depth as he's doing it;)

I will certainly print this tut out (along with the mouse "making" one:p).

Regards,

-Tsn.

Bobarkinator
11-24-2007, 04:22 AM
You told me you were developing this, good work.

pwnaz0r
11-30-2007, 10:10 PM
Um why don't I just talk to you on MSN about it.