SRL Archive - SRL Archives

CheckRun


Torrent of Flame

2009-02-13 13:21:09

Pretty basic, quite handy.

{*******************************************************************************
procedure CheckRun
Description: Checks your run % and clicks on run if it is above your percentage
By: Torrent of Flame
*******************************************************************************}
function CheckRun(WhatPercent: Byte): Boolean;
var
Runcolor: string;

begin
Result := (GetMMLevels('run', runcolor) > WhatPercent);
if Result then SetRun(True);
end;

Can Change Energy to whatever you want.

In Use;

CheckRun(75);

NCDS

2009-02-13 13:36:45

I like it.

Maybe Ill use in my new Script?

Should be out soon ;)

Torrent of Flame

2009-02-13 15:38:43

Cool ^.^

noidea

2009-02-13 15:57:20

Why make it a boolean if it is goig to return true every time?

TViYH

2009-02-13 16:04:07

a > b

a:

{*******************************************************************************
procedure DoRun;
Description: Checks your run % and clicks on run if it is above your percentage
By: Torrent of Flame
*******************************************************************************}
procedure DoRun(WhatPercent: integer);
var
Energy: Integer;
Runcolor: string;
begin
Energy:= GetMMLevels('run', runcolor);
if(Energy > WhatPercent) then SetRun(True);
end;

Yours is b.

No need to make it a function, let alone a boolean.

ZaSz

2009-02-13 16:04:51

change
if(Energy > WhatPercent) then SetRun(True);
Result := True;


to
if(Energy > WhatPercent) then begin SetRun(True);
Result := True;
end else
result := false;

noidea

2009-02-13 16:06:26

There is not a bloolean needed. TViYH's is sufficient. Fine function though ToF.

ZaSz

2009-02-13 16:10:17

i think a boolean would be great because,

if not checkrun(75) then writeln('You do not have the run requirement for this part of the quest.');

^ would be useful if you are making a quester that needs 75% run energy or a guaranteed fail would happen.

Torrent of Flame

2009-02-13 16:27:35

Ill make it a procedure.

TViYH

2009-02-13 16:38:47

From: zasz
i think a boolean would be great because,

ScarScript:By Drunkenoldma [LEFT]if not checkrun(75) then writeln('You do not have the run requirement for this part of the quest.'); [/LEFT]

^ would be useful if you are making a quester that needs 75% run energy or a guaranteed fail would happen.


But how his procedure would do would always return true.

ZaSz

2009-02-13 16:41:48

From: TViYH
But how his procedure would do would always return true.


Im saying with my fix I posted earlier, it makes it return true/false

Torrent of Flame

2009-02-13 17:16:50

Ah it doesnt matter, to be honest :D

Wizzup?

2009-02-13 17:39:05

From: zasz
change
if(Energy > WhatPercent) then SetRun(True);
Result := True;


to
if(Energy > WhatPercent) then begin SetRun(True);
Result := True;
end else
result := false;


Or


Result := Energy > WhatPercent;
If Result Then
SetRun(True);

Torrent of Flame

2009-02-13 17:40:03

I made it a procedure. It isnt really necessary to have a boolean to be honest.

Baked0420

2009-02-13 18:57:13

haha I remember when I taught you how to use this bout maybe two weeks ago, good to see you still use it and are making it even more useful. I see you are even still using the same variables name that I used to teach you :p same variable names I use.

Torrent of Flame

2009-02-14 04:12:44

^ You didnt really teach it too me. you told me about the run colour to I modified your ideas :D

Kasi

2009-02-14 05:47:34


procedure CheckRun(WhatPercent: integer);
var
Energy: Integer;
Runcolor: string;

begin
Energy:= GetMMLevels('run', runcolor);
if(Energy > WhatPercent) then SetRun(True);
end;


Function CheckRun(WhatPercent: integer) : Boolean;
Var
RunColor: string;
Begin
Result := (GetMMLevels('run', RunColor) >= WhatPercent);
If Result Then
SetRun(True);
End;

Torrent of Flame

2009-02-14 08:03:59

It doesnt need to be a function!!

Kasi

2009-02-14 08:09:20

ok it doesnt it doesnt need that extra var tho

Torrent of Flame

2009-02-14 08:13:10

What Runcolour?

The procedure for the MM needs to have Runcolor, or the procedure will not work.

EvilChicken!

2009-02-14 08:16:19

It's funny how much arousal that can be caused by two lines. :p

As Wizzup? said, this would be the best solution IMO.

function CheckRun(WhatPercent: Byte): Boolean;
var
Runcolor: string;

begin
Result := (GetMMLevels('run', runcolor) > WhatPercent);
if Result then SetRun(True);
end;

E: Why not have it as a boolean function? An extra feature can't hurt.

Baked0420

2009-02-14 08:44:17

yea I pretty much teached it to you. You were going to just do SetRun(True); when you wanted to run, I showed you how to check but I don't care. I'm just glad this is being used more now, I never really saw to many people use this and I searched these forums for a while to find a procedure/function that does what GetMMLevels does. And I agree why not make it a function? it would makke it a little better so you can do if/thens.

Torrent of Flame

2009-02-14 08:51:29

^.^


Fiine. If it matters that much, Ill put it as EC has said.

Baked0420

2009-02-14 09:48:47

what evilchicken said is good and all, but I think it should be like this:

function CheckRun(WhatPercent: Byte; color: String): Boolean;
var
Runcolor: string;

begin
Result := (GetMMLevels('run', runcolor) > WhatPercent) or (GetMMLevels('run', runcolor) = color);
if Result then SetRun(True);
end;

and for the color variable they can enter 'Green', 'Yellow', 'Orange', or 'Red'. Incase they want to turn run on/off at a certain color, and not number, just what I'd do to make it more user friendly.

Naike

2009-02-14 10:12:22

This has been done before..

had one in my anti crabber script ages ago ^^

Torrent of Flame

2009-02-14 11:36:13

and for the color variable they can enter 'Green', 'Yellow', 'Orange', or 'Red'.

And from where would those values come from?

And N1ke, its never really been used that much, AFAIK.

Kasi

2009-02-14 11:53:28

before i was trying to point out the extra variable energy was not needed

Baked0420

2009-02-14 12:53:42

When I first showed you this, I tried explaining to you, runcolor is a variable for the different colors the numbers are, 1-25 = red, 26-50= yellow? 51-75= orange? and 76-100= green, yellow and orange maybe mixed up. But GetMMLevels('run'…. returns how much energy you have and what color it is. And AFAIK also it isn't used much, that's what I said up on my first post on this thread I think.

Sir R. M8gic1an

2009-02-14 13:15:41


if GetMMLevels('run', RunColor) >= WhatPercentage then
SetRun(true);

i woudn't really say it's needed…

~RM

Wizzup?

2009-02-14 14:13:13

I say it should definitely return a boolean.

Torrent of Flame

2009-02-14 14:15:29

Well it does now. I had it in the first place to be honest. I dont know why I listened to people who said it should be a procedure!

EDIT: When do I get my SRL Helper cup? :PP

Nava2

2009-02-14 15:06:19

{*******************************************************************************
procedure CheckRun
Description: Checks your run % and clicks on run if it is above your percentage
By: Torrent of Flame
*******************************************************************************}
function CheckRun(WhatPercent: Integer): Boolean;
var
Runcolor: string;
begin
Result := GetMMLevels('run', runcolor) >= WhatPercent;
SetRun(Result);
end;

Magiic

2009-02-14 15:15:09

would it? result : = runenergy> percent set;, can be true or false

Torrent of Flame

2009-02-14 15:35:55

So much uproar about such a simple procedure xDD