Error thrown when getting Map Scene width

Are you using plugins? Did you disable them first? Does the bug still happen? Then report here.


No, this happens on a brand new 1.3.1 project.


Is your bug already reported by another person? Don't make a new topic. Reply to that thread instead if you have anything substantial to add.


I'll be honest, I haven't checked, but seeing as this is an issue only plugin developers would encounter in rather specific circumstances, I doubt it.


Bug Explanation: (What is the bug in your own words? Keep this detailed. "It isn't working right" is not a valid bug report.)


When attempting to get the width of the map scene, a TypeError is thrown. This does not crash the game if it's run when the scene is already running, however it does crash the game if it's called while the scene is loading (By what black magic I do not know). 


Error Report: (If you received an error message, press F8 when the message is received to open up the debug console, then copy/paste the entire error log and paste it here).

Spoiler
Y5BUG6Y.png



Exact Steps on How to Replicate Bug: (Write out IN DETAIL, a step-by-step guide on how to replicate the bug.)

  1. Start game.
  2. Get on map
  3. Open dev console
  4. Type in "SceneManager._scene.width"
  5. Press enter
  6. ???
  7. Error





Sample Project (REQUIRED): A sample project MUST be attached to the bug report. All steps MUST be followed. If a single step is ignored, the bug report is invalid and I will move on to the next bug report.  If you do not attach a sample project to the bug report, your bug report WILL BE ignored. This must be kept under 90 MB lower. Do not include RTP Graphics save for the ones used. You must make this project as small as possible. There are NO exceptions.


I don't really find this to be necessary, but since it's a requirement, I've got one here. I removed a lot of things to get it to be small, so the main menu won't open because an image is missing. You should still be able to get the issue just by creating a brand new project and doing the steps listed above.


Now like I said, this doesn't crash the game, and I have a way to get around the issue so really it's no big deal, but I just figured you should be made aware so that it can be fixed in a future update if anyone finds out why it's broken as such.
Are you using plugins? Did you disable them first? Does the bug still happen? Then report here.


No, this happens on a brand new 1.3.1 project.


Is your bug already reported by another person? Don't make a new topic. Reply to that thread instead if you have anything substantial to add.


I'll be honest, I haven't checked, but seeing as this is an issue only plugin developers would encounter in rather specific circumstances, I doubt it.


Bug Explanation: (What is the bug in your own words? Keep this detailed. "It isn't working right" is not a valid bug report.)


When attempting to get the width of the map scene, a TypeError is thrown. This does not crash the game if it's run when the scene is already running, however it does crash the game if it's called while the scene is loading (By what black magic I do not know). 


Error Report: (If you received an error message, press F8 when the message is received to open up the debug console, then copy/paste the entire error log and paste it here).

Spoiler
Y5BUG6Y.png



Exact Steps on How to Replicate Bug: (Write out IN DETAIL, a step-by-step guide on how to replicate the bug.)

  1. Start game.
  2. Get on map
  3. Open dev console
  4. Type in "SceneManager._scene.width"
  5. Press enter
  6. ???
  7. Error





Sample Project (REQUIRED): A sample project MUST be attached to the bug report. All steps MUST be followed. If a single step is ignored, the bug report is invalid and I will move on to the next bug report.  If you do not attach a sample project to the bug report, your bug report WILL BE ignored. This must be kept under 90 MB lower. Do not include RTP Graphics save for the ones used. You must make this project as small as possible. There are NO exceptions.


I don't really find this to be necessary, but since it's a requirement, I've got one here. I removed a lot of things to get it to be small, so the main menu won't open because an image is missing. You should still be able to get the issue just by creating a brand new project and doing the steps listed above.


Now like I said, this doesn't crash the game, and I have a way to get around the issue so really it's no big deal, but I just figured you should be made aware so that it can be fixed in a future update if anyone finds out why it's broken as such.



you have 3 choice


SceneManager._screenWidth ;


$gameMap.width() ;


$gameMap.tileWidth();


is ok for you ?
I already had a way to get around the issue for this specific instance, I used Graphics.width instead, but it's an odd little issue that would be nice to have fixed, since you don't expect that to throw an error at you. 
A scene doesn't have a width.  A map has a width.  If you want the width of the current map, use $gameMap.width()


SceneManager._scene, when you're on a map, refers to a Scene_Map object, not a Game_Map object.
I already had a way to get around the issue for this specific instance, I used Graphics.width instead, but it's an odd little issue that would be nice to have fixed, since you don't expect that to throw an error at you. 

you type 


SceneManager._scene.width


SceneManager._screenWidth
A scene doesn't have a width.  A map has a width.  If you want the width of the current map, use $gameMap.width()


SceneManager._scene, when you're on a map, refers to a Scene_Map object, not a Game_Map object.



They do have widths, actually. Scenes are Pixi containers. Pixi containers widths are based on their children. I was looking for the width of the scene, but I ended up just using the width of the screen instead. I just wanted to point out that there's an error somewhere with the map scene or its children. And like I said, this bug isn't critical at all. If they never fix it, fine, it's not a big deal, but I found a bug so I reported it.

Spoiler
eBIALNy.png


you type 


SceneManager._scene.width


SceneManager._screenWidth



Either would work, but I use Graphics.width because it's shorter and doesn't make use of a private variable. And yes SceneManager._scene.width is valid. If it weren't already programmed into the game, it would not even be able to throw an error, but would return undefined. However, on the map scene (And as far as I know only the map scene), it will throw a type error.

Original thread: https://forums.rpgmakerweb.com/threads/error-thrown-when-getting-map-scene-width.67241/