Skip to content

Conversation

@BaldPRs
Copy link
Contributor

@BaldPRs BaldPRs commented Jan 3, 2026

Problem:

TimeUntilBreak is awkward for programmatic use. It returns a formatted string, which is useful for logging but requires parsing to use in logic. To retrieve the MS until an antiban sleep or break you have to use something similar to the example code which is difficult to read, and mentioned nowhere in the docs.

Suggestion:

Add two helper functions that return the raw milliseconds until the next scheduled break/sleep (if one exists):
MsUntilBreak(): Double
MsUntilSleep(): Double

Example Before:

{$I WaspLib/osrs.simba}

begin
  if ((Length(Antiban.Breaks) > 0) and (Antiban.Breaks[0].Next - GetTimeRunning() < Random(140, 240) * ONE_SECOND)) or
     ((Length(Antiban.Sleeps) > 0) and (Antiban.Sleeps[0].Next - GetTimeRunning() < Random(140, 240) * ONE_SECOND)) then
    WriteLn('Break coming soon!');
end;

Example After:

{$I WaspLib/osrs.simba}

begin
  if (Antiban.MsUntilBreak() < Random(140, 240) * ONE_SECOND) or
     (Antiban.MsUntilSleep() < Random(140, 240) * ONE_SECOND) then
    WriteLn('Break coming soon!');
end;

Use Case

A Scripter wants to clean up or perform specific actions before a break interrupts execution. This helper now allows the scripter to perform a simple MS comparison against the upcoming break/sleep.

@BaldPRs BaldPRs changed the title Add MsUntilBreak, and MsUntilSleep AntiBan helpers feat: Add MsUntilBreak, and MsUntilSleep AntiBan helpers Jan 3, 2026
@BaldPRs BaldPRs changed the title feat: Add MsUntilBreak, and MsUntilSleep AntiBan helpers feat(Antiban): Add MsUntilBreak, and MsUntilSleep AntiBan helpers Jan 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant