I just tested this on a brand new project using only that script, and setting the IDs of the Game Switches. I only tested Lock Scroll (to lock in both directions) and using just the one Game switch, it works just fine. Next, I set the Switch ID in the Config to nil (it is in the Script I posted itself), then used a Script Call to run $game_system.lock_map_scroll = true, and that works fine as well.
Possible common bugs:
- Running an Autorun Event that is either not Erased, or change Page Conditions
- Player may have been given a Move Route Repeat command
- Script Conflict: Scripts that replace things that this script changes can sometimes conflict
Possible Fixes:
- For Autorun, make sure the Event is either Erased or change Page Conditions so it cant continue to run
- Dont give the Player a Repeating Move Route without changing it again later
- Script: Try using a Game Switch, then press F9 to turn that Game Switch off
- Disable other Scripts by putting __END__ with no following characters at the top of other Scripts
- Check for Order of Scripts - you should be able to put this script anywhere below Scene_Debug, SDK, or Modular Passable if used and above main
- Direct Script Conflict - Two scripts that replace any Method like def scroll_map(direction, distance, speed) will not work together, pick one
Since both getting completely stuck and using Scripts are very common, I'll give a very Generalized answer which may affect many people for things that are unrelated to this script, but Script Usage in general. I will add a section into the documentation to explain why this type of Game Hang can occur.
Look at your Default Scripts: Interpreter (page 7) -> def command_355 at line 276 where it says "return false". Many scripts that people write bypass this check by putting a # character in front of "return false" so it reads "# return false". This is due to script calls they want to run by a Script Call to execute, but evaluate to false. This typically happens when changing
ANY setting from true to false, such as $game_system.lock_map_scroll = false will return false and cause the game to hang, which is why it is disabled frequently. I had forgotten about this bug that is native to the default script set, and it does appear to affect this script as well when using a Script Call to run $game_system.lock_map_scroll = false
There are two possible fixes for this:
- Add a line into your script call that reads "return true", which may be a nightmare if your game uses many script calls (more work for you)
- Comment out the line that reads "return false" on Interpreter 7 line 276 so it now reads "# return false" which prevents continuation (less work for you)
I understand why this was written this way, but one of the issues with RPG Maker XP is that some of the methods were written in such a way that altering the behavior without replacing a method is impossible without altering all other offending scripts, which may be prohibited by the licenses they grant. This is the style of code writing that gave need to the SDK for RPG Maker XP. Later versions of RPG Maker that are Ruby based are written in such a way that there is no need for an SDK. A truly useful solution would be to customize script behavior would have been for Enterbrain to replace the line that reads "if result == false" with something other scripters could modify the outcome more easily.
---
Edit: Okay, updated the script with better documentation. I know I can be a bit wordy. Also, one bugfix.