SRL Archive - SRL Archives

Resting Function...


Pure1993

2009-06-09 18:52:19

Here is a little function to toogle the new "rest" ability on in runescape. :)

Wanted - Enter target energy level

function Rest( Wanted : integer): Boolean;
var
t : integer;
s : string;
begin
if (not LoggedIn) then Exit;
FFlag(0);
if GetMMLevels('run', s) >= Wanted then
begin
Result := True;
Exit;
end;
Mouse(715, 95, 10, 10, False);
Wait(200+random(100));
ChooseOption('est');
markTime(t);
repeat
Wait(500+random(500));
if TimeFrommark(t) > 60000 then
begin
Result := False;
Exit;
end;
until GetMMLevels('run', s) >= Wanted;
Result := True;
end;

Floor66

2009-06-09 18:57:44


function Rest(Wanted : Integer): Boolean;
var
t : integer;
s : string;
begin
if (not LoggedIn) then
Exit;
FFlag(0);
if GetMMLevels('run', s) >= Wanted then
begin
Result := True;
Exit;
end;
Mouse(715, 95, 10, 10, False);
Wait(200 + Random(100));
ChooseOption('est');
MarkTime(t);
repeat
Wait(500 + Random(500));
if TimeFromMark(t) > 180000 then
begin
Result := False;
Exit;
end;
until(GetMMLevels('run', s) >= Wanted);
Result := True;
end;

Didn't change a lot, just the 60000 to 180000 because regening 0-100 with 1 agi might actually take > 1 min.
Oh, and a few small standard/capitalization stuff.

Pure1993

2009-06-09 19:00:47

ah, okay, thanks, I wouldn't know, I only tried this on my main with 45 agility^^

marpis

2009-06-09 19:20:59

Just make it SetRest;
so it would just set the rest on, not wait. ppl wanna do like antibans etc while waiting

Shuttleu

2009-06-09 19:23:03

30 seconds from 0-99
33 agility
function Rest(Wanted: integer): Boolean;
var
t : integer;
s : string;
begin
if (not LoggedIn) then Exit;
Flag;
if GetMMLevels('run', s) >= Wanted then
begin
Result := True;
Exit;
end;
Mouse(715, 95, 10, 10, False);
Wait(200+random(100));
ChooseOption('est');
MarkTime(t);
while (not(TimeFrommark(t) > 60000)) do
begin
Wait(500+random(500));
Result := (GetMMLevels('run', s) >= Wanted);
if Result then
Exit;
end;
end;
slightly shorter

~shut

Pure1993

2009-06-09 19:30:06

erm, "RestOn" wouldn't be needed, cause you can't turn it off… well, this won't wait until you are at the desired state, so you would have to use it with an energy checker in a loop…


function AreResting: Boolean;
begin
Result := SimilarColor( getColors( 726, 112), 1919769, 10);
end;

function Rest( Wanted : Integer): Boolean;
var
s : string;
begin
if (not LoggedIn) then Exit;
FFlag(0);

if GetMMLevels('run', s) >= Wanted then
begin
Result := True;
Exit;
end;

if (not AreResting) then
begin
Mouse(715, 95, 10, 10, False);
Wait(200+random(100));
ChooseOption('est');
Result := True;
end;

end;

okay, now who is telling the truth? how long will it take to get 100 energy with 0 agility while resting???

Naike

2009-06-09 19:31:11

I would have done it this way..

Shorter and more flexibility..


function Rest(Wanted, MaxWait: integer): Boolean;
var
t : integer;
s : string;
begin
if (not LoggedIn) then Exit;
Flag;
Result := (GetMMLevels('run', s) >= Wanted);
If Result Then
Exit;
Mouse(715, 95, 10, 10, False);
Wait(200+random(100));
If Not ChooseOption('est')Then Exit;
MarkTime(t);
Repeat
Wait(500+random(500));
Result := (GetMMLevels('run', s) >= Wanted);
Until(GetMMLevels('run', s) >= Wanted)Or(TimeFromMark(t) > MaxWait)Or(Result)or(Not LoggedIn);
end;

Shuttleu

2009-06-09 19:33:58

function Rest(Wanted: integer): Boolean;
var
t : integer;
s : string;
begin
if (not LoggedIn) then Exit;
FFlag(0);
Result:= (GetMMLevels('run', s) >= Wanted);
if Result then
Exit;
Mouse(715, 95, 10, 10, False);
Wait(200+random(100));
ChooseOption('est');
MarkTime(t);
while (not(TimeFrommark(t) > 180000)) do
begin
Wait(500+random(500));
Result := (GetMMLevels('run', s) >= Wanted);
if Result then
Exit;
end;
end;
even shorter

~shut

Pure1993

2009-06-09 19:35:36

lol, i simply wanted to submit a simple layout, do with it what you want, but this is getting way too picky for me xD

Floor66

2009-06-09 19:37:47

