PDA

View Full Version : FindObjMulti + Little bit of Bitmaps



Tails111
08-11-2007, 11:03 PM
Introduction
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 FindObjMulti because I have found it 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
Chapter 1: How it Works
FindObjMuti works by looking for 1 name or the text that appears at the top left corner of the RS screen, and looks for 3 colors with a tolerance. Unlike FindObj which uses 1 name and 1 color and I think a tolerance it won't store the X and Y coords. This is fixed by GetMousePos(x, y) and then using the Mouse function.

Chapter 2: How to Use it
FindObjMulti(Name, Color1, Color2, Color3, Tol) is the outline of it. This code is pretty self explanatory. I generally set the Name and Colors in the const section of my scripts. Here is a WORKING(as of 8/11/07) example on how it can be used in Runescape 2. This is in my Oak Chopper Script and a Snippet I made for finding the monks of etrana and taking the boat.

program LumbChopeSell;

{.include srl/SRL.scar}

const
Oak1 = 3694181; Oak2 = 2976862; Oak3 = 4023663; Tree = 'ak';

var FoundTree, tx, ty: Integer;

procedure ChopOaks;
Begin
FoundTree := 0; //This is my way of saying False for the FoundTree which is used to end the repeat
WriteLn('Attempting to Chop Oaks!');
repeat
If(FindObjMulti(Tree, Oak1, Oak2, Oak3, 10)) then // This is our FindObjMulti
begin
getmousepos(tx, ty); //Here is the GetMousePos
Mouse(tx, ty, 1, 1, True);
FoundTree := 1; // This is the True to the FoundTree which will tell the Repeat to stop
wait(2000 + Random(4000));
end;
until Not FoundTree = 1; // This actually ends the loop
end;

Begin
SetupSRL;
ActivateClient;
Repeat
ChopOaks;
Until(false);
end.
This is an extravagantly amazingly accurate way to find the tree and it won't stop until it does. Most people Frown upon it but it is rather simple to add a fail safe. Plus if you have your colors right you are pretty much okay. I have a FindDTM function to end the repeat in the main loop but I decided to leave this out just for tutorial sake.

Here is the other example using an NPC.

program Monk;

{.include srl/SRL.scar}

const Monk = 'onk'; Monk1 = 5419742; Monk2 = 8103123; Monk3 = 5532541; // Monk colors, their beards and name

var FoundMonk, tx, ty, TakeBoat: Integer; // I use tx, ty, you may use what ever x and y you want though.

procedure DeclareBMP; // It is the Take-Boat option when you right click the monk.
begin
TakeBoat := BitmapFromString2(False, 'aEBB6078DAA590510E03' +
'210844AF045B10FDD4DD7AFF23AD6393761343C3B6F3311A7 9104' +
'62262661ADAFB302979B8CA137E54784EC37907F22838126F 6F26' +
'29F82D0B5E1455EDE01310D282F764986FDC706F0A7E56654 2A6F' +
'DC334F0560BCAADEAA122D6BF8AA63C922E7A312BE94D58BB 28A0' +
'F87C6FCFBBBDD70DE33FB6A68BFB6FE9EEFEBC97D1CBF27FA EF88' +
'627CBF');
end;

procedure ClickMonk;

Begin
FoundMonk := 0; // I don’t use true and false, I use 1 and 0, 0 being false 1 being true.
Status('Attempting to find Monk!!');
repeat //This will make it repeat until it finds the monk
If(FindObjMulti(Monk, Monk1, Monk2, Monk3, 7)) then
begin
getmousepos(tx, ty);
Mouse(tx, ty, 1, 1, False);
FoundMonk := 1; //This is my way of saying found monk
wait(500 + Random(750));
end;
until FoundMonk = 1; // Will keep repeating until find's FoundMonk = 1
end;


procedure GoOnBoat;
begin
If(FindBitmap(TakeBoat, tx, ty)) Then
wait(1000 + Random(350));
Mouse(tx, ty, 4, 4, True);
end;

