Request RMVX Ace CgGallery scripting help

I'm using the Japanese CgGallery script, unfortunately by my oversight I lost the way to use it....

The author's website has disappeared and cannot be queried

I want to unlock the CG picture number I specified so that it can be displayed in the picture library,

Tried many times, can't figure out the correct script command....hope someone can help me

0801201.png


腳本


Spoiler
Code:
#******************************************************************************
#
#   * CGギャラリー画面 *
#
#                       for RGSS3
#
#        Ver 1.01   2012.09.16
#
#   ◆注意事項
#     ※この素材は「共通セーブファイル」スクリプトが必要になります。
#     ※この素材はコンフィグ項目以外にCGリストの設定が必要になります。
#
#
#   ◆使い方
#     1.スクリプトで「Scene_CgGallery.start」と記述する事で
#         CGギャラリー画面に移行します。
#
#     2.CGリストの設定・フィルターの設定は下記URLをご覧ください。
#         http://hime.be/rgss3/cg_gallery.html
#
#   提供者:睡工房 http://hime.be/
#
#******************************************************************************


#==============================================================================
# コンフィグ項目
#==============================================================================
module SUI
module GALLERY
  # CGフォルダ名
  #CG_DIR = "Graphics/Pictures/CG/"
  CG_DIR = "Graphics/Pictures/"
 
  # 再生BGM
  CG_BGM = "Scene5"
 
  # 全開放フラグ(共通セーブファイルのIDを指定)
  ALL_OPEN_MODE = "all_view"
 
  # フィルタの設定
  CG_FILTER = [
  #アイコン番号 , ヘルプに表示するテキスト
  [99           , "Indicates all thumbnails."],        # すべてのCGを表示
  [100          , "Indicates filter 1 thumbnail."],  # フィルター1
  [101          , "Indicates filter 2 thumbnail."],  # フィルター2
  [102          , "Indicates filter 3 thumbnail."],  # フィルター3
  [103          , "Indicates filter 4 thumbnail."],  # フィルター3
#  [103          , "フィルター4のサムネイルを表示します。"],  # フィルター4
  ]
end
end
#==============================================================================
# 設定完了
#==============================================================================



