The simple script of complicated issues that had a simple fix
This is a blog post about my scanlines script, which was released inside the Restaff Retro Revolution release. The script itself was released with 1 known limitation. This limitation however was much larger than initially expected. The following blog post details what happened. The new version of the scanlines script without any such limitation is also included at the bottom. I hope you find this post an interesting read!
Okay so the initial limitation in the old script was that it required a new scene to be run, most specifically using SceneManager.call(Scene_Class). When you warp the player from one Game Map to another, you are not actually changing scenes. The observation and results of the current map are handled by Scene_Map class, data referenced via $game_map (which in itself is the Game_Map class). What happens on the back-end when you change maps with this knowledge in hand? Well, Game_Interpreter sets $game_map to the new map and Scene_Map transfers the player from the old map to the new map. So according to SceneManager, you have been within Scene_Map the entire time, you have not actually called a new scene. A single Scene handles all map processing. Because the old script relied on the start method for all scenes, a new scene needed to be entirely called.
It was basically overlooking something + making 1 too many assumptions on my part that created the problem. I just assumed the scene start method would be run in Scene_Map every time a new map was called. This assumption proved wrong and come to think of it, its something I should have known (or did know but forgot I knew). So once you [Amerk] told me about the problem I pretty much instantly realized this while sitting on the crapper. I also realized the script was essentially broken in its released state so I made the update.
So the updated script has an aliased update method (which applies to all game scenes) in Scene_Base that checks if scanlines are enabled. If the scanline setting is modified, they will instantly be re-drawn (on the next Scene update cycle, which if the player is idle or a scene is waiting for input, is by default 60 times per second, or every frame).
Updated Scanlines Script (inside spoiler):
#===============================================================================# * Gumps Simple and Advanced Scanlines Script# VERSION: 1.05.RETRO.RELEASE.HOTFIX_A# AUTHOR: Matt 'Gump' Sully#------------------------------------------------------------# > This script is intended to provide simple scanlines for all scenes in any# game.# > Scanlines are drawn inside an open, transparent window that is above# everything else. Keep this in mind when going through the settings.# > This script is an exclusive Retro Revolution (rpgmakervxace.net) release.#------------------------------------------------------------# * Bug Fixes since initial release# > Scanlines will now enable or disable instantly when the toggle option is used.#------------------------------------------------------------# * Commands# toggle_scanlines# > put this command in an event script call to enable or disable the scanlines.#------------------------------------------------------------# > Contact: user 'Gump' on rpgmakervxace.net#===============================================================================# * LEGAL INFORMATION# > You may freely use this script in any free or commercial game.# > If you use this script, providing credit is optional, not required.#===============================================================================# * Data Initialization Area, dont touch this part.#module Gump # don't touch this line. module Retro # don't touch this line. SL_WIN_POSITIONS = {}; SL_WIN_PROPERTIES = {} # don't touch this line.# * End of Data Initialization Area. I hope you didn't touch that stuff man.##===# # #=========================================================================== # * SCRIPT SETTINGS #=========================================================================== # * Enable Scanlines for all Scenes Enable_Scanlines = true # # * Step count for scanlines. Measured in pixels. Default: 3 Scanline_Stepcount = 3 # # * Scanline Height, measured in pixels. Default: 1 Scanline_Height = 1 # # * Scanline Width, measured in pixels. Default: 1280 Scanline_Width = 1280 # # * Scanline color # > Format: Color.new(red, green, blue, alpha) # > Values range from 0 to 255. # > Default: Color.new(0, 0, 0, 255) SL_Color = Color.new(0, 0, 0, 255) # # * Scanline Opacity # > Range: 0 - 255. Default: 128 # > 0 = transparent, 255 = solid. Scanline_Opacity = 128 # # * Default SL Window X/Y/Z positions # > Should be slightly off the screen and above. # > Default: -16 for X and Y SL_WIN_POSITIONS[:x] = -16 SL_WIN_POSITIONS[:y] = -16 # You probably wont ever need to touch the Z setting. SL_WIN_POSITIONS[:z] = 65535 # # * Window Width/Height Settings # > You probably wont need to touch these. SL_WIN_PROPERTIES[:width] = 1280 SL_WIN_PROPERTIES[:height] = 960 #=========================================================================== # * END OF SETTINGS # * DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YER DOIN! #=========================================================================== def self.enabled? @scanlines = Enable_Scanlines if @scanlines.nil? return @scanlines end def self.toggle_scanlines @scanlines = Enable_Scanlines if @scanlines.nil? !@scanlines ? @scanlines = true : @scanlines = false end endendclass Window_Base < Window def draw_scanline(x, y) line_y = y line_x = x contents.fill_rect(line_x, line_y, Gump::Retro::Scanline_Width, Gump::Retro::Scanline_Height, Gump::Retro::SL_Color) endendclass Scene_Base alias :gump_start_scanlines_76g9 :start alias :gump_update_scanlines_789 :update def start(*args) @scanlines_window = Window_Gump_Scanlines.new(Gump::Retro::SL_WIN_POSITIONS[:x], Gump::Retro::SL_WIN_POSITIONS[:y]) gump_start_scanlines_76g9 end def update(*args) gump_update_scanlines_789 @scanlines_window.check endendclass Window_Gump_Scanlines < Window_Base def initialize(x, y) width = Gump::Retro::SL_WIN_PROPERTIES[:width] height = Gump::Retro::SL_WIN_PROPERTIES[:height] super(x, y, width, height) self.opacity = 0 self.back_opacity = 0 self.contents_opacity = Gump::Retro::Scanline_Opacity self.z = Gump::Retro::SL_WIN_POSITIONS[:z] @scans_enabled = Gump::Retro.enabled? draw_scanlines end def draw_scanlines scanline_y = 0 while scanline_y < self.height break if !@scans_enabled draw_scanline(0, scanline_y) scanline_y += Gump::Retro::Scanline_Stepcount end end def check if @scans_enabled != Gump::Retro.enabled? @scans_enabled = Gump::Retro.enabled? contents.clear draw_scanlines end endendclass Game_Interpreter def toggle_scanlines Gump::Retro.toggle_scanlines endend


