I am extremely happy and proud to present the SmartColors.simba include. This is an Artificial Inteligence object finding method
, but no need to be scared, as it is extremely simple to use. For basic use, you only need to worry about 2 functions:
procedure MakeObj(MyName: string; MyColor, MyTol: integer; MyHue, MySat: extended; MyUpTexts, MyOptions: TStringArray);
function SmartColors(FindWhat: string): boolean;
All you need to do is call MakeObj
once before calling SmartColors
, (I'd suggest at the start of the script) and then you just call SmartColors whenever you want to find something.
Here is how I used it:
MakeObj('tree', 4689280, 9, 0.05, 0.74, ['n Tr', 'ree', 'hop', 'own'], ['hop down']);
The name you give the object is the name you have to call.
SmartColors finds and
clicks the tree.
Long story made short, a couple of years ago Tarajunky made a post about a new system he called SmartColors. It got me very interested and I learnt it straight from him and his ChickenKiller. I then developed a SmartColors function which never got into SRL, but still worked fairly well and I used it in the first version of RM Chopper. I then made a few threads about it and it caught EvilChicken's attention. EC then used his own version in his agility script. Since then, we've often enough attempted to develop a propper include for SRL with SmartColors. Here it finally is.
The SmartColors 'Algorithm'
SmartColors, as the name suggests, is smart and therefore learns and becomes better the more often it is called. The first time it is called, it will do a normal TPA finding and it will gather colors which are similar and close to the color you provided it with.
It will then scan the MainScreen to see how unique these colors are. If they are rare enough, it will add them to an array of colors.
Once added to this array of colors, it chooses the rarest of them to pass it on to a final array. You now have your SCArray ready (SmartColorsArray).
Being done with picking all the best colors, you will now see the big difference between this system and previous ones. You will search for one color at a time from the SCArray with no tolerance. Usually, searching for even just the first color with 0 tol will be enough to find your object, making search times as low as 0 ms.
If it does not find your object without tolerance, it will then go through all the colors again, this time with tolerance. This rarely happens.
The speed is a big factor, but even more than that, SmartColors updates the SCArray as it runs; When it finds your object by a certain color, it will move that color up in the SCArray, meaning that next time it will search with this color sooner. What this means is that the best colors will eventually be the first ones to be searched for.
And finally, when searching with tolerance and it finds the object, it analyses the new color, and if the color is unique enough and within tolerance range it will add it to the SCArray, meaning that SmartColors also learns about new colors to use.
Advanced Use of SmartColors
SmartColors if not setup will use the default SC_ constants values, however, you can set these up yourself if you wish.
Description: Extra Object details; Can set them up or leave it to default values }
TSCDetails = record
IsSCSetup : boolean; //do not touch, let SC know if you are using custom or default values
UNIQUE_COLOR_MIN : integer; //the mininum amount of color for it to join the SC array
UNIQUE_COLOR_MAX : integer; //same as above for maximum
MAX_COLORS_IN_ARRAY : integer; //max length of SC Array
HALF_BOX_SIZE : integer; //half box size of object you are searching
USE_TOL : integer; //tolerance for your object
TPA_DIST : integer; //max distanc between points
CLICK_STYLE : integer; //how to click your object. Check consts
RANDOM_RL_CHANCE : integer; // x/100 to do R Click instead of L click
It is extremely simple to set them up as all you have to do is call one single function:
procedure SetupSmartColorsDetails(Name: string; ColorMin, ColorMax, MaxColors, BoxSize, Tol, Dist, ClickStyle, R_RL_Chance: integer);
And here are the default values:
SC_UNIQUE_COLOR_MIN = 5;
SC_UNIQUE_COLOR_MAX = 20;
SC_MAX_COLORS_IN_ARRAY = 7;
SC_HALF_BOX_SIZE = 25;
SC_USE_TOL = 5;
SC_TPA_DIST = 5;
SC_CLICK_STYLE = 3;
SC_RANDOM_RL_CHANCE = 20; // x / 100 for R click
So finally, for an advanced use of SmartColors here is your code:
MakeObj('clay', 5215677, 17, 0.01, 1.01, ['ine', 'ock'], ['ine']);
SetupSmartColorsDetails('clay', 3, 15, 7, 15, 5, 5, 3, 15);
And so, I hope to see people using this new system as it is extremely fast, accurate and very easy to use.
Lots o' Love,
The Dev Team