View Full Version : A Brief Tutorial On FindObjCustom

11-03-2007, 11:50 PM
A brief tutorial on FindObjCustom.

Hello everyone, and welcome to my brief tutorial on FindObjCustom. Today, I will be teaching you the simplest, and maybe most effective, way to find objects in Runescape. Lets start off by looking at the function.

Function FindObjCustom(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; Tolerance: Integer): Boolean;

Now don't get scared off by all the arguments - its actually quite simple when you learn to use it.

var cx, cy: Integer;

cx and cy are where the coordinates of the object are going to be stored - if you don't know why we need to store the coordinates, I suggest you read some other tutorials first ;)

Text: TStringArray;

When we are looking for an object using FindObjCustom, we use the uptext to check if that is actually the correct object that we were looking for, or just another object that has similar colors.

Color: TIntegerArray;

This is probably the most important argument when we are calling FindObjCustom - these are the colors that FindObjCustom will be looking for. When picking colors, try to pick colors that are unique to that object.

Tolerance: Integer

This is the tolerance that FindObjCustom will use when looking for colors. What do we mean by tolerance? If we were looking for a set of colors, and we had set tolerance to 0, then we would look for the exact colors. We wouldn't search for colors that were very similar, they would need to be exact. But why is this bad? I don't want to delve into a history lesson on Runescape here, but one of the mechanisms that they implemented was to shift the colors in Runescape around every so slightly, every time you log in. Which means that looking for the exact colors is a very bad thing to do.

Most scripters here use a tolerance of around 3, which is high enough to allow for color shifting, but low enough to search for unique colors.

: Boolean;

All this means that if we found the object, the function returns true. Otherwise it will return false. This is actually very important, as I will explain later.

But how do we use it?
First of all, log into Runescape. Then using the color picker tool in SCAR, pick a number of colors (around 4 or 5) of the object that you are looking for - try to make these colors specific to the object. This is what I came up with:
// ||
Color Picked: 8053399 at (138, 88)
Color Picked: 7657355 at (135, 91)
Color Picked: 7660183 at (138, 89)
Color Picked: 8450984 at (134, 84)

When you are picking the colors, note the uptext. If you don't know what the uptext is... then you probably shouldn't be reading this tutorial ;)

This was the uptext of my particular object - flax.

Pick Flax

Now we have everything we need to begin! First of all, we have to sort our colors into an array. For now, think of an array as a way to store lots of variables. When using arrays like this, you use comma delimited arrays. Using the colors that I picked, this is what I came up with.
See what I mean by comma delimited? Each color is separated by a comma, making it simple to write, and simple to read :)
Our next job is to make an array of uptext. But why do we need an array? Sometimes, the uptext of an object is hidden from view, or partially covered up. Using an array means that even if parts of the uptext is covered up (or not detected properly) hopefully we will find the uptext anyway. As I mentioned before, the uptext of my particular object was Pick Flax. So using this, I made an array of strings using that uptext. If you don't understand what I just said, just take a look here:

['Pick','ck Fl','k Fla','Flax']

Please be aware that uptext is case sensitive!

Now that we have done all of that, we are (finally :p ) ready to use our function to find an object in Runescape! For this, I'm going to create a simple script, and then tell you what each part does (although, hopefully you should already know.) Just look at the green parts and they will tell you what each part does.

program FindObjCustomDemo;
{.include SRL\SRL.scar}
var X, Y : Integer; //Here we are declaring the variables that will hold our coordinates - x and y.
SetupSRL; //Here we are setting up SRL (essential!)
ActivateClient; //Here we are switching to the Runescape window.
Wait(1000); //We wait 1000 milliseconds (or 1 second) just to make sure that we have switched
//to the runescape window.

//Now we are going to find our object. Remember the examples that I showed you (string array
//and integer array), and the tolerance. On the next line, we are saying that if we find the object
//that we were looking for, then we want to click on the object. So if we find flax, we want to click
//on it, or pick it :)
if (FindObjCustom(X, Y, ['Pick','ck Fl','k Fla','Flax'], [8053399,7657355,7660183,8450984], 3)) then
Mouse(X, Y, 0, 0, True);

And that concludes this tutorial. If you made it all the way to here, then congratulations! You are on your way to becoming a 1337 scripter! :p

11-04-2007, 12:12 AM
Nice Tut (even though I knew this).


11-05-2007, 01:03 AM
31 views 1 reply... :(

11-05-2007, 01:54 AM
looks like a pretty good tut. nice work ;)

11-05-2007, 09:53 PM
Thanks, this really helped!

11-06-2007, 10:02 PM
Thanks, this really helped!

I'm glad someone decided to post feedback. Thanks :)

11-09-2007, 11:35 PM

Thanks for this

11-09-2007, 11:52 PM
Rep! Thanks for this!

11-10-2007, 11:27 AM
ok ty

11-15-2007, 05:49 PM
Nice work, pretty neat tutorial. I will need to edit my script now... this works better fro some things than even the DTMs. :D

11-21-2007, 04:07 AM
Really useful tutorial. Instruction worded well. Great way to present this information. Thx

11-25-2007, 05:04 PM
Great tutorial, and I understand all of this, but I have one question. Why do you do the uptext like you did instead of just 'Pick Flax'?

EDIT: I have another question - does SRL look for the colors close to each other, or just one color? For example, in a chicken fighter that I am making, could I put the colors of different chickens or would this mess it up?

11-26-2007, 01:23 PM
like Pancakes said, we use uptest like this in case anything is covering it, its kinda just a bit more of a safety net so you player dosent end up gettin caught in a loop.

as for the chicken issue, i guess just putting a group of colors for the different chickens (maybe 10 or so?) should work. the way it works is basically if it finds one of the colors you tell it, AND, one of the text strings (pick flax in this case) then it will carry on.

hope this helps

12-12-2007, 08:11 PM
Does FindObjCustom choose a specific point on the object it finds (like the exact center). Is there a need then to add some randomness to the location it chooses?

So instead of "Mouse(X, Y, 0, 0, True);"
it would be something along the lines of "Mouse(X+random(2), Y+random(2), 0, 0, True);"

or something like that.

The Voices
01-15-2008, 11:36 PM

Great tut, thanks

01-16-2008, 12:18 AM
Thanks this helped a lot. Just joined and wanted to start scripting.

07-22-2008, 05:21 PM
Really nice tut, I learned a lot. I just have a question about the up text. Would the uptext jsut be the verb of what the character is going to do, or also what he is going to do it to? For example, in fishing, would it be just Cage, or Cage Fishing spot?

07-23-2008, 06:09 AM
It's the blue text part.

12-28-2009, 05:46 PM
this is a great tutorial and helped me learn how to use this function but its not working for some reason it just moves around to to the object but never moves on to the next step which would be storing the coords and the moving the mouse and clicking .ETC. is UpText still broken?