PDA

View Full Version : All other FindObj functions



Tails111
08-13-2007, 04:04 PM
Chapter 1: About Me + This Tutorial
Hello, I am tails111, I am somewhat of a new scripter. I do have experience with VB 6 and 2005(8). I mainly script in RS for my little brother although I do enjoy the intellectual challenge. I have decided to make this tutorial about FindObj's functions because I have found these to be one of the most reliable ways to find a rock, or a tree, or even an NPC. It has never failed for me, well besides a few errors. :P This tutorial will go through 5 or so of the different FindObj functions.
Chapter 2: What FindObj Is
FindObj is an SRL function that looks for colors anywhere on the RS screen(some can use coords for searching) There are a total of 7 different forms of FindObj, all of them doing seperate things, whether is be searching in coords or searching for more than 1 color or name.

Chapter 3: FindObj
This one is rather simple and is the basic one. It is not the most reliable nor is it the most accurate, because it only searches for 1 name and 1 color. Here is the code would be used.
procedure FindNPC;
begin
If(FindObj(tx, ty, 'name', Color, tol)) Then
WriteLn('Found Blah Blah');
end;

begin
SetupSRL;
FindNPC;
end.This is not a working example

While that is an effective code when finding NPC's such as the Shop Keeper or the Seamen at the ports, this is not very effective at finding trees and rocks.


Chapter 4: FindObjMultiText
This function will look for 3 different names(the top left corner text) and 1 color, using a tolerance. This function DOES store the x and y coords so there is no need for the function GetMousePos. This is helpful in agility courses or herblore scripting. Here is an example as to how it can be used. Program Herblore;

{.include srl/SRL.scar}

var tx, ty: Integer;

procedure CombineHerb;
Begin
If(FindObjMultiText(tx, ty, 'eaf', 'Guam Leaf', 'uam', 10351545, 10)) Then
begin
WriteLn('Found Guam Leaf');
Mouse(tx, ty, 10, 10, True);
end;
end;

Begin
SetupSRL;
CombieHerb;
end.


Chapter 5: FindObjEx
This type of FindObj will look for an obj using 1 name and 1 color with a tolerance. This FindObj also stores the x and y coords. This one is unique because it finds the object in specified coords, or params and it can be told to look in a Spiral or wait so many miliseconds before checking. This also uses a random pixel feature like the Mouse function. Here is it's original outline.
FindObjEx(x, y, Name, x1, y1, x2, y2, Color, Tol, MinXDist, MinYDist, WaitperCheck, Spiral);
Here is an example as to how it can be used. MSX1 and MSY1 and MSX2 and MSY2 are predifined coords for the Main Screen in Runescape, you may set your own in those areas.
Program FindSomething;
{.include srl/SRL.scar}

var tx, ty: Integer;

Procedure FindIt;
begin
If(FindObjEx(tx, ty, 'Rock', msx1, msy1, msx2, msy2, 2048592, 10, 10, 10, 20, True)) Then
begin
WriteLn('Found Rock');
Mouse(tx, ty, 2, 2, True);
end;
end;

Begin
SetupSRL;
FindIt;
end.


Chapter 6: FindObj3
This will atempt to find your object using 1 name and 1 color with a tolerance. This is different from FindObj because it searches from the center of the screen out. Here is its orginal display.
FindObj3(x, y, 'Name', Color, Tol); This may be useful for merchanters looking for people. Here is a way it can be used.
Program FindPerson;
{.include srl/SRL.scar}
Procedure FindCeleb;
If(FindObj3(x, y, 'Emma Watson', 5268081, 10)) Then
WriteLn('Found Emma Watson, Hermione Granger, from Harry Potter');
end;

Begin
SetupSRL;
FindCeleb;
end. and yes the color was found on her official site. *She is so amazing*

Chapter 7: FindObjectDeformed
I do not know how to use this but it is used by finding a bitmap, 2 UpTexts, stores x and y coords and looks in specified paramaters, or coords. Do not use with images over 16 pixels; The specified area is in place of a, b, c, and d.

FindObjectDeformed(x, y, 'Uptext1', 'Uptext2', BMP, a, b, c, d);
Chapter 8: Conclusion
If you have any questions about this tutorial or if you find any mistakes please post them. Yes I do admire Emma Watson and almost none of these examples worked because I made up names and colors, this tutorial is just an over view as to the many different ways to use the functions in srl/Core/Object.scar I left out FindObjMulti because I have written a tutorial about it. You may find the link in my signature.

Markus
08-13-2007, 05:33 PM
You forgot one of the best object finding functions, FindObjectMulti (this isnt't the same as FindObjMulti, which you already wrote a tut about).
Oh, and in your example for FindObjMultiText you forgot a ' after use, causing it not to compile. Not to forget it can be either of the three texts (so not just all three), so it'll also respond to any other thing with Use in the uptext, might want to fix that ;)
Other then that, nice tut :)

Tails111
08-13-2007, 06:19 PM
haha, I was tired, I just got back from putting a wire underground for my pool's filter. Tough stuff, and thanks I will fix that. Hmm I missed FindObjectMulti, I thought I did it. Oh well I will write that in, it is just a mix between FindObjMultiText and FindObjMulti.

And I fixed the Use thing, but in its context, using in herblore I think it would have been fine. I generally would never put Use as one of the Uptext names tho.

IEatJ00erBaybees
08-16-2007, 05:39 PM
Haha..you forgot Chapter 8 :D

Thanks for this..I've always wondered what's the difference between all the different FindObj's are.

rotflmfwao
08-16-2007, 09:16 PM
Nice tut, I learned some vital scripting info here.

Tails111
08-17-2007, 12:50 AM
Nice tut, I learned some vital scripting info here.

Heh, this was vital until up around 8 days ago -.- Apparently in SRL 4 they are making big changes to FindObj. But it is a base knowledge of how to find a color using a name and tol. The code itself might change, but it will be easy to figure out the changes with this knowledge.