class Window_Gallery < Window_Selectable
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #     map       : mapファイル名
  #     viewport  : viewport
  #     scene_flg : シーン回想か?
  #--------------------------------------------------------------------------
  def initialize(map, viewport, scene_flg = false, filter = 0)
    # サイズは画面サイズ - ヘルプウィンドウ2個分
    @list = []
    super(0, fitting_height(1), Graphics.width, Graphics.height - fitting_height(1) * 2)
    self.viewport = viewport
    @map = map
    @scene_flg = scene_flg
    create_list(filter)
    @offset = (Graphics.width == 544) ? 5 : 0;
    refresh
    create_title_window
  end
  #--------------------------------------------------------------------------
  # ● 桁数の取得
  #--------------------------------------------------------------------------
  def col_max
    (Graphics.width == 544) ? 4 : 6 #4:5
  end
  #--------------------------------------------------------------------------
  # ● 項目数の取得
  #--------------------------------------------------------------------------
  def item_max
    @list.size
  end
  #--------------------------------------------------------------------------
  # ● 項目の幅を取得
  #--------------------------------------------------------------------------
  def item_width
    120
  end
  #--------------------------------------------------------------------------
  # ● 項目の高さを取得
  #--------------------------------------------------------------------------
  def item_height
    90
  end
  #--------------------------------------------------------------------------
  # ● 横に項目が並ぶときの空白の幅を取得
  #--------------------------------------------------------------------------
  def spacing
    5
  end
  #--------------------------------------------------------------------------
  # ● フィルタ適用後のリスト作成
  #--------------------------------------------------------------------------
  def create_list(filter)
    @list.clear unless @list == nil
    @list = [] if @list == nil
    for i in 0...SUI::CG_LIST.size
      if (@scene_flg == false or SUI::CG_LIST[i][4] == 1)
        if filter == 0 or filter == SUI::CG_LIST[i][3]
          @list << SUI::CG_LIST[i]
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 閲覧可否確認
  #--------------------------------------------------------------------------
  def check?
    ($savec.check(@list[@index][1] + "_01") or $savec.check(SUI::GALLERY::ALL_OPEN_MODE))
  end
  #--------------------------------------------------------------------------
  # ● ファイル名取得
  #--------------------------------------------------------------------------
  def getFilename
    @list[@index][1]
  end
  #--------------------------------------------------------------------------
  # ● シーンIDの取得 = ゲーム変数に入れる値
  #--------------------------------------------------------------------------
  def getId
    @list[@index][2]
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.create_contents
    icons = Cache.load_bitmap(SUI::GALLERY::CG_DIR, @map)
    for i in [email hidden]
      col = i % col_max
      row = i / col_max
      x = col * item_width + 13 + (@offset * (col + 1))
      y = row * item_height + 7
      if ($savec.check(@list[i][1] + "_01") or $savec.check(SUI::GALLERY::ALL_OPEN_MODE))
        rect = Rect.new(@list[i][2] % 10 * 100, @list[i][2] / 10 * 75, 100, 75)
        contents.blt(x, y, icons, rect)
      else
        contents.blt(x, y, icons, Rect.new(0, 0, 100, 75))
      end
    end
    if @list.size == 0
      rect = Rect.new
      rect.y = contents.height / 2 - 32 / 2
      rect.width = contents.width
      rect.height = 32
      contents.font.size = 32
      contents.draw_text(rect, "表示できるサムネイルがありません。", 1)
    end
    @last = -1
  end
  #--------------------------------------------------------------------------
  # ● 項目を描画する矩形の取得
  #     index : 項目番号
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = Rect.new(0, 0, 0, 0)
    rect.width = item_width
    rect.height = item_height
    rect.x = index % col_max * item_width + 3 + (@offset * (index % col_max + 1))
    rect.y = index / col_max * item_height
    rect
  end
  #--------------------------------------------------------------------------
  # ● 先頭の行の取得
  #--------------------------------------------------------------------------
  def top_row
    oy / item_height
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウ内容の作成
  #--------------------------------------------------------------------------
  def create_contents
    self.contents.dispose
    self.contents = Bitmap.new(width - padding * 2, [height - padding * 2, row_max * item_height].max)
  end
  #--------------------------------------------------------------------------
  # ● 決定ボタンが押されたときの処理
  #--------------------------------------------------------------------------
  def process_ok
    if check?
      Audio.se_play("Audio/SE/Book1", 75, 100)
      Input.update
      deactivate
      call_ok_handler
    else
      Sound.play_buzzer
    end
  end
  #--------------------------------------------------------------------------
  # ● タイトルウィンドウの作成
  #--------------------------------------------------------------------------
  def create_title_window
    @help_window = Window_Help.new(1)
    @help_window.viewport = viewport
    @help_window.y = y + height
  end
  #--------------------------------------------------------------------------
  # ● ヘルプウィンドウの更新
  #--------------------------------------------------------------------------
  def update_help
    return if index == -1
    return if @last == @index
    @last = @index
    @help_window.set_text(@list[@index][0])
  end
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  def dispose
    @help_window.dispose
    super
  end
end


