SRL Archive - Research & Development Lounge

GetAmtNeeded


TViYH

2007-09-24 19:44:39

{*******************************************************************************
function GetAmtNeeded(Skill:string; XPPerItem : integer) : integer;
By: Elkins121
Description: Returns amount of items needed to advance to next level.
Ex. WriteLn('Amount Needed := ' + GetAmtNeeded('Mining', 65));
*******************************************************************************}
function GetAmtNeeded(Skill:string; XPPerItem : integer) : integer;
var
SkillLvlCurr, SkillLvlNxt,SkillXPNeeded,AmtNeeded : integer;
begin
SkillLvlCurr:=GetXP(Skill);
ClearDebug;
SkillLvlNxt:=NextLevelAt(Skill);
ClearDebug;
SkillXPNeeded:=SkillLvlNxt - SkillLvlCurr;
ClearDebug;
AmtNeeded:=SkillXPNeeded/XPPerItem;
ClearDebug;
Result := AmtNeeded;
end;


Tell me what you think…

The Claw

2007-09-25 08:18:07

Could be useful if you wanted to make a script that would do an action until the next level up or something :)

R0b0t1

2007-09-28 20:21:03

Standards….

Pancakes

2007-10-02 20:25:39

Thats a nice idea actually, I like it :)

Kinda shorted, untested.


function ItemsNeededForLevel(Skill : String; XPPerItem : Integer) : Integer;
begin
Result := Ceil((NextLevelAt(Skill) - GetXP(Skill)) / XPPerItem);
end;

TViYH

2007-10-06 12:36:00

Thanks for the shortenedness Pancakes!!

From: Pancakes
Thats a nice idea actually, I like it :)

Kinda shorted, untested.




[LEFT]
function ItemsNeededForLevel(Skill : [COLOR=#000000][B]String[/B][/COLOR]; XPPerItem : Integer) : Integer;
begin
Result := Ceil((NextLevelAt(Skill) - GetXP(Skill)) / XPPerItem);
end;
[/LEFT]



Sir R. M8gic1an

2007-10-06 12:53:19

looks good, but what is up with all the ClearDebugs?
you only need one at the beginning, because when your doing those calculations it doesn't write anything into the debug box. :)
RMagician

TViYH

2007-10-07 23:55:57

Just my way of fixing something that isn't broken…