getting a Window_Selectable Error

This has been happening when an actor is about to deal the final blow on an enemy
error message.png


Here's a list of the scripts I have
list1.png

list2.png


Does anybody have at least a little bit of an idea on how to fix this?
You'd need to implement a backtrace script instead. Here that single ine is not enough to debug your game.
You'd need to implement a backtrace script instead. Here that single ine is not enough to debug your game.
Okay I found a backtrace script and tried it, but it doesn't seem to work

Am I doing something wrong?
What can you read in the log file the script created or printed on screen?
What can you read in the log file the script created or printed on screen?
I'll just post the script here to make it easier

Code:
#--
# Backtrace v1.5 by Solistra
# =============================================================================
#
# Summary
# -----------------------------------------------------------------------------
#   This script provides the missing full error backtrace for RGSS3 as well as
# a number of features related to exception handling for debugging.
#
#   Normally, the error message given when an exception is encountered provides
# only the exception information without providing the backtrace; this script
# rectifies that by displaying the backtrace within the RGSS Console when
# applicable, potentially logging the backtrace to a file, and allowing script
# developers to test games with critical bugs without causing the entire engine
# to crash by optionally swallowing all exceptions.
#
# License
# -----------------------------------------------------------------------------
#   This script is made available under the terms of the MIT Expat license.
# View [this page](http://sesvxace.wordpress.com/license/) for more detailed
# information.
#
# Installation
# -----------------------------------------------------------------------------
#   Place this script anywhere below the SES Core (v2.0 or higher) script (if
# you are using it) or the Materials header, but above Main. This script does
# not require the SES Core, but it is highly recommended.
#
#   Place this script below any script which aliases or overwrites the
# `Game_Interpreter#update` method for maximum compatibility.
#
#++

# SES
# =============================================================================
# The top-level namespace for all SES scripts.
module SES
  # Backtrace
  # ===========================================================================
  # Provides methods and configuration options for the full error backtrace.
  module Backtrace
    # =========================================================================
    # BEGIN CONFIGURATION
    # =========================================================================
    
    # Whether or not to explicitly raise exceptions after exception handling
    # has taken place; by default, this is set to `true`.
    #
    # This script will attempt to work around any exceptions raised if this
    # constant is set to a `false` value; this may be useful for script authors
    # or game developers for debugging purposes, but may cause game instability
    # (or other odd behaviors).
    #
    # **It is highly recommended that you set this constant to `true` before
    # releasing any version of your project.**
    RAISE_EXCEPTIONS = true
    
    # Whether or not to log exception information and the backtrace to a log
    # file; may be either `true` or `false`.
    LOG_EXCEPTIONS = false
    
    # Whether to append to the log file or overwrite previous contents whenever
    # an exception is handled; set to `true` to append to the log file, `false`
    # to overwrite its contents. The value of this constant only applies if
    # {LOG_EXCEPTIONS} has been set to a `true` value.
    APPEND_LOG = true
    
    # The log file exception information is written to if the {LOG_EXCEPTIONS}
    # constant is set to a `true` value. The placement of this file is relative
    # to your project's root directory.
    LOG_FILE = 'Backtrace.log'
    
    # Whether or not to remove the log file created by a previous play testing
    # session whenever the game is started; this may be useful for developers
    # or play testers to ensure that the generated log files do not grow too
    # large. May be either `true` or `false`.
    RESET_LOG = false
    
    # Creates an alert box containing information about a caught exception when
    # one is handled if {RAISE_EXCEPTIONS} is set to a `false` value. This may
    # be useful to alert developers or play testers at the exact moment an
    # exception occurs.
    ALERT = false
    
    # =========================================================================
    # END CONFIGURATION
    # =========================================================================
    
    # Remove the log file if {RESET_LOG} is set to a `true` value and the log
    # file exists.
    File.delete(LOG_FILE) if RESET_LOG && File.exist?(LOG_FILE)
    
    # Runs the given block, handling all encountered exceptions. The exact form
    # of the exception handling is largely configured via the constants defined
    # in the {SES::Backtrace} module.
    #
    # @return [Object] the return value of the given block
    def self.with_exception_handling
      yield
    rescue RGSSReset
      reset
    rescue SystemExit
      exit
    rescue Exception => ex
      print_caught(ex) if $TEST
      log_caught(ex) if LOG_EXCEPTIONS
      if RAISE_EXCEPTIONS
        raise(ex)
      else
        alert_caught(ex) if ALERT
        retry
      end
    end
    
    # Resets the game in a manner similar to the way the default `rgss_main`
    # loop handles resetting.
    #
    # @return [void]
    # @see #reset_block=
    def self.reset
      [Audio, Graphics].each(&:__reset__)
      @reset ? TOPLEVEL_BINDING.instance_exec(&@reset) : SceneManager.run
    end
    
    # Assigns the reset block for this module to the given `Proc` object.
    #
    # @note This method is automatically called by `rgss_main` -- only call
    #   this manually if you are not using the standard `rgss_main` loop and
    #   wish to customize the behavior of an F12 reset.
    #
    # @param proc [Proc] the `Proc` to execute when an F12 reset is handled
    # @return [Proc]
    def self.reset_block=(proc)
      @reset = proc
    end
    
    # Returns cleaned backtrace information for a given exception by replacing
    # the file information given by Ace with actual script names rather than
    # their numeric placement in the Ace script editor.
    #
    # @param exception [Exception] the exception to clean the backtrace for
    # @return [Array<String>] the cleaned backtrace
    def self.clean_backtrace_from(exception)
      exception.backtrace.map do |line|
        line.sub(/^{(\d+)}/) { $RGSS_SCRIPTS[$1.to_i][1] }
      end
    end
    
    # Prints exception information and a full backtrace to a specified stream
    # (standard error by default).
    #
    # @param exception [Exception] the caught exception
    # @param stream [#puts] the stream to write exception information to
    # @return [void]
    def self.print_caught(exception, stream = STDERR)
      msg =  "#{Time.now} >> EXCEPTION CAUGHT <<"
      msg << "\n#{exception.class}: #{exception}.\nBacktrace:\n\t"
      stream.puts msg << clean_backtrace_from(exception).join("\n\t")
    end
    
    # Logs exception information and a full backtrace to the log file specified
    # by {LOG_FILE}. Exceptions are appended to the log if the {APPEND_LOG}
    # constant is set to a `true` value, otherwise the log will only contain a
    # record of the last encountered exception.
    #
    # @note The actual logging of information is done via the {.print_caught}
    #   method.
    #
    # @param exception [Exception] the caught exception
    # @return [void]
    # @see .print_caught
    def self.log_caught(exception)
      File.open(LOG_FILE, APPEND_LOG ? 'a' : 'w') do |file|
        print_caught(exception, file)
      end
    end
    
    # Provides a message box containing information about a handled exception.
    #
    # @param exception [Exception] the caught exception
    # @return [void]
    def self.alert_caught(exception)
      msg = "EXCEPTION CAUGHT:\n#{exception}\n\n"
      msg << 'Check the RGSS Console for more information.' if $TEST
      msgbox(msg)
    end
    
    # Register this script with the SES Core if it exists.
    if SES.const_defined?(:Register)
      # Script metadata.
      Description = Script.new(:Backtrace, 1.5, :Solistra)
      Register.enter(Description)
    end
  end
end
# Game_Interpreter
# =============================================================================
# The worst class in the entire RGSS3 API. Actually, all of the RGSS APIs.
class Game_Interpreter
  # Aliased to provide a workaround for a potential stack overflow after
  # handling an exception.
  #
  # @see #update
  alias_method :ses_backtrace_gi_upd, :update
 
  # Updates the execution of this instance of the interpreter each frame.
  #
  # @note The original method did not take the possibility of a dead fiber into
  #   account; as such, calling `@fiber.resume` on a dead fiber after handling
  #   an exception would cause a new `FiberError` to be raised, eventually
  #   resulting in a stack overflow.
  #
  # @return [void]
  def update(*args, &block)
    ses_backtrace_gi_upd(*args, &block)
  rescue FiberError
    # The fiber is most likely dead due to exception handling -- increment the
    # index for the interpreter and create a new fiber to interpret event
    # commands.
    @index += 1
    create_fiber
  end