class Window_Filter < Window_Selectable
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(viewport)
    @list = SUI::GALLERY::CG_FILTER
    super(250, 0, Graphics.width - 250, fitting_height(1))
    self.viewport = viewport
    @index = 0
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    self.contents.draw_text(10, -2, 100, 24, "フィルタ")
    @list.size.times {|i| draw_text_ex(item_rect(i).x + 2, item_rect(i).y, "\\I[#{@list[i][0]}]") }
  end
  #--------------------------------------------------------------------------
  # ● 桁数の取得
  #--------------------------------------------------------------------------
  def col_max
    @list.size
  end
  #--------------------------------------------------------------------------
  # ● 項目数の取得
  #--------------------------------------------------------------------------
  def item_max
    @list.size
  end
  #--------------------------------------------------------------------------
  # ● 横に項目が並ぶときの空白の幅を取得
  #--------------------------------------------------------------------------
  def spacing
    4
  end
  #--------------------------------------------------------------------------
  # ● 項目の幅を取得
  #--------------------------------------------------------------------------
  def item_width
    28
  end
  #--------------------------------------------------------------------------
  # ● 項目を描画する矩形の取得
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = Rect.new
    rect.width = item_width
    rect.height = item_height
    rect.x = index % col_max * (item_width + spacing) + 100
    rect.y = index / col_max * item_height
    rect
  end
  #--------------------------------------------------------------------------
  # ● 閲覧要素があるか設定
  #--------------------------------------------------------------------------
  def check=(flg)
    @check = flg
  end
  #--------------------------------------------------------------------------
  # ● 閲覧要素があるか取得
  #--------------------------------------------------------------------------
  def check?
    @check
  end
  #--------------------------------------------------------------------------
  # ● 決定ボタンが押されたときの処理
  #--------------------------------------------------------------------------
  def process_ok
    if check?
      Sound.play_ok
      Input.update
      deactivate
      call_ok_handler
    else
      Sound.play_buzzer
    end
  end
end


class Scene_CgGallery < Scene_Base
  #--------------------------------------------------------------------------
  # ● クラス変数初期化
  #--------------------------------------------------------------------------
  @@start = false         # ギャラリーの開始フラグ
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    RPG::BGM.fade(500)
    RPG::BGS.stop
    RPG::ME.stop
  end
  #--------------------------------------------------------------------------
  # ● 開始処理
  #--------------------------------------------------------------------------
  def start
    super
    @@start = false
    @last = -1
    @viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
    @viewport.z = 150
    play_bgm
    create_background
    create_help_window
    create_main_window
    create_filter_window
    create_cg_window
  end
  #--------------------------------------------------------------------------
  # ● 終了処理
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_background
    dispose_cg_window
    @viewport.dispose
    @viewport = nil
  end
  #--------------------------------------------------------------------------
  # ● BGMの再生
  #--------------------------------------------------------------------------
  def play_bgm
    RPG::BGM.new(SUI::GALLERY::CG_BGM).play
  end
  #--------------------------------------------------------------------------
  # ● 背景の作成
  #--------------------------------------------------------------------------
  def create_background
    @back = Sprite.new
    @back.bitmap = SceneManager.background_bitmap
    @back.color.set(16, 16, 16, 128)
  end
  #--------------------------------------------------------------------------
  # ● ヘルプウィンドウの作成
  #--------------------------------------------------------------------------
  def create_help_window
    @help_window = Window_Help.new(1)
    @help_window.viewport = @viewport
    @help_window.width = 230
    @help_window.create_contents
    @help_window.draw_text(0, -2, @help_window.contents.width, @help_window.contents.height, "* CGギャラリー *", 1)
  end
  #--------------------------------------------------------------------------
  # ● CGウィンドウの作成
  #--------------------------------------------------------------------------
  def create_cg_window
    @cg_window = Sprite.new
    @cg_window.bitmap = Bitmap.new(32, 32)
    @cg_window.x = 0
    @cg_window.y = 0
    @cg_window.z = @viewport.z + 1
    @cg_window.visible = false
  end
  #--------------------------------------------------------------------------
  # ● CGウィンドウの解放
  #--------------------------------------------------------------------------
  def dispose_cg_window
    @cg_window.bitmap.dispose
    @cg_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● メインウィンドウの作成
  #--------------------------------------------------------------------------
  def create_main_window
    @main_window = Window_Gallery.new("cg_thumb", @viewport)
    @main_window.opacity = 96
    @main_window.contents_opacity = 96
    @main_window.set_handler(:ok,     method(:main_ok))
    @main_window.set_handler(:cancel, method(:main_cancel))
  end
  #--------------------------------------------------------------------------
  # ● フィルタウィンドウの作成
  #--------------------------------------------------------------------------
  def create_filter_window
    @filter_window = Window_Filter.new(@viewport)
    @filter_window.set_handler(:ok,     method(:filter_ok))
    @filter_window.set_handler(:cancel, method(:filter_cancel))
    @filter_window.activate
  end
  #--------------------------------------------------------------------------
  # ● 背景の解放
  #--------------------------------------------------------------------------
  def dispose_background
    @back.bitmap.dispose
    @back.dispose
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    update_filter_help if @filter_window.active
    update_cg_selection unless @viewport.visible
  end
  #--------------------------------------------------------------------------
  # ● フィルタのヘルプ更新
  #--------------------------------------------------------------------------
  def update_filter_help
    return if @last == @filter_window.index
    @last = @filter_window.index
    @main_window.create_list(@filter_window.index)
    @main_window.top_row = 0
    @main_window.refresh
    @main_window.help_window.set_text(SUI::GALLERY::CG_FILTER[@filter_window.index][1])
    @main_window.help_window.update
    @filter_window.check = (@main_window.item_max != 0)
  end
  #--------------------------------------------------------------------------
  # ● フィルタの決定処理
  #--------------------------------------------------------------------------
  def filter_ok
    @main_window.opacity = 255
    @main_window.contents_opacity = 255
    @main_window.activate
    @main_window.index = 0
  end
  #--------------------------------------------------------------------------
  # ● フィルタのキャンセル処理
  #--------------------------------------------------------------------------
  def filter_cancel
    SceneManager.return
    RPG::BGM.stop
    $game_map.autoplay
  end
  #--------------------------------------------------------------------------
  # ● ギャラリーの決定処理
  #--------------------------------------------------------------------------
  def main_ok
    @cg = @main_window.getFilename
    @cg_index = 0
    @viewport.visible = false
    next_show
  end
  #--------------------------------------------------------------------------
  # ● ギャラリーのキャンセル処理
  #--------------------------------------------------------------------------
  def main_cancel
    @main_window.index = -1
    @main_window.opacity = 96
    @main_window.contents_opacity = 96
    @filter_window.activate
    @last = -1
  end
  #--------------------------------------------------------------------------
  # ● CG選択の更新
  #--------------------------------------------------------------------------
  def update_cg_selection
    if Input.trigger?(:B)
      Sound.play_cancel
      @main_window.activate
      @cg_window.visible = false
      @viewport.visible = true
    elsif Input.trigger?(:C)
      if next_show
        Audio.se_play("Audio/SE/Book1", 75, 100)
      else
        Sound.play_cancel
        @main_window.activate
        @cg_window.visible = false
        @viewport.visible = true
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 次のCGの表示
  #--------------------------------------------------------------------------
  def next_show
    @cg_index += 1
    begin
      @cg_window.bitmap.dispose unless @cg_window.bitmap.disposed?
      @cg_window.bitmap = Bitmap.new(SUI::GALLERY::CG_DIR + @cg + "_" + sprintf("%02d", @cg_index))
    rescue
      return false
    end
    return @cg_window.visible = true
  end
  #--------------------------------------------------------------------------
  # ● CGギャラリースタート処理
  #--------------------------------------------------------------------------
  def self.start
    @@start = true
  end
  #--------------------------------------------------------------------------
  # ● CGギャラリーが開始しているか?
  #--------------------------------------------------------------------------
  def self.start?
    return @@start
  end