begin
SetupSRL;
ActivateClient;
DeclareBMP;
ClickMonk; //There is a way to merge the ClickMonk and GoOnBoat procedures, but I find it to not be as reliable.
GoOnBoat;
end.
This will find the Monks of Etrana on the dock at Port Sarim, obviously it is members only and it uses FindBitMap(much like FindObj but uses a small picture instead, that is for a later tutorial).

Chapter 3: Why Use it?
You should use FindObjMulti over FindObj because it checks for 3 colors not just 1, thus making it much more reliable, actually 300% more reliable :P.

Chapter 4: Common Misconceptions
Many people believe that FindObj and FindObjMulti and all the other FindObj commands look for 2D preset images.

I have also seen people believe that FindObj doesn't use colors.

Chapter 5: Conclusion
As I have said I love FindObj and Bitmaps, these are SRL functions but they still can be used after major updates! Maybe a little bit of modifying to colors. The world of programming or Scripting is endless. If you have any questions about this tutorial or any other ways of using FindObjMulti then reply to this thread. I wish to thank the community for helping me with some bugs I had while I was working on a script and the Developers of SRL for such a great peace of work, and last but not least, I wish to thank www.srl-forums.com for helping Scar and SRL stay running.

lordsaturn
08-11-2007, 11:29 PM
Thanks. Well Explained.

Macrosoft
08-12-2007, 12:06 AM
omg you made that fast!...

Yeah this helped lots but, what does it do to find it

if it moves the mouse in a spiral or something really detectable...

on the other hand if it doesnt move the mouse and finds the three colors, then checks by moving the mouse to the object to make sure 'onk' apears in the upper left, then I will use it



ps u seem to be pretty good at scar, I am amazed you are not an srl member yet!

Tails111
08-12-2007, 01:22 AM
While it is searching it doesn't do anything, the mouse just sits there until it finds one of the three colors and then verifies with the name and then will move the mouse.

I haven't applied to be a SRL member yet. When I finish my oak cutter + seller I will use that.

Macrosoft
08-12-2007, 01:32 AM
How does it find the name without moving the mouse?


hey, i got an idea for you oak cutter and banker

I was going to make a script that cuts all types of trees in lumb, like willows, oaks, normal, and yews, but decided to do it once i become more experianced(would be sorta hard)

I was going to include the lumb home tele is it gets lost and you might wana use that in your script ;)

Tails111
08-12-2007, 01:43 AM
I have it added in actually =) I made it using bitmaps to find the gametab and then to find the spell. Only problem is right now RadialWalking doesn't work so I am not adding anything that can't be done with symbols or finding a color.

It is kind of funny to see how much easier SRL makes scripting.

Anyways once it finds the colors and then it moves the mouse and then it checks for the name.

Also with this it only needs to find 1 out of the 3 colors to check, So if the script only finds 1 of the colors on the tree it will go over and check.

Macrosoft
08-12-2007, 01:43 PM
sounds good!

cant w8 till you finish it

yeah lol srl makes scripting a walk in the park

radialwalkex, seems to click, but not in the right spot, radialwalk doesn't click at all

any ideas for me on how i can improve the reliability of my walking?

ZephyrsFury
08-12-2007, 02:50 PM
Looks good. Maybe you could expand it to cover FindObj and other similar functions aswell. Oh and your second example has nothing to do with bitmaps lol. ;)

Tails111
08-12-2007, 03:22 PM
@ ZephyrsFury, Well it does in a way, it uses FindBitmap, to find the Take-Boat thing for going on the boat. :P So I guess I just put it in to help, and yes I am working on Unique examples for FindObj as well as generic ways for FindObj and all the other FindObj functions.

@ Macrosoft, Runescape's update have done some werid things to Radial Walking, and I am ALMOST done the script, just a little bit more coding to find if the oak is still there, also I am using a custom Anti-Ban + Ent Checker, not that you really need ent checkers for oaks because you get like 1 out of every 4 hours.

Macrosoft
08-12-2007, 08:56 PM
Just found a FindObjectMulti, which uses x, y coord to store position, looks for three text and three color, I was gunna use it but I don't know what they mean by turns??:confused: :confused::confused::confused::confused::confused:

ZephyrsFury
08-13-2007, 12:25 PM
Oh I see... I swear that wasn't there before... Then again maybe its just because it was 11pm here when I was looking at it. ;)