end
# Object
# =============================================================================
# Superclass of all objects except `BasicObject`.
class Object
  # Aliased to automatically assign the given block as the reset block for the
  # {SES::Backtrace} module via {SES::Backtrace.reset_block=}.
  #
  # @see #rgss_main
  alias_method :ses_backtrace_obj_main, :rgss_main
 
  # Evaluates the provided block one time only.
  #
  # Detects a reset within a block with a press of the F12 key and returns to
  # the beginning if reset.
  #
  # @return [void]
  def rgss_main(*args, &block)
    SES::Backtrace.reset_block = block
    SES::Backtrace.with_exception_handling do
      ses_backtrace_obj_main(*args, &block)
    end
  end
end
Hi, what @kyonides asks for is the log file. To get it, set the option LOG_EXCEPTIONS in your backtrace script to true.
When you get an error, it will be saved in the file Backtrace.log inside your project repository.
1752649021892.png


Here is an example of a backtrace:
Spoiler: Example
Code:
2025-07-14 21:52:18 +0200 >> EXCEPTION CAUGHT <<
NoMethodError: undefined method `each_with_index' for nil:NilClass.
Backtrace:
    Window_Base:471:in `draw_actor_icons'
    Window_BattleStatus:84:in `draw_basic_area'
    Battle engine patch:39:in `draw_item'
    Yanfly battle engine:2071:in `refresh'
    Yanfly battle engine:2062:in `show'
    Yanfly battle engine:2779:in `command_skill'
    Window_Selectable:212:in `call'
    Window_Selectable:212:in `call_handler'
    Window_Command:136:in `call_ok_handler'
    Window_Selectable:322:in `process_ok'
    Window_Selectable:297:in `process_handling'
    Yanfly battle engine:1730:in `process_handling'
    Window_Selectable:276:in `update'
    Scene_Base:95:in `block in update_all_windows'
    Scene_Base:93:in `each'
    Scene_Base:93:in `update_all_windows'
    Scene_Base:49:in `update_basic'
    Scene_Battle:56:in `update_basic'
    Yanfly battle engine:2575:in `update_basic'
    Scene_Base:41:in `update'
    Scene_Battle:45:in `update'
    Scene_Base:14:in `main'
    SceneManager:23:in `run'
    Main:7:in `block in <main>'
    :1:in `block in rgss_main'
    :1:in `loop'
    :1:in `rgss_main'
    Back trace script:243:in `block in rgss_main'
    Back trace script:99:in `with_exception_handling'
    Back trace script:242:in `rgss_main'
    Main:7:in `<main>'
    ruby:in `eval'

Also, I suggest you allow the console to be displayed when playing the game:
1752649157636.png


This way, when you get an error, the backtrace will also be displayed on the console and you can simply copy and paste it somewhere:
1752649266802.png


This is mostly useful when debugging scripts.
Hi, what @kyonides asks for is the log file. To get it, set the option LOG_EXCEPTIONS in your backtrace script to true.
When you get an error, it will be saved in the file Backtrace.log inside your project repository.
View attachment 345166

Here is an example of a backtrace:
Spoiler: Example
Code:
2025-07-14 21:52:18 +0200 >> EXCEPTION CAUGHT <<
NoMethodError: undefined method `each_with_index' for nil:NilClass.
Backtrace:
    Window_Base:471:in `draw_actor_icons'
    Window_BattleStatus:84:in `draw_basic_area'
    Battle engine patch:39:in `draw_item'
    Yanfly battle engine:2071:in `refresh'
    Yanfly battle engine:2062:in `show'
    Yanfly battle engine:2779:in `command_skill'
    Window_Selectable:212:in `call'
    Window_Selectable:212:in `call_handler'
    Window_Command:136:in `call_ok_handler'
    Window_Selectable:322:in `process_ok'
    Window_Selectable:297:in `process_handling'
    Yanfly battle engine:1730:in `process_handling'
    Window_Selectable:276:in `update'
    Scene_Base:95:in `block in update_all_windows'
    Scene_Base:93:in `each'
    Scene_Base:93:in `update_all_windows'
    Scene_Base:49:in `update_basic'
    Scene_Battle:56:in `update_basic'
    Yanfly battle engine:2575:in `update_basic'
    Scene_Base:41:in `update'
    Scene_Battle:45:in `update'
    Scene_Base:14:in `main'
    SceneManager:23:in `run'
    Main:7:in `block in <main>'
    :1:in `block in rgss_main'
    :1:in `loop'
    :1:in `rgss_main'
    Back trace script:243:in `block in rgss_main'
    Back trace script:99:in `with_exception_handling'
    Back trace script:242:in `rgss_main'
    Main:7:in `<main>'
    ruby:in `eval'