end


class Scene_Map
  #--------------------------------------------------------------------------
  # ● CGギャラリーへの移行
  #--------------------------------------------------------------------------
  alias sui_update_scene update_scene
  def update_scene
    sui_update_scene
    SceneManager.call(Scene_CgGallery) if !scene_changing? && Scene_CgGallery.start?
  end
end

Spoiler
Code:
#******************************************************************************
#
#   * 共通セーブファイル *
#
#                       for RGSS3
#
#        Ver 1.01   2013.08.24
#
#   ◆使い方
#     数字でも文字でも、お好きな名前(ID)への値の保存/読込が出来ます。
#     1.True/Falseの値の場合
#         例)保存:$savec.set("id", True)
#             読込:$savec.check("id")
#                   ※idが存在しない場合、Falseが返されます。
#
#     2.数字の場合
#         例)保存:$savec.set_num("id", 100)
#             読込:$savec.get_num("id")
#                   ※idが存在しない場合、-1が返されます。
#
#   提供者:睡工房 http://hime.be/
#
#******************************************************************************

#==============================================================================
# コンフィグ項目
#==============================================================================
module SUI
module COMMON_SAVE
  # 共通セーブファイル名
  COMMON_FILE = "savec.rvdata"
end
end
#==============================================================================
# 設定完了
#==============================================================================