Don't be down man :p
You gave the whole basic thing.. These nitpicks just want it shorter (which is good, but ok). Without you it wouldn't have been made so far ;)

Shuttleu

2009-06-09 19:50:30

From: Floor66
Don't be down man :p
You gave the whole basic thing.. These nitpicks just want it shorter (which is good, but ok). Without you it wouldn't have been made so far ;)


well it would…
i would have just made it from scratch

~shut

marpis

2009-06-09 19:52:06


function Rest: boolean;
begin
if not loggedin then exit;
Mouse(722, 105, 5, 5, false);
wait(200+random(50));
result := ChooseOption('Rest');
wait(2000+random(500));
end;
as i already said, i don't think you should make it wait

Shuttleu

2009-06-09 19:56:09

well what about
function RestUntil(Wanted: integer): Boolean;
var
t : integer;
s : string;
begin
if (not LoggedIn) then Exit;
FFlag(0);
Result:= (GetMMLevels('run', s) >= Wanted);
if Result then
Exit;
Mouse(715, 95, 10, 10, False);
Wait(200+random(100));
if (not(ChooseOption('est'))) then Exit;
MarkTime(t);
while (not(TimeFrommark(t) > 180000)) do
begin
Wait(500+random(500));
Result := (GetMMLevels('run', s) >= Wanted);
if Result then
Exit;
end;
end;

function Rest: Boolean;
begin
Result:= RestUntil(1);
end;
?

~shut

Punkgi

2009-06-09 23:24:37

Will this actually be made and used in scripts? I want it!

Wow I have over 200 posts and still dont know how to script…

Home

2009-06-10 01:49:34

Well here's my shot :)

function Rest(Percent: Integer): Boolean;
var A: Integer;
NR: string;

begin
Result := (GetMMLevels('run', NR) >= Percent);
if Result then Exit;
Mouse(715, 95, 10, 10, False);
Wait(RandomRange(75, 150));
ChooseOption('est');
MarkTime(A);
while (not (TimeFrommark(A) > 80000)) and not Result do
Wait(500 + random(500));
end;


~Home

ShowerThoughts

2009-06-10 01:51:56

From: Home
Well here's my shot :)

function Rest(Percent: Integer): Boolean;
var A: Integer;
NR: string;

begin
Result := (GetMMLevels('run', NR) >= Percent);
if Result then Exit;
Mouse(715, 95, 10, 10, False);
Wait(RandomRange(75, 150));
ChooseOption('est');
MarkTime(A);
while (not (TimeFrommark(A) > 80000)) and not Result do
Wait(500 + random(500));
end;


~Home


You miss the calculation part from when you're at a percent or not.
You just wait in the loop.

Home

2009-06-10 01:54:43

From: Hermen
You miss the calculation part from when you're at a percent or not.
You just wait in the loop.


Hmm ? I thought because i declared my result as GetMMleves it would handle it.. :) ?


~Home

Shuttleu

2009-06-10 02:07:56

nope
if it is less than you want it to be then it will just wait for about 80 seconds

~shut

ZephyrsFury

2009-06-11 14:09:49

I didn't see this thread until after I commited these functions: :(


{*******************************************************************************
function SetRest: Boolean;
By: ZephyrsFury
Description: Turns Rest on. Result True if successful.
*******************************************************************************}

function SetRest: Boolean;
begin
if (CountColorTolerance(3777879, 713, 107, 732, 115, 30) < 10) then
begin
Mouse(715, 95, 10, 10, False);
Wait(100 + Random(100));
Result := ChooseOption('Rest');
end;
end;

{*******************************************************************************
function RestUntil(Energy: Integer): Boolean;
By: ZephyrsFury
Description: Rests until your Run energy is above Energy. Results True if
successful.
*******************************************************************************}

function RestUntil(Energy: Integer): Boolean;
var
S: string;
begin
Result := True;
if (GetMMLevels('run', S) >= Energy) then Exit;
SetRest;
while (GetMMLevels('run', S) < Energy) do
begin
if (CountColorTolerance(3777879, 713, 107, 732, 115, 10) < 30) then
begin
Result := False;
Exit;
end;
Wait(1000 + Random(1000));
end;
end;

Pure1993

2009-06-11 14:47:14

lol, alright, I guess this can be closed now ^^

ZephyrsFury

2009-06-11 14:50:01

From: Pure1993
lol, alright, I guess this can be closed now ^^


No no, I like discussions.

Nadeem

2009-06-11 16:17:44

Not to be too picky :P but Zephyrs' RestUntil can be further shortened!


function RestUntil(Energy: Integer): Boolean;
var
S: string;
begin
Result := True;
if (GetMMLevels('run', S) >= Energy) then Exit;
SetRest;
while (GetMMLevels('run', S) < Energy) do
begin
Result := not (CountColorTolerance(3777879, 713, 107, 732, 115, 10) < 30);
if not Result then Exit;
Wait(1000 + Random(1000));
end;
end;