Tails111
08-13-2007, 01:08 PM
Just found a FindObjectMulti, which uses x, y coord to store position, looks for three text and three color, I was gunna use it but I don't know what they mean by turns??:confused: :confused::confused::confused::confused::confused:

I have seen that function in the manual but I amm a little confused to, right now I am trying a bunch of things, and I will get back to you if I find out what it is, I know it is a number tho so that might help.

Zeph, haha 11:00, I am not a night person, I prefer to go to bed around 10 ish and wake up nice and early, I think it is just because I am an aires, adventurous type you know,

UGH once again a new RS update -.-

EDIT: Ok well Macrosoft, I have found out what it does, I am not entirely sure what it means but it works, anyways here is what I have done,

program New;

{.include srl/SRL.scar}

var tx, ty: Integer;

procedure FindTree;
begin
If(FindObjectMulti(tx, ty, 'hop down', 'Oak', 'ak', 12075, 3759738, 7317922, 5, 10, False, False)) Then
begin
writeLn('Found it');
Mouse(tx, ty, 6, 6, True);
end;
end;
begin
setupSRL;
ActivateClient;
FindTree;
end.

This finds the tree pretty well, anyways I will try my best to explain it,

FindObjectMulti(tx, ty, 'hop down', 'Oak', 'ak', 12075, 3759738, 7317922, 5, 10, False, False) is what I used, I will put it down to what it is,

FindObjectMulti(x, y, 'Name1', 'Name2', 'Name3', Color1, Color2, Color3, tol, Turns, MultiText, MultiTimes);

the x and y and names and colors and tol are simple... Turns is what I how many times it will search, the higher I had it the more it found it, but slower. MultiText is a true or false, I think that tells it whether is has to find all of the Names, (name1) (name2) (name3); And I think MultiTimes means it will have to use all the times before the next action

I am not 100% sure but in the 5 minutes I worked with it that is what I found.

oh and make sure when ever your doing something like a tree cutter that you don't use 'hop down' because all trees have that.

Infantry001
08-13-2007, 02:21 PM
Great tut! You do seem like SRL member material. Very well explained. Good job!

Tails111
08-13-2007, 04:09 PM
Infintry thanks for the Comments and

I have made another tutorial explaining all the other FindObj Functions except for the one FindObjectDeformed, cause I don't ahve a clue how to use it. http://www.villavu.com/forum/showthread.php?t=15236?p=184186

That is the link and take a look at it please!

Macrosoft
08-16-2007, 12:32 AM
ok, thanks for that findobjectmulti tut lol

I have heard they are replacing many of the findobj functions with one function, anyone know if this is true?

Tails111
08-17-2007, 12:52 AM
I have heard they are replacing many of the findobj functions with one function, anyone know if this is true?

Yeah, I messaged Wizzup? and he said there are some changes to Findobj functions =/. But I will update/make my tutorial if there is anything worth mentioning.

ZephyrsFury
08-19-2007, 02:05 PM
Just to let you know they've completely removed FindObjMulti and replaced it with FindObjCustom.

Tails111
08-19-2007, 03:11 PM
I know I read =/.

benjaa
12-30-2007, 10:40 AM
TakeBoat := BitmapFromString2(False, 'aEBB6078DAA590510E03' +
'210844AF045B10FDD4DD7AFF23AD6393761343C3B6F3311A7 9104' +
'62262661ADAFB302979B8CA137E54784EC37907F22838126F 6F26' +
'29F82D0B5E1455EDE01310D282F764986FDC706F0A7E56654 2A6F' +
'DC334F0560BCAADEAA122D6BF8AA63C922E7A312BE94D58BB 28A0' +
'F87C6FCFBBBDD70DE33FB6A68BFB6FE9EEFEBC97D1CBF27FA EF88' +
'627CBF');




how did you get this??
is this the "DTM"?

DeSnob
04-01-2008, 09:32 PM
thx man i have been looking for a tut like this, you told me the best facts about FindObjMulti so now I know how to find aubury or something like that

P.S. you RULE!

kevinkoh
04-06-2008, 07:10 AM
great tut for FindObjMulti! Thanks!