设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 94|回复: 0

[转载发布] Unlimited Save Slots for XP

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9015

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58751
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68660

    灌水之王

    发表于 2026-7-26 11:54:17 | 显示全部楼层 |阅读模式
    If you find your players stumble and struggle in the only 4 save slots by default, you can use this script to liberate them.

    The player can start to use save slot from the first one. Once they saved they got a second, empty one. Once they saved in the second slot the got a third one, and so on.
    I personally tested ~1500 saves, without any performance issues or glitches.

    Terms of Use:
    1. Please keep the second line of this script in your game.
    2. Free to use in any kind of game.
    3. Redistributions are OK, but secondary development is not allowed for this script.

    You can also download a demo in the attachment. But sadly enough, the base RGSS scripts are in mandarin owing to the version I'm using.

                    Ruby:       
    1. #==============================================================================
    2. # ■ Unlimited Saves by SailCat
    3. #------------------------------------------------------------------------------
    4. #   Introduction:
    5. #      This script allows unlimited number (albeit limited by disk space) of
    6. #   saves to a game.
    7. #
    8. #   Installation Guide:
    9. #      Insert this script before the "Main" section, preferably lower in your
    10. #   set of plugin scripts.
    11. #
    12. #   Date of release:
    13. #      Sep. 2, 2024 (version 1.0)
    14. #
    15. #   Effects:
    16. #   1. Players can now save in unlimited slots instead of four.
    17. #      * The "unlimited" number is done by checking a number sequence starting
    18. #      from 1, and provide an empty slot always available. In this way, in the
    19. #      first run of the game, where in the folder no saves exist. There can be
    20. #      seen only one save slot instead of four. Don't worry, you save here and
    21. #      you get a second empty slot next time you save, and a third, and more...
    22. #
    23. #   How to use:
    24. #      To move cursor up or down by 1, press UP or DOWN arrows.
    25. #      To move cursor up or down by 4, press LEFT or RIGHT arrows.
    26. #      To move cursor up or down by 16, press Ctrl+UP or Ctrl+DOWN.
    27. #      To move cursor up or down by 64, press Ctrl+LEFT or Ctrl+RIGHT.
    28. #      To move cursor up or down by 256, press PGUP or PGDN keys.
    29. #      To move cursor to the top or bottom, press Ctrl+PGUP or Ctrl+PGDN.
    30. #==============================================================================
    31. class Scene_File
    32.   #--------------------------------------------------------------------------
    33.   # ● Additional Attributes
    34.   #--------------------------------------------------------------------------
    35.   attr_reader  :top_index # Top index of save file
    36.   unless method_defined? :sailcat_initialize
    37.     alias sailcat_initialize initialize
    38.   end
    39.   #--------------------------------------------------------------------------
    40.   # ● Initialize
    41.   #     help_text : the text to help
    42.   #--------------------------------------------------------------------------
    43.   def initialize(help_text)
    44.     sailcat_initialize(help_text)
    45.     @file_count ||= save_count
    46.   end
    47.   #--------------------------------------------------------------------------
    48.   # ● Set top index and redraw the next four windows
    49.   #     index : new top index
    50.   #--------------------------------------------------------------------------
    51.   def top_index=(index)
    52.     index = [0, [index / 4 * 4, @file_count - 1].min].max
    53.     if @top_index != index
    54.       @top_index = index
    55.       redraw_windows
    56.     end
    57.   end
    58.   #--------------------------------------------------------------------------
    59.   # ● Main processing
    60.   #--------------------------------------------------------------------------
    61.   def main
    62.     @help_window = Window_Help.new
    63.     @help_window.set_text(@help_text)
    64.     @file_index = [@file_count - 1, $game_temp.last_file_index].min
    65.     self.top_index = @file_index
    66.     @savefile_windows[@file_index % 4].selected = true
    67.     Graphics.transition
    68.     loop do
    69.       Graphics.update
    70.       Input.update
    71.       update
    72.       if $scene != self
    73.         break
    74.       end
    75.     end
    76.     Graphics.freeze
    77.     @help_window.dispose
    78.     for i in @savefile_windows
    79.       i.dispose
    80.     end
    81.   end
    82.   #--------------------------------------------------------------------------
    83.   # ● Update windows
    84.   #--------------------------------------------------------------------------
    85.   def update
    86.     @help_window.update
    87.     for i in @savefile_windows[0..3]
    88.       i.update
    89.     end
    90.     if Input.trigger?(Input::C)
    91.       on_decision(make_filename(@file_index))
    92.       $game_temp.last_file_index = @file_index
    93.       return
    94.     end
    95.     if Input.trigger?(Input::B)
    96.       on_cancel
    97.       return
    98.     end
    99.     if Input.repeat?(Input::DOWN)
    100.       move_index(Input.press?(Input::CTRL) ? 16 : 1)
    101.       return
    102.     end
    103.     if Input.repeat?(Input::UP)
    104.       move_index(Input.press?(Input::CTRL) ? -16 : -1)
    105.       return
    106.     end
    107.     if Input.repeat?(Input::LEFT)
    108.       move_index(Input.press?(Input::CTRL) ? -64 : -4)
    109.       return
    110.     end
    111.     if Input.repeat?(Input::RIGHT)
    112.       move_index(Input.press?(Input::CTRL) ? 64 : 4)
    113.       return
    114.     end
    115.     if Input.trigger?(Input::R)
    116.       Input.press?(Input::CTRL) ? set_index(-1) : move_index(256)
    117.       return
    118.     end
    119.     if Input.trigger?(Input::L)
    120.       Input.press?(Input::CTRL) ? set_index(0) : move_index(-256)
    121.       return
    122.     end
    123.   end
    124.   #--------------------------------------------------------------------------
    125.   # ● Make filename
    126.   #     file_index : index of file (0 to 3)
    127.   #--------------------------------------------------------------------------
    128.   def make_filename(file_index)
    129.     return "Save#{file_index + 1}.rxdata"
    130.   end
    131.   #--------------------------------------------------------------------------
    132.   # ● Move cursor
    133.   #     distance : move by distance
    134.   #--------------------------------------------------------------------------
    135.   def move_index(distance)
    136.     if @file_index == 0 and distance < 0
    137.       set_index(-1)
    138.     elsif @file_index == @file_count - 1 and distance > 0
    139.       set_index(0)
    140.     else
    141.       set_index([0, [@file_index + distance, @file_count - 1].min].max)
    142.     end
    143.   end
    144.   #--------------------------------------------------------------------------
    145.   # ● Set cursor
    146.   #     new_index : new cursor index
    147.   #--------------------------------------------------------------------------
    148.   def set_index(new_index)
    149.     new_index += @file_count if new_index < 0
    150.     $game_system.se_play($data_system.cursor_se)
    151.     @savefile_windows[@file_index % 4].selected = false
    152.     @file_index = new_index
    153.     self.top_index = new_index
    154.     @savefile_windows[@file_index % 4].selected = true
    155.   end
    156.   #--------------------------------------------------------------------------
    157.   # ● Test count of save files
    158.   #--------------------------------------------------------------------------
    159.   def save_count
    160.     i = 0
    161.     while FileTest.exists?(make_filename(i))
    162.       i += 1
    163.     end
    164.     return self.is_a?(Scene_Save) ? i + 1 : i
    165.   end
    166.   #--------------------------------------------------------------------------
    167.   # ● Redraw windows
    168.   #--------------------------------------------------------------------------
    169.   def redraw_windows
    170.     @savefile_windows.each { |i| i.dispose } unless @savefile_windows == nil
    171.     @savefile_windows = []
    172.     for i in @top_index...[@top_index + 4, @file_count].min
    173.       filename = make_filename(i)
    174.       window = Window_SaveFile.new(i, filename)
    175.       window.y = i % 4 * 104 + 64
    176.       @savefile_windows.push(window)
    177.     end
    178.     (4 - @savefile_windows.size).times do |i|
    179.       window = Window_Base.new(0, 376 - i * 104, 640, 104)
    180.       window.opacity = window.back_opacity = 128
    181.       @savefile_windows.push(window)
    182.     end
    183.   end
    184. end
    185. class Scene_Load < Scene_File
    186.   #--------------------------------------------------------------------------
    187.   # ● Initialize
    188.   #--------------------------------------------------------------------------
    189.   def initialize
    190.     $game_temp = Game_Temp.new
    191.     $game_temp.last_file_index = 0
    192.     latest_time = Time.at(0)
    193.     @file_count = save_count
    194.     for i in 0...@file_count
    195.       File.open(make_filename(i), "r") do |f|
    196.         if f.mtime > latest_time
    197.           latest_time = f.mtime
    198.           $game_temp.last_file_index = i
    199.         end
    200.       end
    201.     end
    202.     super("Which file to load?")
    203.   end
    204. end
    复制代码




    本贴来自国际rpgmaker官方论坛作者:SailCat处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/unlimited-save-slots-for-xp.171617/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-4 12:48 , Processed in 0.087468 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表