Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twodsix Compatibility error #203

Closed
zedsupremus opened this issue Oct 10, 2023 · 2 comments
Closed

Twodsix Compatibility error #203

zedsupremus opened this issue Oct 10, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@zedsupremus
Copy link

When used with with twodsix
Seems to throw
logic.js:314 SyntaxError: Invalid or unexpected token
at new Function ()
at HealthEstimate.breakOverlayRender (logic.js:295:12)
at addCharacter (HealthMonitor.js:34:45)
at Array.forEach ()
at Object.onCanvasReady [as fn] (hooks.js:31:10)
at #call (foundry.js:730:20)
at Hooks.call (foundry.js:712:38)
at Canvas.draw (foundry.js:26630:11)
at async Scene.view (foundry.js:23682:7)
at async Game.initializeCanvas (foundry.js:8837:20)

System in question being here in estimation If I'm not mistaken,
https://github.com/mclemente/healthEstimate/blob/e54fbce610b7163d71c62bc87a09bf851ab82e64/module/EstimationProvider.js#L1501C2-L1501C2

To Reproduce
Have 2d6 system
Create actor/animal/vehicle
Drop on canvas.
Inspect Console

Game Specifics (please complete the following information):

  • Twodsix 4.1.0 though its been happening for a long time
  • Health Estimate 31.6.2 though its been happening for a long time

Additional context
I -think- this began either in April or after V11. Its unclear as It was looking fine to a GM but broken for players. (And none of them mentioned it for months)
I have also reported this to Twodsix, its possible it may be related to a change for V11.

@zedsupremus
Copy link
Author

Additionally looks like Ships, Space Objects and robots arent handled correctly (robots and space objects make sense, those are new).

logic.js:175 Health Estimate | Error on getEstimation(). Token Name: "Wasteful Test". Type: "ship". Error: Token's fraction is not valid, it probably doesn't have a numerical HP or Max HP value.
at HealthEstimate.getFraction (logic.js:191:10)
at HealthEstimate.getEstimation (logic.js:162:33)
at HealthEstimate._handleOverlay (logic.js:63:42)
at Object.refreshToken [as fn] (hooks.js:115:23)
at #call (foundry.js:730:20)
at Hooks.callAll (foundry.js:687:17)
at Token.applyRenderFlags (foundry.js:28389:11)
at #applyRenderFlags (foundry.js:27744:44)
at nn.emit (index.js:89:1)
at Dt.update (index.js:89:1)
at Dt._tick (index.js:89:1)

logic.js:175 Health Estimate | Error on getEstimation(). Token Name: "Knowledgeable Test". Type: "robot". Error: Token's fraction is not valid, it probably doesn't have a numerical HP or Max HP value.
at HealthEstimate.getFraction (logic.js:191:10)
at HealthEstimate.getEstimation (logic.js:162:33)
at HealthEstimate._handleOverlay (logic.js:63:42)
at Object.refreshToken [as fn] (hooks.js:115:23)
at #call (foundry.js:730:20)
at Hooks.callAll (foundry.js:687:17)
at Token.applyRenderFlags (foundry.js:28389:11)
at #applyRenderFlags (foundry.js:27744:44)
at nn.emit (index.js:89:1)
at Dt.update (index.js:89:1)
at Dt._tick (index.js:89:1)

logic.js:175 Health Estimate | Error on getEstimation(). Token Name: "Receptive Test". Type: "space-object". Error: Token's fraction is not valid, it probably doesn't have a numerical HP or Max HP value.
at HealthEstimate.getFraction (logic.js:191:10)
at HealthEstimate.getEstimation (logic.js:162:33)
at HealthEstimate._handleOverlay (logic.js:63:42)
at Object.refreshToken [as fn] (hooks.js:115:23)
at #call (foundry.js:730:20)
at Hooks.callAll (foundry.js:687:17)
at Token.applyRenderFlags (foundry.js:28389:11)
at #applyRenderFlags (foundry.js:27744:44)
at nn.emit (index.js:89:1)
at Dt.update (index.js:89:1)
at Dt._tick (index.js:89:1)

@mclemente
Copy link
Owner

I've fixed the original issue.

As for the second issue:

  • Robots and Space Objects didn't exist the last time the system's provider was created. I've added them now.
  • Ships: Any token with 0 current HP and 0 max HP will return as invalid since it will result in a 0/0 division (NaN).
    • In these cases, the error is pretty much a "you forgot to add Max HP on this token" warning, which can be disabled by the "Hide Estimates on Tokens with 0 Max HP" setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants