Stats

Methods responsible for dealing with the stats tab.

../../images/stats.png

Enum ESkill

ESkill = enum(ATTACK, HITPOINTS, MINING, ..., CONSTRUCTION, HUNTER, TOTAL);

Enum representing all skills in game.


type TSkillInfo

Helper record to read skill information when you hover them in the Stats gametab.


type TStats

Main record used to interact with the Stats gametab.


Stats.SetupGameTab

procedure TStats.SetupGameTab();

Internal method used to setup the type TStats coordinates and internal values.

This is automatically called for you on the Stats variable.


TStats.Skills

Skills: TBoxArray;

TBoxes for each of the Stats skills.

Example:

ShowOnTarget(Stats.Skills);
../../images/stats_skills.png

You can also access each skill box with an index or, more conveniently, with a Enum ESkill.

Example:

ShowOnTarget(Stats.Skills[ESkill.HERBLORE]);
../../images/stats_skill.png

Stats.IsOpen

function TStats.IsOpen(): Boolean;

Returns true/false if the stats gametab is open or not.

Example:

WriteLn Stats.IsOpen();

Stats.Open

function TStats.Open(): Boolean;

Attempts to open the stats gametab.

Example:

WriteLn Stats.Open();

Stats.Hover

function TStats.Hover(skill: ESkill): Boolean;

Moves the mouse over to a skill box.

Example:

WriteLn Stats.Hover(ESkill.CONSTRUCTION);

Stats.FindSkillInfo

function TStats.FindSkillInfo(skill: ESkill; out skillInfo: TSkillInfo): Boolean;

Find and return a TSkillInfo if it matches the one we are looking for.


Stats.GetSkillInfo

function TStats.GetSkillInfo(skill: ESkill; waitTime: Integer = 1000): TSkillInfo;

Get the skill information about a skill when you hover it.

Example:

WriteLn Stats.GetSkillInfo(ESkill.CONSTRUCTION);

Stats.GetLevel

function TStats.GetLevel(skill: ESkill; useCache: Boolean = True): Integer;

Get the level of the specified skill. By default uses the levels cached in the Stats.Levels array.

When using the cached methods, it can be used to retrieve the level of a skill while the gametab is open assuming the level is already cached.

Example:

WriteLn Stats.GetLevel(ESkill.HITPOINTS);

Stats.CacheStats

procedure TStats.CacheStats();

Method to update all cached levels.


Stats.IncrementCachedLevel

procedure TStats.IncrementCachedLevel(skill: ESkill);

Internal method to update cached levels. This is automatically called by Chat.LeveledUp().

Example:

WriteLn Stats.GetCurrentLevel(ESkill.PRAYER);
Stats.IncrementLevel(ESkill.PRAYER);
WriteLn Stats.GetCurrentLevel(ESkill.PRAYER);

Stats.Goals

Stats has a Goals variable where you can configure goal levels for the running script.

You can configure a goal level like this:

{$I WaspLib/main.simba}
begin
  Stats.Goals[ESkill.FIREMAKING] := 50;
end.

By itself, WaspLib doesn’t do anything with this, but you can use the next functions as you please to do an action when any or all goals have been reached, their documentation have examples on how you could terminate the script when a goal has been reached.


Stats.GoalCompleted

function TStats.GoalCompleted(skill: ESkill): Boolean;

Returns true when the specified skill has reached it’s goal level.


Stats.AnyGoalsCompleted

function TStats.AnyGoalsCompleted(): Boolean;

Returns true when any skill has reached it’s goal level.

Example:

{$I WaspLib/main.simba}
begin
  Stats.Goals[ESkill.FIREMAKING] := 50;
  Stats.Goals[ESkill.FLETCHING] := 30;
  Stats.Goals[ESkill.CONSTRUCTION] := 20;
  Stats.Goals[ESkill.WOODCUTTING] := 35;
  repeat
    Sleep(5*TICK);
  until Stats.AnyGoalsCompleted();

  WriteLn 'A skill goal has been reached!';
end.

Stats.AllGoalsCompleted

function TStats.AllGoalsCompleted(): Boolean;

Returns true when all skills have reached their goal levels.

Example:

{$I WaspLib/main.simba}
begin
  Stats.Goals[ESkill.FIREMAKING] := 50;
  Stats.Goals[ESkill.FLETCHING] := 30;
  Stats.Goals[ESkill.CONSTRUCTION] := 20;
  Stats.Goals[ESkill.WOODCUTTING] := 35;
  while True do
  begin
    Sleep(5*TICK);
    if Stats.AllGoalsCompleted() then
      TerminateScript('A skill goal has been reached!');
  end;
end.

Stats variable

Global type TStats variable.