Skip to content

getBonusTime() doesn't return a 0 when the bonus time mechanic is inactive #1924

Open
@Hihahahalol

Description

@Hihahahalol

I was using the getBonusTime() function to check if there is bonus time or not as shown below:

      if (ns.bladeburner.getBonusTime() == 0) { await ns.sleep(ns.bladeburner.getActionTime("General", "Diplomacy")); }
      else { await ns.sleep(ns.bladeburner.getActionTime("General", "Diplomacy") / 5); }

The game kept waiting 12 seconds instead of the desired 60 due to BonusTime() not returning a 0, despite the "actual" bonus time being 0

Using ns.print(ns.bladeburner.getBonusTime()), I can see that the function returns a 0, a 1000 or a 2000 when I have no bonus time shown in the UI and the game is fully open and active. Further testing via spamming the stop/start scrip button shows that it appears to return 0 or 1000 50/50 of the time with 2000 being non-recreatable. Maybe the game just lagged unnoticeably or something when it showed 2000 idk

Save file can be found here: https://discord.com/channels/415207508303544321/415213413745164318/1332247235223748679

Apparently this is caused by the game approximating 3-4 stored cycles into 1000ms, and 0-1-2 cycles into 0ms

I have proposed using one of the following solutions on the Discord:

  1. Make the function return 0 if it detects that the value is at an update's worth, or better if the UI isn't showing bonus time then the function should return a 0. If you don't have any bonus time that you can see then it shouldn't return a "true" if you check for bonus time.

  2. Change the description to state that the function can return small values below [value]ms due to how the game updates. This would let the players know to test for specific time lengths (eg: Check for 60000ms bonus time when testing if there is enough bonus time for "diplomacy")

Bug report and discussion on Discord: https://discord.com/channels/415207508303544321/415213413745164318/1332239717143543830

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions