SRL Archive - Reflection Help

How to get your levels?


Troll

2010-11-27 12:26:48

So how could i get my level plus tell me when i level up.
Thanks

Cstrike

2010-11-27 12:30:06

Enjoy :)

// By: Cstrike
function GetTempLevel (SkillName : String) : Integer;
begin
Result := -1;
if not I_LoggedIn then Exit;
if I_OpenStatsTab then
begin
case lowercase(SkillName) of
'attack', 'att': Result := StrToInt(GetInterfaceComponentText(320, 196));
'defence', 'defense', 'def': Result := StrToInt(GetInterfaceComponentText(320, 24));
'strength': Result := StrToInt(GetInterfaceComponentText(320, 7));
'hitpoints', 'hp', 'constitution': Result := StrToInt(GetInterfaceComponentText(320, 189));
'range', 'ranged': Result := StrToInt(GetInterfaceComponentText(320, 48));
'mage', 'magic': Result := StrToInt(GetInterfaceComponentText(320, 89));
'prayer', 'pray': Result := StrToInt(GetInterfaceComponentText(320, 72));
'runecrafting', 'runecraft', 'rc': Result := StrToInt(GetInterfaceComponentText(320, 106));
'construction', 'cons', 'con': Result := StrToInt(GetInterfaceComponentText(320, 130));
'dung', 'dungeon', 'dungeoneering': Result := StrToInt(GetInterfaceComponentText(320, 154));
'agility', 'agil': Result := StrToInt(GetInterfaceComponentText(320, 15));
'herb', 'herblore', 'herblaw': Result := StrToInt(GetInterfaceComponentText(320, 32));
'thieving', 'thief': Result := StrToInt(GetInterfaceComponentText(320, 56));
'crafting', 'craft': Result := StrToInt(GetInterfaceComponentText(320, 80));
'fletching', 'fletch': Result := StrToInt(GetInterfaceComponentText(320, 97));
'slayer', 'slay', 'slaying': Result := StrToInt(GetInterfaceComponentText(320, 114));
'hunter', 'hunt': Result := StrToInt(GetInterfaceComponentText(320, 138));
'mining', 'mine': Result := StrToInt(GetInterfaceComponentText(320, 182));
'smithing', 'smith', 'smelt': Result := StrToInt(GetInterfaceComponentText(320, 175));
'fishing', 'fish': Result := StrToInt(GetInterfaceComponentText(320, 40));
'cooking', 'cook': Result := StrToInt(GetInterfaceComponentText(320, 64));
'firemaking', 'fm', 'fire': Result := StrToInt(GetInterfaceComponentText(320, 168));
'woodcutting', 'wc', 'wood', 'woodcut': Result := StrToInt(GetInterfaceComponentText(320, 161));
'farming', 'farm': Result := StrToInt(GetInterfaceComponentText(320, 122));
'summoning', 'summon': Result := StrToInt(GetInterfaceComponentText(320, 146));
end;
end;
end;

EDIT: Add this above the others or it wont work:

function GetInterfaceComponentText (ParentI, ChildI: Integer): String;
begin
Result := GetInterfaceText (ParentI, ChildI);
end;

Troll

2010-11-27 12:32:07

Thanks thats great :) is it in the inclued or do i need to put it in my script?

Cstrike

2010-11-27 12:32:47

From: Troll Man
Thanks thats great :) is it in the inclued or do i need to put it in my script?


Put both in your script (last function first that I edited in)

Troll

2010-11-27 12:37:37

so it would be

function GetInterfaceComponentText (ParentI, ChildI: Integer): String;
begin
Result := GetInterfaceText (ParentI, ChildI);
end;

// By: Cstrike
function GetTempLevel (SkillName : String) : Integer;
begin
Result := -1;
if not I_LoggedIn then Exit;
if I_OpenStatsTab then
begin
case lowercase(SkillName) of
'attack', 'att': Result := StrToInt(GetInterfaceComponentText(320, 196));
'defence', 'defense', 'def': Result := StrToInt(GetInterfaceComponentText(320, 24));
'strength': Result := StrToInt(GetInterfaceComponentText(320, 7));
'hitpoints', 'hp', 'constitution': Result := StrToInt(GetInterfaceComponentText(320, 189));
'range', 'ranged': Result := StrToInt(GetInterfaceComponentText(320, 48));
'mage', 'magic': Result := StrToInt(GetInterfaceComponentText(320, 89));
'prayer', 'pray': Result := StrToInt(GetInterfaceComponentText(320, 72));
'runecrafting', 'runecraft', 'rc': Result := StrToInt(GetInterfaceComponentText(320, 106));
'construction', 'cons', 'con': Result := StrToInt(GetInterfaceComponentText(320, 130));
'dung', 'dungeon', 'dungeoneering': Result := StrToInt(GetInterfaceComponentText(320, 154));
'agility', 'agil': Result := StrToInt(GetInterfaceComponentText(320, 15));
'herb', 'herblore', 'herblaw': Result := StrToInt(GetInterfaceComponentText(320, 32));
'thieving', 'thief': Result := StrToInt(GetInterfaceComponentText(320, 56));
'crafting', 'craft': Result := StrToInt(GetInterfaceComponentText(320, 80));
'fletching', 'fletch': Result := StrToInt(GetInterfaceComponentText(320, 97));
'slayer', 'slay', 'slaying': Result := StrToInt(GetInterfaceComponentText(320, 114));
'hunter', 'hunt': Result := StrToInt(GetInterfaceComponentText(320, 138));
'mining', 'mine': Result := StrToInt(GetInterfaceComponentText(320, 182));
'smithing', 'smith', 'smelt': Result := StrToInt(GetInterfaceComponentText(320, 175));
'fishing', 'fish': Result := StrToInt(GetInterfaceComponentText(320, 40));
'cooking', 'cook': Result := StrToInt(GetInterfaceComponentText(320, 64));
'firemaking', 'fm', 'fire': Result := StrToInt(GetInterfaceComponentText(320, 168));
'woodcutting', 'wc', 'wood', 'woodcut': Result := StrToInt(GetInterfaceComponentText(320, 161));
'farming', 'farm': Result := StrToInt(GetInterfaceComponentText(320, 122));
'summoning', 'summon': Result := StrToInt(GetInterfaceComponentText(320, 146));
end;
end;
end;

Procedure Blah;
Begin
Blalh
AttLevel := GetTempLevel('Att')
Blah
End

Method

2010-11-27 13:05:00

What's wrong with GetMe.Levels[idx]?

Cstrike

2010-11-27 13:18:50

From: Method
What's wrong with GetMe.Levels[idx]?


IIRC GetMe.Levels gets the bottom level, I could definitely be wrong though.

TRiLeZ

2010-11-27 14:49:20

From: cstrike
IIRC GetMe.Levels gets the bottom level, I could definitely be wrong though.


No, it gets the top levels. GetMe.SkillExperiences -> Level gets the bottom levels.