Misc¶
Misc functions and methods that don’t really fit in a single place at the moment
Level2XP¶
function Level2XP(level: Integer): Integer;
Converts a level to the xp required for that level.
Example:
WriteLn Level2XP(70);
XP2Level¶
function XP2Level(xp: Integer): Integer;
Converts XP to the respective level.
Example:
WriteLn XP2Level(100000);
FormatNumber¶
function FormatNumber(n: Double; dec: Byte = 3): String;
Truncates a number with a runescape like truncation.
Example:
WriteLn FormatNumber(100000); //100k
TColor.Random¶
function TColor.Random(min: Byte = $80): TColor; static;
Returns a random TColor with a min value of brightness.
min is a Byte so it goes from $00 (0) to $FF (255).
Example:
WriteLn TColor.Random();
TColorArray.GetRarest¶
function TColorArray.GetRarest(): TColor;
Returns a the rarest TColor in the TColorArray.
Example:
WriteLn arr.GetRarest();
TStringArray.AnyContains¶
function TStringArray.AnyContains(value: String; caseSensitive: Boolean = True): Boolean;
Returns True/False if any String in the TStringArray contains value.
Activity¶
Global Activity variable.
You can use this to handle the activity in your script.
The idea behind “Activity” is that it’s a timer, by default that runs for 5 minutes. Everytime your script is considered “active” the timer is reset back to the start.
If Activity.IsFinished ever returns True that means your script is inactive
or you are not restarting Activity properly.
By default, WaspLib will restart Activity for your when XPBar.EarnedXP
or XPBar.WaitXP return True.
For more custom ways of using this kind of activity tracker you need to
implement it but you could for example, in a fishing script, restart Activity
whenever you get a fish with:
Activity.Restart();
Using Activity to shutdown your script or correct course is up to you.
A simple way to shutdown your script would be to add this to your main loop:
if Activity.IsFinished then
raise 'Script shutdown due to no activity detected for 5 minutes.';