class Common_Save
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    @data = {}
    load if FileTest.exist?(SUI::COMMON_SAVE::COMMON_FILE)
  end
  #--------------------------------------------------------------------------
  # ● フラグチェック
  #--------------------------------------------------------------------------
  def check(id)
    @data.include?(id)? @data[id] : false
  end
  #--------------------------------------------------------------------------
  # ● フラグセット
  #--------------------------------------------------------------------------
  def set(id, flg = false)
    unless check(id) == flg
      @data[id] = flg
      save
    end
  end
  #--------------------------------------------------------------------------
  # ● 数値取得
  #--------------------------------------------------------------------------
  def get_num(id)
    @data.include?(id)? @data[id] : -1
  end
  #--------------------------------------------------------------------------
  # ● 数値セット
  #--------------------------------------------------------------------------
  def set_num(id, num = -1)
    unless get_num(id) == num
      @data[id] = num
      save
    end
  end
  #--------------------------------------------------------------------------
  # ● ファイルセーブ
  #--------------------------------------------------------------------------
  def save
    save_data(@data, SUI::COMMON_SAVE::COMMON_FILE)
  end
  #--------------------------------------------------------------------------
  # ● ファイルロード
  #--------------------------------------------------------------------------
  def load
    @data = load_data(SUI::COMMON_SAVE::COMMON_FILE)
  end
end


class << DataManager
  #--------------------------------------------------------------------------
  # ● モジュール初期化
  #--------------------------------------------------------------------------
  alias sui_init init
  def init
    $savec = Common_Save.new
    sui_init
  end
end
Is this the script site?

Do you have all of the scripts for this site?
Can you send them to me in a zip file? With the graphics required? Thanks
Is this the script site?

Do you have all of the scripts for this site?
Can you send them to me in a zip file? With the graphics required? Thanks

Hello,

I added a new example file,

There are scripts and pictures in it
Did you need help translating the site.
I used google translate to be able to read it.
Looking at your image files I tried using
$savec.set("CG01_01", true)

then when selecting the first image it loaded the images for that scene.
Code:
# - Create a save file that does not depend on each save file and is common to the entire game.
#
# ・Two types of values, "true/false" and "number", can be saved.
#
# ・ It is convenient for viewing flags of CG and event scenes, and for temporary
# storage of strong and new game data.
#
# Not preparing. Try executing the following command from the event command script.
#
# msgbox $savec.check("aaa")
# $savec.set("aaa", true)
# msgbox $savec.check("aaa")
# msgbox $savec.get_num("bbb")
# $savec.set_num("bbb", 14106)
# msgbox $savec.get_num("bbb")
#
# ◇ How to use
# □ Saving "true/false"
# Execute the following command from the script.
# $savec.set(id, data)
# id: Please specify any string or number.
# data: Specify "true" or "false".
# Return Value:without
#
# □ Reading "true/false"
# Execute the following command from the script.
# $savec.check(id)
# id: Specify the ID specified at the time of saving.
# Return Value: Returns the saved "true/false" value.
#  * If the ID does not exist, "false" is returned.
#
# □ Storing numbers
# Execute the following command from the script.
# $savec.set_num(id, data)
# id: Please specify any string or number.
# data: Please specify a numeric value.
# Return Value:without
#
# □ Reading numbers
# Execute the following command from the script.
# $savec.get_num(id)
# id: Specify the ID specified at the time of saving.
# Return Value: Returns the saved numeric value.
#  * If the ID does not exist, "-1" is returned.
omg it worked thank you so much it now successfully unlocks the picture


If you don't mind, I have one additional little question,

When I view the picture, the picture is displayed instantaneously,

Is it possible to add some syntax or the like to the script, so that the pictures will be displayed in a fade-out and fade-in manner?

