Skip to content
This repository has been archived by the owner on Jul 5, 2018. It is now read-only.

Hide Game + Autoswitch = Game shows after switching planets #81

Open
Draco18s opened this issue Jul 2, 2018 · 8 comments
Open

Hide Game + Autoswitch = Game shows after switching planets #81

Draco18s opened this issue Jul 2, 2018 · 8 comments

Comments

@Draco18s
Copy link

Draco18s commented Jul 2, 2018

When the script switches planets, it has to show the game canvas in order to do this (that's fine, totally understand), but it doesn't rehide the game after it finishes doing so.

@JeanPaulLucien
Copy link

JeanPaulLucien commented Jul 2, 2018

If you wish, try my fork, where I tried to do that. Or wait for merge, or someone more experienced in JS fixes it.

@ensingm2
Copy link
Owner

ensingm2 commented Jul 2, 2018

Could you give some more info here (browser used, if you're using tampermonkey or copy/pasting code, f your console is throwing errors, etc)? I know I added this feature when adding the ability to pause animations, and things seem to be working for me in both Chrome and Firefox.

@gamingneeds
Copy link

It's happening for me in Chrome, using the Console.

I'm getting this error frequently, not sure if it is directly related:
jquery-1.11.1.min.js?v=.isFTSRckeNhC:4 Uncaught TypeError: Cannot read property '0' of null at Object.success (<anonymous>:300:80) at j (jquery-1.11.1.min.js?v=.isFTSRckeNhC:2) at Object.fireWith [as resolveWith] (jquery-1.11.1.min.js?v=.isFTSRckeNhC:2) at x (jquery-1.11.1.min.js?v=.isFTSRckeNhC:4) at b (jquery-1.11.1.min.js?v=.isFTSRckeNhC:4) at Object.send (jquery-1.11.1.min.js?v=.isFTSRckeNhC:4) at Function.ajax (jquery-1.11.1.min.js?v=.isFTSRckeNhC:4) at INJECT_start_round (<anonymous>:279:5) at SwitchNextZone (<anonymous>:778:4) at CheckSwitchBetterPlanet (<anonymous>:816:4)

Hope this helps and thanks for this amazing script!

@ensingm2
Copy link
Owner

ensingm2 commented Jul 2, 2018

Yeah, that helps a lot, thanks! I'll look into this tomorrow, though it may be a while (need to sleep before I have work in 7 hours, plus actual work day).

Note: Seems like maybe (this is a complete guess from just reading the error) there's a race condition in CheckSwitchBetterPlanet where sometimes it calls SwitchNextZone before the BattleSelectorMap is initialized, and it's trying to iterate through a null list of zones?

@Harest
Copy link
Collaborator

Harest commented Jul 2, 2018

Hum, maybe by removing current_game_is_boss = false; in the end_game function of INJECT_report_boss_damage() would solve the issue. I assume checkUnlockGameState() was called between the switch. It'd need some others edits though as checkUnlockGameState() would be instantly inoperent with this change alone (stopped at the first if).
This error should be in another issue btw as it's not related to the OP but thanks for reporting it anyway.

@ensingm2
Copy link
Owner

ensingm2 commented Jul 2, 2018

It's related to the OP in that the error triggers during a planet switch, breaking the normal js code flow so the re-enabling of the animation state doesn't trigger. The OP issue is a symptom of the issue posted by @gamingneeds (assuming it is the issue causing the problem).

EDIT: Possibly. I can't view code at the moment. I just know that given no errors, previous animation state should be maintained through planet-switches.

@Harest
Copy link
Collaborator

Harest commented Jul 2, 2018

My bad.
Related to my previous message, i think the easiest solution to solve the current issue would be to keep current_game_is_boss = false; in end_game and to add a refresh on current_game_start (current_game_start = new Date().getTime();) so checkUnlockGameState() would not be triggered for nothing, and call a check on planets / zones between a planet switch.
Edit : But this requires to solve #61.

@gamingneeds
Copy link

A new error I received tonight:
Uncaught TypeError: Cannot read property 'destroy' of undefined at CPlanetSelectionState.Shutdown (game.js?v=DOBF9nI9sT2_&l=english:897) at CGame.Update (game.js?v=DOBF9nI9sT2_&l=english:108) at t.gApp.ticker.add [as fn] (game.js?v=DOBF9nI9sT2_&l=english:69) at t.emit (pixi.min.js?v=.tDHAybGykI1O:16) at t.update (pixi.min.js?v=.tDHAybGykI1O:16) at _tick (pixi.min.js?v=.tDHAybGykI1O:16)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants