SRL Archive - SRL Archives

CurrentSkillXp, XpTilNextLevel


phantombmx

2006-05-24 16:34:41

just something that some people have requested for.. it only works with the new zero that Freddy1990 has uploaded here –> http://82.92.130.193/forums/showthread.php?t=1575

these will be in the next SRL version, but i wanted you guys to see em..
NextLevelAt is already in the current SRL ;)

{.include SRL\SRL.scar}

{*******************************************************************************
function NextLevelAt(Skill:String):Integer;
By: phantombmx / formula by Brak, Flyboy
Description: Returns total xp the next level is at for a skill.
*******************************************************************************}
function NextLevelAt(Skill:String):Integer;
var level, p, dif, xp : integer;
begin
p:=GetSkillLevel(Skill);
for level:=1 to p do
begin
dif:=trunc(level+300*pow(2,level/7));
xp:=xp+dif
end;
Result:=(xp/4)
end;
{*******************************************************************************
function CurrentSkillXp(Skill:String):Integer;
By: phantombmx - help from Freddy1990
Description: Returns current xp for a skill.
*******************************************************************************}
function CurrentSkillXp(Skill:String):Integer;
var i : Integer; t: TPoint; tmpResult :String;
begin
GameTab(2);
case lowercase(skill) of
'attack' : t := SkillCoords(1, 1);
'hitpoints' : t := SkillCoords(1, 2);
'mining' : t := SkillCoords(1, 3);
'strength' : t := SkillCoords(2, 1);
'agility' : t := SkillCoords(2, 2);
'smithing' : t := SkillCoords(2, 3);
'defence' : t := SkillCoords(3, 1);
'herblore' : t := SkillCoords(3, 2);
'fishing' : t := SkillCoords(3, 3);
'ranged' : t := SkillCoords(4, 1);
'thieving' : t := SkillCoords(4, 2);
'cooking' : t := SkillCoords(4, 3);
'prayer' : t := SkillCoords(5, 1);
'crafting' : t := SkillCoords(5, 2);
'firemaking' : t := SkillCoords(5, 3);
'magic' : t := SkillCoords(6, 1);
'fletching' : t := SkillCoords(6, 2);
'woodcutting' : t := SkillCoords(6, 3);
'runecrafting' : t := SkillCoords(7, 1);
'slayer' : t := SkillCoords(7, 2);
'farming' : t := SkillCoords(7, 3);
end;
MMouse(t.x, t.y + 12, 5, 5);
Wait(200+random(300));
tmpResult:= GetTextAtEx(612, 428, 0, SmallChars, False, False, 0, 5, 65535, 10, True, tr_Digits)
if (Trim(tmpResult) = '') then
for i := 1 to 50 do
begin
tmpResult:= GetTextAtEx(612+i, 428, 0, SmallChars, False, False, 0, 5, 65535, 10, True, tr_Digits)
if (Trim(tmpResult) <> '') then Exit;
end;
if (not (Trim(tmpResult) = '')) then
Result := StrToInt(Trim(tmpResult));
end;
{*******************************************************************************
function XpTilNextLevel(Skill:String):Integer;
By: phantombmx
Description: Returns current xp til you level up in a skill.
Rounds to a good amount if told to.
*******************************************************************************}
function XpTilNextLevel(Skill:String; Round:Boolean):Integer;
var aa :Extended; bb :Integer;
begin
Result:=NextLevelAt(Skill)-CurrentSkillXp(Skill);
if(Round)then
begin
if(Result>=1000)then
begin
aa:=Result/1000;
bb:=Trunc(aa)*1000;
Result:=bb;
Exit;
end;
if(Result>=100)then
begin
aa:=Result/100;
bb:=Trunc(aa)*100;
Result:=bb;
end;
end;
end;

Spky

2006-05-24 16:42:30

Finally finished :p, looks nice phantom.