Disable enemy this.debug() and debug objects?


#1

Is there a way to disable enemy console.log entries with this.debug()?
Some are spamming so much that my own disappear because the 200 log limit is reached.
Note that this also blocks the simulators Round overviews in criss-cross

If this is not possible, I would suggest a new feature

  1. log limit applies to a player, not to the total simulation
  2. never block symulator messages like round overviews in criss-cross

On a related question I see some people log entire objects (in google chrome)

How do you achieve this? I tried JSON.stringify() but it does not like the recursion in tiles.neighbours :smile:


#2

To log an object you simply pass it to this.debug, just like you would do with console.log:

this.debug(this.getTile(0, 0));

#3

That simple huh. Thx :smile:
I always add some round and turn info text to my debug lines, thats why it would only return [object] that would not expand.


#4

Just like console.log, this.debug accepts multiple arguments:

this.debug("Tile 1:", this.getTile(0, 0), "Tile 2:", this.getTile(1, 1));

#5

I don’t think we’re going to mess too much with this.debug(), because it is a janky workaround until we can get our better debugging working 100%.


#6

ok, how about this one.
Source:

 this.debug("DBG: Dynamic (tile-"+tile.x+","+tile.y+"): 17->"+tree[17], tree);

result:

Blind Io's Archer| DBG: Dynamic (tile-2,3): 17->17 [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 49, 50]

I can’t wrap my head around this one, I’m trying to debug a bug in my new algorithm, but tree[17] returns 17 (which is good btw) but the 17th element in the tree array appears to be -1

Is this a bug in this.debug? Am I doing something wrong? or is this a bug in the simulator?
info: this tree array is a parameter of a function. And the line before the this.debug() I do this:

 if(tree[linearTile] === -1) tree[linearTile] = linearTile;

(where LinearTile = 17)


#7

Can it be that the object that you’re logging is an API-protected clone, and the clone has been modified since it was created, so when you access the 18th element, you get the modified value, but when you go to log it, the original is there with the original -1?


#8

No, but I guess you already got that from my other post :slight_smile: