# Antiban Methods to handle antiban. - - - ## TAntiban Main record to handle the built-in WaspLib antiban. - - - ## Antiban.AddTask ```pascal procedure TAntiban.AddTask(interval: Double; method: TAntibanMethod; randomness: Double = 0.2); ``` Schedule a antiban task. An antiban task can be any procedure but they should be short actions that won't break your main script. `interval` is the aproximate interval of time that has to pass for the antiban task to occur and it will be repeated everytime that the interval has passed and the antiban is checked with {ref}`Antiban.DoAntiban`. `method` is a pointer to the task you want to perform. WaspLib includes a couple of them but you may make your own if you want. This task will only occur when **TAntiban.DoAntiban** is called. Example: ```pascal Antiban.AddTask(15 * ONE_MINUTE, @Antiban.HoverSkills); //Every 15 minutes the script will hover the skills. ``` - - - ## Antiban.AddBreak ```pascal procedure TAntiban.AddBreak(interval, length: Double; randomness: Double = 0.2; logoutChance: Double = 0.33); ``` Schedule a break. Breaks can be of short or medium length and should be shorter than any sleep breaks. `interval` is the aproximate interval of time that has to pass for the break to occur and it will be repeated everytime that interval passes and the antiban is checked either with {ref}`Antiban.DoBreak` or {ref}`Antiban.DoAntiban`. `length`, `randomness` and `logoutChance` are the same as {ref}`Antiban.AddSleep`. This break will only occur when {ref}`Antiban.DoAntiban` is called. Example: ```pascal Antiban.AddBreak(30 * ONE_MINUTE, 5 * ONE_MINUTE); //Every 30 minutes the script will take a 5 minute break, subject to variance from the randomness variable. ``` - - - ## Antiban.AddSleep ```pascal procedure TAntiban.AddSleep(time: String; length: Double; randomness: Double = 0.10; logoutChance: Double = 0.5); ``` Schedule a sleep break. A sleep break is a large break, it can be any length but it's usually the several hours and also the largest one/ones. `time` is the aproximate time you want the break to occur and should be written in a "bare" time format (00:00:00). `length` is how long we will sleep for in milliseconds. `randomness` is self explanatory, gives variance to the time our script will sleep at and it's length too. `logoutChance` is the probability of logging out for the sleep break or to simply afk and logout from inactivity. This sleep break will only occur when {ref}`Antiban.DoAntiban` is called and our sleep break is due. Example: ```pascal Antiban.AddSleep('01:30:45', 8 * ONE_HOUR, 0.1, 0.8); //At 01:30:45 on our computer time the script will take a break for 8 hours, subject to variance from the randomness variable. ``` - - - ## Antiban.TakeSleep ```pascal procedure TAntiban.TakeSleep(var task: TSleepTask); ``` Internal function used by {ref}`Antiban.DoAntiban` and is responsible for performing the specified sleep `task`. In other words, this is what makes the script take the sleep break. - - - ## Antiban.TakeBreak ```pascal procedure TAntiban.TakeBreak(var task: TBreakTask); ``` Internal function used by {ref}`Antiban.DoAntiban` and is responsible for performing the specified break `task`. In other words, this is what makes the script take the break. - - - ## Antiban.DoTask ```pascal function TAntiban.DoTask(): Boolean; ``` Checks for scheduled antiban tasks, if any is due it will do it. You should only call this when taking doing an antiban task won't break your script. Returns true if a task was performed. Example: ```pascal Antiban.DoTask(); ``` - - - ## Antiban.DoBreak ```pascal function TAntiban.DoBreak(): Boolean; ``` Checks for scheduled breaks, if any is due it will take it. You should only call this when taking a break won't break your script. Returns true if a break was taken. Example: ```pascal Antiban.DoBreak(); ``` - - - ## Antiban.DoSleep ```pascal function TAntiban.DoSleep(): Boolean; ``` Checks for scheduled sleep breaks, if any is due it will take it. You should only call this when taking a sleep break won't break your script. Returns true if a sleep break was taken. Example: ```pascal Antiban.DoSleep(); ``` - - - ## Antiban.DoAntiban ```pascal function TAntiban.DoAntiban(checkTasks, checkBreaks, checkSleeps: Boolean = True): Boolean; ``` This should be called in your script when antiban sleeps, breaks or tasks won't break your script. When this is called, the setup sleep breaks, breaks and tasks will be checked, if enough time has passed to perform any of them (subject to the parameters you pass in too), they will be performed, otherwise, nothing will happen. Example: ```pascal Antiban.AddTask(15 * ONE_MINUTE, @Antiban.HoverSkills); while True do //Infinite loop Antiban.DoAntiban(); //Antiban.HoverSkills will be called every time 15 minutes passed when this is called. ``` - - - ## Antiban.TimeUntilBreak ```pascal function TAntiban.TimeUntilBreak(task: TBreakTask): String; ``` Check how much time is left until the specified break `task` should be taken. - - - ## Antiban.TimeUntilSleep ```pascal function TAntiban.TimeUntilSleep(task: TSleepTask): String; ``` Check how much time is left until the specified sleep break `task` should be taken. - - - ## Antiban.SimulateBreaks ```pascal procedure TAntiban.SimulateBreaks(bottingDays: UInt64 = 1000); ``` Performs a simulation of `bottingDays` amount of days with the currently setup breaks and prints the results. Example ```pascal Antiban.AddBreak(30 * ONE_MINUTE, 5 * ONE_MINUTE); Antiban.SimulateBreaks(); ``` - - - ## Antiban variable Global {ref}`TAntiban` variable.