Anyway thanks for your help, I was looking at it also using translation, originally I almost gave up
Will this work for your needs?
Ruby:
class Scene_CgGallery < Scene_Base
  def update_cg_selection
    if Input.trigger?(:B)
      Sound.play_cancel
      @main_window.activate
      @cg_window.visible = false
      @viewport.visible = true
    elsif Input.trigger?(:C)
      until @cg_window.opacity <= 0 do
        @cg_window.opacity -= 15
        Graphics.update
      end
      @cg_window.opacity = 0
      if next_show
        Audio.se_play("Audio/SE/Book1", 75, 100)
      else
        Sound.play_cancel
        @main_window.activate
        @cg_window.visible = false
        @viewport.visible = true
      end
      until @cg_window.opacity >= 250 do
        @cg_window.opacity += 15
        Graphics.update
      end
      @cg_window.opacity = 255
    end
  end
end

The scene is using bitmaps and changing the image immediately.
It doesn't have it load into a new variable so without a fair bit of recoding I'm not sure how to make it better.

But I was also asking if you had every script from that site, not just the ones you need help with.
I get it, it works, thank you again

Sorry for missing the question, I'm not sure how many scripts there are on the website, I only left the cg and recall scripts

Here's another one, I'll post it here

Spoiler
Code:
#******************************************************************************
#
#   * シーン回想画面 *
#
#                       for RGSS3
#
#        Ver 1.02   2012.09.16
#
#   ◆注意事項
#     ※この素材は「共通セーブファイル」スクリプトが必要になります。
#     ※この素材は「CGギャラリー」スクリプトが必要になります。
#     ※この素材はコンフィグ項目以外にCGリストの設定が必要になります。
#
#
#   ◆使い方
#     1.スクリプトで「Scene_SceneGallery.start」と指定する事で
#         シーン回想画面に移行します。
#
#     2.このスクリプトはツクールのイベントと連動して機能します。
#         設定の詳細方法は下記URLをご覧ください。
#         http://hime.be/rgss3/scene_gallery.html
#
#   提供者:睡工房 http://hime.be/
#
#******************************************************************************


#==============================================================================
# コンフィグ項目
#==============================================================================
module SUI
module GALLERY
  # シーン回想用変数(ゲーム内変数の番号を指定)
  # ここで指定した番号の変数にシーンIDが代入されます。
  SCENE_VAR = 50
end
end
#==============================================================================
# 設定完了
#==============================================================================



