question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Negative value of TimeTillHiddenMs

See original GitHub issue

I’m using code like this to get spawned pokemon on users location

 Pokeio.Heartbeat(function (err, hb) {
      if (err) {
        return errorHandler(err, callback);
      }

      for (let i = hb.cells.length - 1; i >= 0; i--) {
            if (hb.cells[i].WildPokemon) {
              for (let j = 0; j < hb.cells[i].WildPokemon.length; j++) {
                  console.log(hb.cells[i].WildPokemon[j].TimeTillHiddenMs / 1000);
                }
            }
       }
});

and sometimes get negative values (like -375492.726) of TimeTillHiddenMs / 1000. What is the right way to handle them? Didn’t have opportunity to locate bug somewhere near mine location so could check what happenning in game at the moment.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
andnpcommented, Jul 24, 2016

I suppose a possible way to resolve this issue would be to provide an example for how to deal with this in example.js.

I have been dealing with it by simply providing a check in the heartbeat function like:

for (let j = 0; j < hb.cells[i].WildPokemon.length; j++) {
  if (hb.cells[i].WildPokemon[j].TimeTillHiddenMs > 0) {
    // Do something here (encounter and catch for instance)
  }
}
0reactions
WiS3commented, Jul 26, 2016

@andnp Ok i did some testing. Catching it or not doesn’t seem to have any effect. It however changed after some minutes that i catched.

Probably it is true that those pokemon have a > 15min timer, and while it is > 15min it has a negative value. But it is strange that with a Catching bot there are problems, while in game not.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Number.NEGATIVE_INFINITY - JavaScript - MDN Web Docs
The Number.NEGATIVE_INFINITY property represents the negative Infinity value.
Read more >
How to use a negative value in table's variable (i... - ServiceNow
I want the value of the variable field integer in the negative, there is some script is running background to calculate the client...
Read more >
Negative Values with Dependence - XBRL US
This rule tests that the values for a given list of elements are negative when a ...
Read more >
NEGATIVE TIME VALUE - Microsoft Community Hub
I have a report that is being exported from Global Shop Solutions > Crystal Reports Viewer and then into Excel. I have 2...
Read more >
Are there any consequences to having negative values in your ...
Many time series models assume Gaussian error terms, meaning that all real numbers are possibilities. In that sense, negative values are ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found