saliengame_idler icon indicating copy to clipboard operation
saliengame_idler copied to clipboard

Hide Game + Autoswitch = Game shows after switching planets

Open Draco18s opened this issue 6 years ago • 8 comments

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.

Draco18s avatar Jul 02 '18 02:07 Draco18s

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

JeanPaulLucien avatar Jul 02 '18 03:07 JeanPaulLucien

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.

ensingm2 avatar Jul 02 '18 04:07 ensingm2

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!

gamingneeds avatar Jul 02 '18 04:07 gamingneeds

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?

ensingm2 avatar Jul 02 '18 04:07 ensingm2

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.

Harest avatar Jul 02 '18 05:07 Harest

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.

ensingm2 avatar Jul 02 '18 05:07 ensingm2

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.

Harest avatar Jul 02 '18 05:07 Harest

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)

gamingneeds avatar Jul 02 '18 10:07 gamingneeds