class Scene_SceneGallery < Scene_Base
  #--------------------------------------------------------------------------
  # ● クラス変数初期化
  #--------------------------------------------------------------------------
  @@start  = false         # ギャラリーの開始フラグ
  @@filter = 0             # ギャラリー復帰用
  @@index  = -1            # ギャラリー復帰用
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    RPG::BGM.fade(500)
    RPG::BGS.stop
    RPG::ME.stop
  end
  #--------------------------------------------------------------------------
  # ● 開始処理
  #--------------------------------------------------------------------------
  def start
    super
    @@start = false
    @last = -1
    @viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
    @viewport.z = 145
    play_bgm
    create_background
    create_help_window
    create_filter_window
    create_main_window
  end
  #--------------------------------------------------------------------------
  # ● 終了処理
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_background
    @viewport.dispose
    @viewport = nil
  end
  #--------------------------------------------------------------------------
  # ● BGMの再生
  #--------------------------------------------------------------------------
  def play_bgm
    RPG::BGM.new(SUI::GALLERY::CG_BGM).play
  end
  #--------------------------------------------------------------------------
  # ● 背景の作成
  #--------------------------------------------------------------------------
  def create_background
    @back = Sprite.new
    @back.bitmap = SceneManager.background_bitmap
    @back.color.set(16, 16, 16, 128)
  end
  #--------------------------------------------------------------------------
  # ● ヘルプウィンドウの作成
  #--------------------------------------------------------------------------
  def create_help_window
    @help_window = Window_Help.new(1)
    @help_window.viewport = @viewport
    @help_window.width = 230
    @help_window.create_contents
    @help_window.draw_text(0, -2, @help_window.contents.width, @help_window.contents.height, "* シーン回想 *", 1)
  end
  #--------------------------------------------------------------------------
  # ● メインウィンドウの作成
  #--------------------------------------------------------------------------
  def create_main_window
    @main_window = Window_Gallery.new("cg_thumb", @viewport, true, @@filter)
    @main_window.index = @@index
    @main_window.opacity = (@@index == -1) ? 96 : 255
    @main_window.contents_opacity = (@@index == -1) ? 96 : 255
    @main_window.activate if @@index > -1
    @main_window.set_handler(:ok,     method(:main_ok))
    @main_window.set_handler(:cancel, method(:main_cancel))
  end
  #--------------------------------------------------------------------------
  # ● フィルタウィンドウの作成
  #--------------------------------------------------------------------------
  def create_filter_window
    @filter_window = Window_Filter.new(@viewport)
    @filter_window.set_handler(:ok,     method(:filter_ok))
    @filter_window.set_handler(:cancel, method(:filter_cancel))
    @filter_window.index = @@filter
    @filter_window.activate if @@index == -1
  end
  #--------------------------------------------------------------------------
  # ● 背景の解放
  #--------------------------------------------------------------------------
  def dispose_background
    @back.bitmap.dispose
    @back.dispose
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    update_filter_help if @filter_window.active
  end
  #--------------------------------------------------------------------------
  # ● フィルタのヘルプ更新
  #--------------------------------------------------------------------------
  def update_filter_help
    return if @last == @filter_window.index
    @last = @filter_window.index
    @main_window.create_list(@filter_window.index)
    @main_window.top_row = 0
    @main_window.refresh
    @main_window.help_window.set_text(SUI::GALLERY::CG_FILTER[@filter_window.index][1])
    @main_window.help_window.update
    @filter_window.check = (@main_window.item_max != 0)
  end
  #--------------------------------------------------------------------------
  # ● フィルタの決定処理
  #--------------------------------------------------------------------------
  def filter_ok
    @main_window.opacity = 255
    @main_window.contents_opacity = 255
    @main_window.activate
    @main_window.index = 0
    @@filter = @filter_window.index
  end
  #--------------------------------------------------------------------------
  # ● フィルタのキャンセル処理
  #--------------------------------------------------------------------------
  def filter_cancel
    $game_variables[SUI::GALLERY::SCENE_VAR] = 1000
    @@filter = 0
    @@index = -1
    SceneManager.return
    RPG::BGM.stop
    $game_map.autoplay
  end
  #--------------------------------------------------------------------------
  # ● ギャラリーの決定処理
  #--------------------------------------------------------------------------
  def main_ok
    $game_variables[SUI::GALLERY::SCENE_VAR] = @main_window.getId
    @@index = @main_window.index
    SceneManager.return
  end
  #--------------------------------------------------------------------------
  # ● ギャラリーのキャンセル処理
  #--------------------------------------------------------------------------
  def main_cancel
    @main_window.index = -1
    @main_window.opacity = 96
    @main_window.contents_opacity = 96
    @filter_window.activate
    @last = -1
  end
  #--------------------------------------------------------------------------
  # ● 回想ギャラリースタート処理
  #--------------------------------------------------------------------------
  def self.start
    @@start = true
  end
  #--------------------------------------------------------------------------
  # ● 回想ギャラリーが開始しているか?
  #--------------------------------------------------------------------------
  def self.start?
    return @@start
  end
  #--------------------------------------------------------------------------
  # ● リセット
  #--------------------------------------------------------------------------
  def self.reset
    @@start = false
    @@filter = 0
    @@index = -1
  end
end


class Scene_Map
  #--------------------------------------------------------------------------
  # ● 回想ギャラリーへの移行
  #--------------------------------------------------------------------------
  alias sui_update_scene2 update_scene
  def update_scene
    sui_update_scene2
    SceneManager.call(Scene_SceneGallery) if !scene_changing? && Scene_SceneGallery.start?
  end
end


class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # ● 開始処理
  #--------------------------------------------------------------------------
  alias sui_scene_start start
  def start
    Scene_SceneGallery.reset
    sui_scene_start
  end
end

Original thread: https://forums.rpgmakerweb.com/threads/request-rmvx-ace-cggallery-scripting-help.160375/