PDA

View Full Version : GetAmtNeeded



TViYH
09-24-2007, 11:44 PM
{************************************************* ******************************
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
09-25-2007, 12:18 PM
Could be useful if you wanted to make a script that would do an action until the next level up or something :)

R0b0t1
09-29-2007, 12:21 AM
Standards....

Pancakes
10-03-2007, 12:25 AM
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
10-06-2007, 04:36 PM
Thanks for the shortenedness Pancakes!!


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;

Sir R. M8gic1an
10-06-2007, 04:53 PM
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
10-08-2007, 03:55 AM
Just my way of fixing something that isn't broken...