SRL Archive - OSR Outdated Tutorials

procedure FFlag(Distance: Integer);


WT-Fakawi

2006-06-09 16:42:37

FFlag works in a similar fashion like Flag, only FFlag solves a number of problems for you.
1. It has a build-in timer, that solves the Hanging-Flag problem that sometime occurs (Flag wont go away from screen). If the Flag is still visible after 20 seconds, it will replant the Flag once at Color 255 (= itself). After that, you are on your own…
2. FFlag exits, when the Flag is within Distance distance. As a result, your Player will roadwalk without stopping between each click.




{*******************************************************************************
procedure FFlag(Distance: Integer);
By: Wizzup? / WT-Fakawi.
Description: Waits until Flag is within "Distance" distance.
*******************************************************************************}
procedure FFlag(Distance: Integer);
var
XK, YK, XL, YL : Integer;
var
T1, T2 : Extended;
begin
T1 := GetTickCount;
repeat
T2 := GetTickCount;
Wait(100);
if HumanCircleFlag(Distance) then
Break;
Wait(100);
if T2 - T1 > 30000 then
begin
if FindColor(XL, YL, 255, MMX1, MMY1, MMX2, MMY2) then
MouseFindFlag(XL, YL, 1, 1)
else Mouse(MMCX, MMCY, 0, 0, True);
break;
end;
if Random(20) = 1 then IdleTime(500,1000,0.01);
until (not FindColor(XK, YK, 255, MMX1, MMY1, MMX2, MMY2));
end;



ZephyrsFury

2007-08-04 13:21:09

Didn't ronny.m.p make a cool function called RonnyFlag that also searches for the flag "pole" so you could walk north. Because, sometimes you can't see the flag but you can see the pole.

EDIT: Oh wait sry, didn't ronny get banned?

Claymore

2008-07-22 12:10:56

So, a stupid question, do i just put -1, -2, -3 etc… if i want to make it continue walking without waiting for the flag?

And also is it measured by pixels? (The distance)

Starblaster100

2008-07-23 04:05:27

Distance should be a positive number.
Its the number of pixels close you are to the flag before the script decided to exit the procedure and carry on.
Usually, I use 10-20 as the number.

Wanted

2008-07-23 10:56:14

From: deathscytex
So, a stupid question, do i just put -1, -2, -3 etc… if i want to make it continue walking without waiting for the flag?


0-4 if you need to come to a stop.
5-15 is you want to wait until right before the flag disappears.
16-20 if you want to wait a little bit less.
21+ if you're a crazy maniac person :-P

It's possible to use RandomRange (generates a random number through two integers) in there

WriteLn(IntToStr(Random(Range(-5, 5))));

could be

-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, or 5.

FFlag(0); //Complete stop
FFlag(RandomRange(0, 4)); //Stop
FFlag(RandomRange(5, 15)); //Right before
FFlag(RandomRange(16, 20)); //Little longer

of course you could do whatever you want and do something like

FFlag(RandomRange(5, 20));

also, FFlag is function and returns a Boolean, although, it will perform all of searching and waiting before you get the result, it is not the same as FlagPresent: Boolean; in terms of what it actually does.

if (FFlag(0)) then
WriteLn('Flag was found when mini-map was clicked.');

Hope me and Star answered your question(s).

Claymore

2008-07-23 12:50:50

Thanks! I finally got it! I just put 0 because i never knew what it does…

Runescape Pro

2008-07-25 17:34:30

ATTENTION: I have been working on a procedure called "DFFlag(Distance: Integer);" This will make a "wait" unneeded b4 the FFlag function. I'll post the final function here if allowed. It's still under testing.

~Runescape Pro

Claymore

2008-07-25 20:02:04

Lol, seems similar but both different in a way :P

Wanted

2008-07-25 21:58:11

From: Runescape Pro
ATTENTION: I have been working on a procedure called "DFFlag(Distance: Integer);" This will make a "wait" unneeded b4 the FFlag function. I'll post the final function here if allowed. It's still under testing.

~Runescape Pro


Dude that's really simple.

I've done that thousands of times before…

I made this in about 20 seconds:

Edit: Fixed.

function DFFlag(Distance: Integer): Boolean;
var
T: LongInt;
begin
MarkTime(T);
while (not ((FlagPresent) or ((TimeFromMark(T)) >= (RandomRange(5000, 7000))))) do
Wait(RandomRange(100, 200));
Result := FFlag(Distance);
end;

Wizzup?

2008-07-27 05:07:22

From: IceFire908
Dude that's really simple.

I've done that thousands of times before…

I made this in about 20 seconds:

function DFFlag(Distance: Integer): Boolean;
var
T: LongInt;
begin
MarkTime(T);
while (not ((FlagPresent) or (T >= (RandomRange(5000, 7000))))) do
Wait(RandomRange(100, 200));
Result := FFlag(Distance);
end;


The 'T' should be TimeFromMark(T)

Wanted

2008-07-27 10:47:52

From: Wizzup?
The 'T' should be TimeFromMark(T)


Ah, ok…forgot that… I guess that's what I get for pulling a function out of my ass as fast as I can. :-P

Here we go:

function DFFlag(Distance: Integer): Boolean;
var
T: LongInt;
begin
MarkTime(T);
while (not ((FlagPresent) or ((TimeFromMark(T)) >= (RandomRange(5000, 7000))))) do
Wait(RandomRange(100, 200));
Result := FFlag(Distance);
end;