View Full Version : Procedure FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : I
Ultra
01-04-2008, 09:19 PM
Procedure FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : Integer);
What this procedure does is looks for the tree, if its found then it sais tree found, if its not found, it sais that tree is not found.
Note that this works perfectly only if there is ONE tree of the same type on the runescape screen.This could be for example used at varrock north-east yew since there are no more trees than the one yew there.
Here is the procedure.
Procedure FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : Integer);
{FindTree('illo', 21313973, 10, 5847397, 5);}
Var
TX, TY : Integer;
SX, SY : Integer;
Found : Boolean;
Begin
If(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol))And(Not(FindObj(SX, SY, 'tump', StumpColor, StumpTol)))Then
Begin
MMouse(TX, TY, 15, 15);
If(IsUpText(SomeLetters))Then
WriteLn('Tree Found.');
Found := True;
End Else
Begin
If(Not(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol)))And(FindObj(SX, SY, 'tump', StumpColor, StumpTol))Then
WriteLn('Tree Not Found.');
Found := False;
End;
End;
Here is how to use the procedure.
Program Testing;
{.Include SRL/SRL.Scar}
Procedure FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : Integer);
{FindTree('illo', 21313973, 10, 5847397, 5);}
Var
TX, TY : Integer;
SX, SY : Integer;
Found : Boolean;
Begin
If(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol))And(Not(FindObj(SX, SY, 'tump', StumpColor, StumpTol)))Then
Begin
MMouse(TX, TY, 15, 15);
If(IsUpText(SomeLetters))Then
WriteLn('Tree Found.');
Found := True;
End Else
Begin
If(Not(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol)))And(FindObj(SX, SY, 'tump', StumpColor, StumpTol))Then
WriteLn('Tree Not Found.');
Found := False;
End;
End;
Begin
SetUpSRL;
Begin
FindTree('illo', 21313973, 10, 5847397, 5);
End;
End.
Well i hope you liked it, please post comments and such. IF YOU CLAIM THIS AS YOUR OWN I PROMISE YOU, I WILL GET Y O U BANNED.
footballjds
01-04-2008, 09:51 PM
change it to a function that returns a boolean result.
like this
function FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : Integer) : boolean;
then change the rest to look like this
function FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : Integer) : boolean;
{FindTree('illo', 21313973, 10, 5847397, 5);}
Var
TX, TY : Integer;
SX, SY : Integer;
Found : Boolean;
Begin
Result := False;
If(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol))And(Not(FindObj(SX, SY, 'tump', StumpColor, StumpTol)))Then
Begin
MMouse(TX, TY, 15, 15);
If(IsUpText(SomeLetters))Then
WriteLn('Tree Found.');
Result := True;
End Else
Begin
If(Not(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol)))And(FindObj(SX, SY, 'tump', StumpColor, StumpTol))Then
WriteLn('Tree Not Found.');
End;
End;
the you can use it like... if (function FindTree('illow', 123, 1, 123, 1)) then
ClickTree;//or w/e you use to click your tree.
also change it so it looks for the color with tol of 0 - Tree tol. so it find the tree. not somthing like the tree.
IE.
repeat
if (FindColorTolerance(x, y, TreeColor,MSX1, MSY1, MSX2, MSY2, ColorTolerance)) then
break;
ColorTolerance := ColorTolerance + 1;
until (ColorTolerance >= TreeTol) or (not(LoggedIn));
feel free to use my idea, and no need to credit.
i hate ppl that just want credit.
i use stuff like that for auto color all the time. its great!
Raskolnikov
01-04-2008, 10:05 PM
I would recommend to have it be a function. Here is the revised version.
Function FindTree(x, y: integer; TreeColor, TreeTol, StumpColor, StumpTol : Integer): boolean;
Begin
If(FindObj(x, y, 'own', TreeColor, TreeTol))And(Not(FindObj(x, y, 'tump', StumpColor, StumpTol)))Then
Begin
MMouse(x, y, 15, 15);
If(IsUpText('own'))Then
WriteLn('Tree Found.');
Result := True;
End Else
Begin
If(Not(FindObj(x, y, 'own', TreeColor, TreeTol)))And(not(FindObj(x, y, 'tump', StumpColor, StumpTol))Then
WriteLn('Tree Not Found.');
Result := False;
End;
End;
Notice that now that there are results, no need to put in uptext and coordinates:
if FindTree(x, y, TreeColor, TreeTol, StumpCol, StumpTol) then
The boolean result allows you to see if it actually found the tree. When you just declare a variable locally inside a function, how would a person access that variable? I would also recommend learning tboxes so you can not use FindObj. FindObj moves the mouse vigorously around the screen looking for the uptext. Detectable. Use FindColorTolerance, or FindColorsSpiralTolerance(returns TPointArrays).
Cut em2 it
R0b0t1
01-04-2008, 11:11 PM
function FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : Integer) : boolean;
{FindTree('illo', 21313973, 10, 5847397, 5);}
Var
TX, TY : Integer;
SX, SY : Integer;
Found : Boolean;
Begin
If(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol))And(Not(FindObj(SX, SY, 'tump', StumpColor, StumpTol)))Then
Begin
MMouse(TX, TY, 15, 15);
If(IsUpText(SomeLetters))Then
Result := True;
End Else
Result:= (Not(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol)))And(FindObj(SX, SY, 'tump', StumpColor, StumpTol));
End;
Zyt3x
01-04-2008, 11:25 PM
agree with robot, the script you made, would send result := true self if it did not found the text. but the modefied v. robot made works.
Jackrawl
01-05-2008, 12:28 AM
Procedure FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : Integer);
What this procedure does is looks for the tree, if its found then it sais tree found, if its not found, it sais that tree is not found.
Note that this works perfectly only if there is ONE tree of the same type on the runescape screen.This could be for example used at varrock north-east yew since there are no more trees than the one yew there.
Here is the procedure.
Procedure FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : Integer);
{FindTree('illo', 21313973, 10, 5847397, 5);}
Var
TX, TY : Integer;
SX, SY : Integer;
Found : Boolean;
Begin
If(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol))And(Not(FindObj(SX, SY, 'tump', StumpColor, StumpTol)))Then
Begin
MMouse(TX, TY, 15, 15);
If(IsUpText(SomeLetters))Then
WriteLn('Tree Found.');
Found := True;
End Else
Begin
If(Not(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol)))And(FindObj(SX, SY, 'tump', StumpColor, StumpTol))Then
WriteLn('Tree Not Found.');
Found := False;
End;
End;
Here is how to use the procedure.
Program Testing;
{.Include SRL/SRL.Scar}
Procedure FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : Integer);
{FindTree('illo', 21313973, 10, 5847397, 5);}
Var
TX, TY : Integer;
SX, SY : Integer;
Found : Boolean;
Begin
If(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol))And(Not(FindObj(SX, SY, 'tump', StumpColor, StumpTol)))Then
Begin
MMouse(TX, TY, 15, 15);
If(IsUpText(SomeLetters))Then
WriteLn('Tree Found.');
Found := True;
End Else
Begin
If(Not(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol)))And(FindObj(SX, SY, 'tump', StumpColor, StumpTol))Then
WriteLn('Tree Not Found.');
Found := False;
End;
End;
Begin
SetUpSRL;
Begin
FindTree('illo', 21313973, 10, 5847397, 5);
End;
End.
Well i hope you liked it, please post comments and such. IF YOU CLAIM THIS AS YOUR OWN I PROMISE YOU, I WILL GET Y O U BANNED.
lol
DIZ IZ MY OWNZ! HE ZTOLEZ IT!!!
Why can't you just use findobj?
Ex.
repeat
if FindObj(x, y, treetext, color, tolerance) then break;
if FindObj(x, y, 'tump', color, tolerance) then
wait(3000);
A:=A+1;
until A = 5;
You're making this too hard. Logically if you found the stump, then you could just do
MMouse(x, y, 1, 1);
repeat
wait(1);
A:=A+1;
if isuptext(treetext) then
begin
thingdoo := true;
Break;
end;
until A=15000;
if thingdoo = true then
Mouse(x, y, 1, 1, True);or something to that effect.
Ultra
01-05-2008, 02:38 AM
Well it now works like this for example:
If(FindTree)Then
Wait(5000); //Its supposed to do something like that.
End Else
If(Not(FindTree))Then
DoSomethingHere;
R0b0t1
01-05-2008, 10:03 PM
Look how short I got it ^.^
function FindTree(Var TX, TY: Integer; SomeLetters: String; TreeColor, TreeTol, StumpColor, StumpTol: Integer): Boolean;
Begin
Result:= (Not(FindObj(TX, TY, 'tump', StumpColor, StumpTol))) And (FindObj(TX, TY, SomeLetters, TreeColor, TreeTol));
If Result Then
MMouse(TX, TY, 15, 15);
End;
Additionally, you could remove the mouse part and do it separate.
function FindTree(Var TX, TY: Integer; SomeLetters: String; TreeColor, TreeTol, StumpColor, StumpTol: Integer): Boolean;
Begin
Result:= (Not(FindObj(TX, TY, 'tump', StumpColor, StumpTol))) And (FindObj(TX, TY, SomeLetters, TreeColor, TreeTol));
End;
You got owned.
Ultra
01-05-2008, 10:48 PM
But yours doesnt exactly say IF it found the tree or IF it didnt find the tree. :).
So actually, YOU got owned :P.
BobboHobbo
01-05-2008, 11:58 PM
But yours doesnt exactly say IF it found the tree or IF it didnt find the tree. :).
So actually, YOU got owned :P.
No you got owned :D
R0b0t1
01-06-2008, 10:28 PM
Actually, U L T R A, it does say IF the tree was found. Mmmkay?
Did you not know that it is exactly the same as yours? (Accomplishes the same thing)
And I will own you again :)
NOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOB
You, U L T R A, have been reported for being a NOOB.
Your Current violations include Thinking you know stuff you don't for http://www.greg.impwiki.org/noobpoints/noobpoints.png (http://www.villavu.com/forum/showthread.php?t=5265) http://www.greg.impwiki.org/noobpoints/noobpoints.png (http://www.villavu.com/forum/showthread.php?t=5265) http://www.greg.impwiki.org/noobpoints/noobpoints.png (http://www.villavu.com/forum/showthread.php?t=5265)
This brings you to a new total of http://www.greg.impwiki.org/noobpoints/noobpoints.png (http://www.villavu.com/forum/showthread.php?t=5265)http://www.greg.impwiki.org/noobpoints/noobpoints.png (http://www.villavu.com/forum/showthread.php?t=5265)http://www.greg.impwiki.org/noobpoints/noobpoints.png (http://www.villavu.com/forum/showthread.php?t=5265) (3) Noob Points!
For more information on U L T R A (http://www.greg.impwiki.org/noobpoints/noobadmin.php?noob_name=U+L+T+R+A) please go Here. (http://www.greg.impwiki.org/noobpoints/noobadmin.php?noob_name=U+L+T+R+A)
For more information from This database (http://www.greg.impwiki.org/noobpoints/noobadmin.php) please go Here. (http://www.greg.impwiki.org/noobpoints/noobadmin.php?)
For more information on The Noob Points System (http://www.greg.impwiki.org/noobpoints/) please go Here. (http://www.greg.impwiki.org/noobpoints/)
For more information on Noobs (http://www.villavu.com/forum/showthread.php?t=5265) please go Here. (http://www.villavu.com/forum/showthread.php?t=5265)
NOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOB
mickaliscious
01-06-2008, 10:38 PM
Actually, U L T R A, it does say IF the tree was found. Mmmkay?
Did you not know that it is exactly the same as yours? (Accomplishes the same thing)
And I will own you again :)
NOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOB
You, U L T R A, have been reported for being a NOOB.
Your Current violations include Thinking you know stuff you don't for http://www.greg.impwiki.org/noobpoints/noobpoints.png (http://www.villavu.com/forum/showthread.php?t=5265) http://www.greg.impwiki.org/noobpoints/noobpoints.png (http://www.villavu.com/forum/showthread.php?t=5265) http://www.greg.impwiki.org/noobpoints/noobpoints.png (http://www.villavu.com/forum/showthread.php?t=5265)
This brings you to a new total of http://www.greg.impwiki.org/noobpoints/noobpoints.png (http://www.villavu.com/forum/showthread.php?t=5265)http://www.greg.impwiki.org/noobpoints/noobpoints.png (http://www.villavu.com/forum/showthread.php?t=5265)http://www.greg.impwiki.org/noobpoints/noobpoints.png (http://www.villavu.com/forum/showthread.php?t=5265) (3) Noob Points!
For more information on U L T R A (http://www.greg.impwiki.org/noobpoints/noobadmin.php?noob_name=U+L+T+R+A) please go Here. (http://www.greg.impwiki.org/noobpoints/noobadmin.php?noob_name=U+L+T+R+A)
For more information from This database (http://www.greg.impwiki.org/noobpoints/noobadmin.php) please go Here. (http://www.greg.impwiki.org/noobpoints/noobadmin.php?)
For more information on The Noob Points System (http://www.greg.impwiki.org/noobpoints/) please go Here. (http://www.greg.impwiki.org/noobpoints/)
For more information on Noobs (http://www.villavu.com/forum/showthread.php?t=5265) please go Here. (http://www.villavu.com/forum/showthread.php?t=5265)
NOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOB
Thats a bit harsh.
R0b0t1
01-07-2008, 01:59 AM
No its not, do noob points mean anything?
I wanted to prove my point. And I did... I think :|
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.