Also, I suggest you allow the console to be displayed when playing the game:
View attachment 345167

This way, when you get an error, the backtrace will also be displayed on the console and you can simply copy and paste it somewhere:
View attachment 345168

This is mostly useful when debugging scripts.
okay okay I got it now

here's my actual log then

2025-07-16 03:33:32 -0400 >> EXCEPTION CAUGHT <<
ZeroDivisionError: divided by 0.
Backtrace:
Window_Selectable:122:in `/'
Window_Selectable:122:in `row'
MOG_Scroll_Bar:145:in `scroll_bar_y'
MOG_Scroll_Bar:125:in `update_scroll_bar'
MOG_Scroll_Bar:115:in `update'
Addon - TSBS cursor:70:in `update'
MOG_Battle_Hud_EX:2415:in `update'
Scene_Base:95 :in `block in update_all_windows'
Scene_Base:93:in `each'
Scene_Base:93:in `update_all_windows'
Scene_Base:49:in `update_basic'
Theo - Pause anywhere:99:in `update_basic'
Scene_Battle:56:in `update_basic'
YEA - Battle Engine+:2578:in `update_basic'
Implementation v1.4:6209:in `update_basic'
Addon - Backdrop Decor:1045:in `update_basic'
Addon - Camera:590:in `update_basic'
MOG_Battle_Command_EX:340:in `update_basic'
Scene_Battle:67:in `update_for_wait'
Implementation v1.4:6232:in `tsbs_wait_update'
Implementation v1.4:6247:in `wait_for_skill_sequence'
Implementation v1.4:6311:in `block in tsbs_action_main'
Implementation v1.4:6300:in `each'
Implementation v1.4:6300:in `tsbs_action_main'
Implementation v1.4:6255:in `show_action_sequences'
Implementation v1.4:6226:in `use_item'
MOG_Battle_Hud_EX:5604:in `use_item'
YEA - Battle Engine+:2992:in `execute_action'
Scene_Battle:550:in `process_action'
Scene_Battle:48:in `update'
MOG_Battle_Hud_EX:1590:in `update'
Scene_Base:14:in `main'
Mithran - Graphics Obj Ref:246:in `main'
SceneManager:23:in `run'
Main + Splash Screen:138:in `block in <main>'
:1:in `block in rgss_main'
:1:in `loop'
:1:in `rgss_main'
SES - Backtrace:243:in `block in rgss_main'
SES - Backtrace:99:in `with_exception_handling'
SES - Backtrace:242:in `rgss_main'
Main + Splash Screen:91:in `<main>'
ruby:in `eval'
bumping this again, still need help
OK, it'd have helped us if you had pasted the line of code in question. Anyway, here it is.

Ruby:
  def row
    index / col_max
  end

Somewhere in the MOG_Scroll_Bar section the script has set col_max to 0 and it's impossible to divide by 0 at all.

What's the name of the class that includes the scroll_bar_y method?

Just in case you didn't know this, but all classes are defined like this:

class MyClass

OR

class ChildClass < ParentClass

Now you'd have to find out what's the class we're looking for, and add or modify a method called col_max . This method should return 1 or any other positive number you might need in your menu.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/getting-a-window_selectable-error.178950/