Unless hmm… not too sure if Result is allowed to be changed around like that several times?



~NS

ZephyrsFury

2009-06-11 16:58:05

From: Nadeem
Not to be too picky :P but Zephyrs' RestUntil can be further shortened!


function RestUntil(Energy: Integer): Boolean;
var
S: string;
begin
Result := True;
if (GetMMLevels('run', S) >= Energy) then Exit;
SetRest;
while (GetMMLevels('run', S) < Energy) do
begin
Result := not (CountColorTolerance(3777879, 713, 107, 732, 115, 10) < 30);
if not Result then Exit;
Wait(1000 + Random(1000));
end;
end;

Unless hmm… not too sure if Result is allowed to be changed around like that several times?



~NS


Thats a good idea and yeah you can change Result as many times as you like, its just like another local variable.

Naum

2009-06-12 00:43:31

My shot:

{*******************************************************************************
function RestUntil(Energy: Integer): Boolean;
By: ZephyrsFury, shortened by NaumanAkhlaQ
Description: Rests until your Run energy is above Energy. Results True if
successful.
*******************************************************************************}

function RestUntil(Energy: Integer): Boolean;
var
S: string;
begin
if (GetMMLevels('run', S) >= Energy) then Exit Else SetRest;
while (GetMMLevels('run', S) < Energy) do
Result := (CountColorTolerance(3777879, 713, 107, 732, 115, 10) < 30);
If Result <> True Then Exit Else Wait(1000 + Random(1000));
end;

Its a bit shorter, but could someone test please :)

Nadeem

2009-06-12 01:26:20

Nice :P I was actually just about to post that same code almost lol

function RestUntil(Energy: Integer): Boolean;
var
S: string;
begin
if (GetMMLevels('run', S) >= Energy) then Exit else SetRest;
while (GetMMLevels('run', S) < Energy) do
Result := not (CountColorTolerance(3777879, 713, 107, 732, 115, 10) < 30);
if not Result then Exit else Wait(1000 + Random(1000));
end;



~NS

ZephyrsFury

2009-06-12 07:08:57

From: Nadeem
Nice :P I was actually just about to post that same code almost lol

function RestUntil(Energy: Integer): Boolean;
var
S: string;
begin
if (GetMMLevels('run', S) >= Energy) then Exit else SetRest;
while (GetMMLevels('run', S) < Energy) do
Result := not (CountColorTolerance(3777879, 713, 107, 732, 115, 10) < 30);
if not Result then Exit else Wait(1000 + Random(1000));
end;

~NS


When looping more than one piece of code you need to have a begin and end around them.

Naum

2009-06-12 19:32:40

Zeph, then why not have an If statement?

{*******************************************************************************
function RestUntil(Energy: Integer): Boolean;
By: ZephyrsFury, shortened by NaumanAkhlaQ
Description: Rests until your Run energy is above Energy. Results True if
successful.
*******************************************************************************}

function RestUntil(Energy: Integer): Boolean;
var
S: string;
begin
if (GetMMLevels('run', S) >= Energy) then Exit Else SetRest;
If (GetMMLevels('run', S) < Energy) Then
Result := (CountColorTolerance(3777879, 713, 107, 732, 115, 10) < 30);
If Result <> True Then Exit Else Wait(1000 + Random(1000));
end;

ZephyrsFury

2009-06-12 19:54:42

From: NaumanAkhlaQ
Zeph, then why not have an If statement?

{*******************************************************************************
function RestUntil(Energy: Integer): Boolean;
By: ZephyrsFury, shortened by NaumanAkhlaQ
Description: Rests until your Run energy is above Energy. Results True if
successful.
*******************************************************************************}

function RestUntil(Energy: Integer): Boolean;
var
S: string;
begin
if (GetMMLevels('run', S) >= Energy) then Exit Else SetRest;
If (GetMMLevels('run', S) < Energy) Then
Result := (CountColorTolerance(3777879, 713, 107, 732, 115, 10) < 30);
If Result <> True Then Exit Else Wait(1000 + Random(1000));
end;


??

What happened to resting until energy >= Energy?

Naum

2009-06-12 19:57:50

Whoops, my bad :(.

Rubix

2009-06-14 00:36:03

takes an average of 38 seconds at 1 agility to go from 1-100 in f2p

Shuttleu

2009-06-14 01:30:25

From: Rubix
takes an average of 38 seconds at 1 agility to go from 1-100 in f2p


is that it?
it takes 20 in p2p with 33 agility :/
not much difference

~shut

Sir R. M8gic1an

2009-06-14 12:53:51

From: Shuttleu
is that it?
it takes 20 in p2p with 33 agility :/
not much difference

~shut


that's a 200% difference :p
for using once, it might not make much of a difference, but in a script when you'd do it, even just 10 times = 10*20 = 200 … 200 / 60 = 3.33 minutes that you saved.

~RM