game crashes with unhelpful error after modifying a script for personal use

Hello!

I'm modifying a certain game made with RPG Maker VX Ace,kinda spicing it up here or there for my 4th playthrough.

I have been thinking it would be cool to add a bestiary. A menu with nice info about the enemies I kill like drops, stats and stuff like that.

I found this public script which is pretty nice: http://ytomy.sakura.ne.jp/tkool/rpgtech/php/tech.php?tool=VXAce&cat=tech_vxace/menu&tech=enemy_guide

Now, I notice that it has a page for detailed enemy descriptions which I'm not gonna use so I wanted to hide it automatically for enemies that don't have a description written. Kinda as an experiment to get a bit into Ruby and as futureproof in case I want to add this to one of my own projects down the road

The problem is that after doing some changes that I think should make that happen the game crashes on bootup saying:

C9I9JRSE.png


Which is like super unhelpful because there definitely is an end in the line 1630 lmao. In fact there's 3.

I like to work with Git to see code differences so I have the changes I made right here.

Could anyone give them a check and tell me what could be going wrong?

Diff:
diff --git a/RPGMVXA/scripts/kms_enemy_guide.rb b/RPGMVXA/scripts/kms_enemy_guide.rb
index 48bcba7..2b9e9bf 100644
--- a/RPGMVXA/scripts/kms_enemy_guide.rb
+++ b/RPGMVXA/scripts/kms_enemy_guide.rb
@@ -969,13 +969,19 @@ class Window_EnemyGuideStatus < Window_Base
     return true if KMS::EnemyGuide::SHOW_DROP_ITEM
     return true if $kms_imported["Steal"] && KMS::EnemyGuide::SHOW_STEAL_OBJ
 
+  def description_page_show?
+    return true if @__enemy_guide_description != nil
+
     false
   end
   #--------------------------------------------------------------------------
   # ○ ページ数取得
   #--------------------------------------------------------------------------
   def pages
-    item_page_show? ? 3 : 2
+    numPages = 3
+    numPages = item_page_show? ? numPages : numPages - 1
+    numPages = description_page_show? ? numPages : numPages - 1
+    return numPages
   end
   #--------------------------------------------------------------------------
   # ○ 表示エネミー設定
@@ -1054,9 +1060,11 @@ class Window_EnemyGuideStatus < Window_Base
     end
 
     # Page 3
-    dx = page_width * (pages - 1) + 4
-    dy = draw_basic_info(dx, 0)
-    draw_description(dx, dy)
+    if description_page_show?
+      dx = page_width * (pages - 1) + 4
+      dy = draw_basic_info(dx, 0)
+      draw_description(dx, dy)
+    end
   end
   #--------------------------------------------------------------------------
   # ○ 基本情報画

I don't know about Ruby so theres probably something super duper obvious i am not seeing, haha......
Here is how the error happened
Code:
class Something
  def function
    puts "hello world"
  end
If you put these 4 lines in the fresh project, you get the exact error message.
In another word, you might be missing block closure (end) somewhere. Good luck, looking
Here is how the error happened
Code:
class Something
  def function
    puts "hello world"
  end
If you put these 4 lines in the fresh project, you get the exact error message.
In another word, you might be missing block closure (end) somewhere. Good luck, looking
I knew it was something obvious, hahaha. I screwed up defining that description_page_show? function.

Diff:
diff --git a/RPGMVXA/scripts/kms_enemy_guide.rb b/RPGMVXA/scripts/kms_enemy_guide.rb
index 48bcba7..2b9e9bf 100644
--- a/RPGMVXA/scripts/kms_enemy_guide.rb
+++ b/RPGMVXA/scripts/kms_enemy_guide.rb
@@ -969,13 +969,19 @@ class Window_EnemyGuideStatus < Window_Base
    return true if KMS::EnemyGuide::SHOW_DROP_ITEM
    return true if $kms_imported["Steal"] && KMS::EnemyGuide::SHOW_STEAL_OBJ
    false
  end
+
+ def description_page_show?
+   return true if @__enemy_guide_description != nil
+   false
+ end
   #--------------------------------------------------------------------------
   # ○ ページ数取得
   #--------------------------------------------------------------------------
   def pages
-    item_page_show? ? 3 : 2
+    numPages = 3
+    numPages = item_page_show? ? numPages : numPages - 1
+    numPages = description_page_show? ? numPages : numPages - 1
+    return numPages
   end
   #--------------------------------------------------------------------------
   # ○ 表示エネミー設定
@@ -1054,9 +1060,11 @@ class Window_EnemyGuideStatus < Window_Base
     end
 
     # Page 3
-    dx = page_width * (pages - 1) + 4
-    dy = draw_basic_info(dx, 0)
-    draw_description(dx, dy)
+    if description_page_show?
+      dx = page_width * (pages - 1) + 4
+      dy = draw_basic_info(dx, 0)
+      draw_description(dx, dy)
+    end
   end
   #--------------------------------------------------------------------------
   # ○ 基本情報画

Original thread: https://forums.rpgmakerweb.com/threads/game-crashes-with-unhelpful-error-after-modifying-a-script-for-personal-use.152934/