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

[转载发布] KDiurnalis ACE

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

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 2026-8-2 20:11:06 | 显示全部楼层 |阅读模式
    KDiurnalis ACE
    version 1.0.5
    by Kyonides Arkanthes



    Introduction

    This is a Party's Journal Script!

    Tweak this script's CONSTANTS in order to customize the Journal Menu's GUI.
    You can find them under the KDiurnalis module.

    There are two ways to open the Journal Menu.
    SceneManager.call(KDiurnalis::Scene)
    KDiurnalis.open!

    To learn more about how to use my script please read the instructions embedded in it.

    Notes:

    The demo includes examples of how you can easily add entry lines to an existing date.
    It will automatically create a new date entry if the current date is different from the previous one.

    Now it features stuff like automatic substitutions of tags like \n[1] or \e[1]!

    The Script

                    Ruby:       
    1. # * KDiurnalis ACE
    2. #   Scripter : Kyonides Arkanthes
    3. #   v 1.0.5 - 2022-06-16
    4. # * Non Plug & Play Script * #
    5. # The Party's Journal Script!
    6. # Tweak this script's CONSTANTS in order to customize the Journal Menu's GUI.
    7. # You can find them under the KDiurnalis module.
    8. # * Overwritten Method * #
    9. # Scene_Load#on_load_success
    10. # * Script Calls * #
    11. # - Open Journal Scene - 2 Options
    12. # $scene = KDiurnalis::Scene.new
    13. # KDiurnalis.open!
    14. # - Add New Journal Page Steps - #
    15. # -- Step 1
    16. # Location: can be replaced with a "String" or :map for current map name.
    17. # $game_party.add_journal_entry("Title", Location)
    18. # -- Step 2
    19. # Add as many Message Windows and lines of text as you wish!
    20. # -- Step 3
    21. # - Stop Using Message Windows as Journal Entry's Page Contents
    22. # Simply stop adding any more message windows!
    23. module KDiurnalis
    24.   LOAD_OPENS_JOURNAL = true
    25.   SHOW_DATES = nil
    26.   # Place the Backdrop in the Titles1 directory.
    27.   # Options: "Filename" or nil
    28.   BACKDROP = "backdrop circles blue"
    29.   TITLE = "%s's Journal"
    30.   TITLE_ALIGN = 1
    31.   NO_ENTRY = "No Entry Found"
    32.   module Start
    33.     TITLE = "My New Adventure"
    34.     LOCATION = "Home"
    35.     TEXT = []
    36.     TEXT << "My history begins today."
    37.     TEXT << "I am very excited indeed."
    38.   end
    39.   PAGES_FOUND = "%s Pages Found"
    40.   PAGES_LABEL = "Page %s/%s"
    41.   PAGES_LABEL_ALIGN = 2
    42.   HELP_WIN_OPACITY = 160
    43.   # Window's Coordinates = [X, Y, Width, Height, Opacity]
    44.   LIST_WIN_COORD  = [8, 76, 160, 320, 160]
    45.   DUMMY_WIN_COORD = [176, 76, 360, 84, 160]
    46.   INFO_WIN_COORD  = [176, 76, 360, 320, 160]
    47.   # * End of Setup * #
    48.   extend self
    49.   attr_accessor :use_message_window
    50.   def open!() SceneManager.goto(Scene) end
    51.   def after_load_scene
    52.     LOAD_OPENS_JOURNAL ? open! : SceneManager.goto(Scene_Map)
    53.   end
    54.   def end_of_entry!() @use_message_window = nil end
    55.   alias :end_of_message! :end_of_entry!
    56. class KDJournal
    57.   def initialize
    58.     @dates = []
    59.     date = KDDate.new
    60.     entry = KDEntry.new(Start::TITLE.dup)
    61.     entry.location = Start::LOCATION
    62.     entry.texts = Start::TEXT.dup
    63.     date.add_entry(entry)
    64.     add_date(date)
    65.   end
    66.   def add_date(date)
    67.     @dates.unshift(date)
    68.     @last_date = date
    69.   end
    70.   def map(&blk) @dates.map(&blk) end
    71.   def last() @dates[-1] end
    72.   def [](pos) @dates[pos] end
    73.   def empty?() @dates.empty? end
    74.   def any?() @dates.any? end
    75.   def size() @dates.size end
    76.   attr_reader :dates, :last_date
    77. end
    78. class KDDate
    79.   def initialize
    80.     time = Time.now
    81.     @year = time.year
    82.     @month = time.month
    83.     @month_name = time.strftime("%b")
    84.     @day = time.mday
    85.     @day_name = time.strftime("%a")
    86.     @title = "#{@month_name} #{@day}, #{@year}"
    87.     @entries = []
    88.   end
    89.   def same_date?(nyear, nmonth, nday)
    90.     nyear == @year && nmonth == @month && nday == @day
    91.   end
    92.   def add_entry(entry)
    93.     @entries << entry
    94.     @last_entry = entry
    95.   end
    96.   attr_reader :year, :month, :month_name, :day, :day_name, :entries, :last_entry
    97.   attr_accessor :title
    98. end
    99. class KDEntry
    100.   def initialize(new_title)
    101.     @title = new_title
    102.     @location = ""
    103.     @texts = []
    104.   end
    105.   attr_reader :title
    106.   attr_accessor :texts, :location
    107. end
    108. class KDHelpWindow < Window_Base
    109.   def initialize
    110.     x, w = 80, Graphics.width
    111.     super(x, 12, w - x * 2, 52)
    112.   end
    113.   def set_text(text, align=0)
    114.     return if text == @text or align == @align
    115.     @text = text
    116.     @align = align
    117.     refresh
    118.   end
    119.   def refresh
    120.     contents.clear
    121.     draw_text(0, 0, contents_width, 26, @text, @align)
    122.   end
    123. end
    124. class KDListWindow < Window_Selectable
    125.   def initialize(wx, wy, w, h)
    126.     @data = []
    127.     super
    128.     @data = $game_party.journal_entries
    129.     refresh
    130.     select(0)
    131.     activate
    132.   end
    133.   def draw_item(index)
    134.     item = @data[index]
    135.     rect = item_rect(index)
    136.     rect.x += 4
    137.     rect.width -= 8
    138.     draw_text(rect, item.title)
    139.   end
    140.   def refresh
    141.     create_contents
    142.     item_max.times{|i| draw_item(i) }
    143.   end
    144.   def item_max() @data.any? ? @data.size : 1 end
    145.   def item() @data[@index] end
    146.   attr_writer :desc_window
    147. end
    148. class KDDummyWindow < Window_Base
    149.   def initialize(wx, wy, w, h)
    150.     super
    151.     @index = 0
    152.     refresh
    153.   end
    154.   def refresh
    155.     contents.clear
    156.     date = $game_party.journal_entries[@index]
    157.     pages = sprintf(PAGES_FOUND, date.entries.size)
    158.     draw_text(0, 0, contents_width, 24, pages)
    159.   end
    160.   def index=(pos)
    161.     return if @index == pos
    162.     @index = pos
    163.     refresh
    164.   end
    165. end
    166. class KDInfoWindow < Window_Base
    167.   def show_entries(entry)
    168.     self.visible = true
    169.     @entries = entry
    170.     @total = @entries.size
    171.     @index = @total - 1
    172.     @entry = @entries.last
    173.     refresh
    174.   end
    175.   def refresh
    176.     contents.clear
    177.     w = contents_width
    178.     f = contents.font
    179.     f.bold = true
    180.     draw_text(0, 0, w, 24, @entry.title, 1)
    181.     draw_text(4, 32, w, 24, @entry.location)
    182.     f.bold = false
    183.     ly = 64
    184.     @entry.texts.each do |text|
    185.       draw_text(4, ly, w, 24, text)
    186.       ly += 24
    187.     end
    188.     ly = height - 52
    189.     pages = sprintf(PAGES_LABEL, @index + 1, @entries.size)
    190.     draw_text(0, ly, w, 24, pages, PAGES_LABEL_ALIGN)
    191.   end
    192.   def update
    193.     if Input.trigger?(:LEFT)
    194.       return Sound.play_buzzer if @total == 1
    195.       Sound.play_cursor
    196.       @index = (@index - 1) % @total
    197.       @entry = @entries[@index]
    198.       refresh
    199.       return
    200.     elsif Input.trigger?(:RIGHT)
    201.       return Sound.play_buzzer if @total == 1
    202.       Sound.play_cursor
    203.       @index = (@index + 1) % @total
    204.       @entry = @entries[@index]
    205.       refresh
    206.     end
    207.   end
    208.   def clear() contents.clear end
    209. end
    210. class Scene < Scene_Base
    211.   def start
    212.     create_main_viewport
    213.     @stage = SHOW_DATES ? :list : :info
    214.     lx, ly, lw, lh, lbo = LIST_WIN_COORD
    215.     dx, dy, dw, dh, dbo = DUMMY_WIN_COORD
    216.     ix, iy, iw, ih, ibo = INFO_WIN_COORD
    217.     @backdrop = Sprite.new
    218.     if BACKDROP
    219.       @backdrop.bitmap = Cache.title1(BACKDROP).dup
    220.     else
    221.       @backdrop.bitmap = SceneManager.background_bitmap
    222.       @backdrop.color.set(16, 16, 16, 128)
    223.     end
    224.     @help_window = KDHelpWindow.new
    225.     text = sprintf(TITLE, $game_party.name)
    226.     @help_window.set_text(text, TITLE_ALIGN)
    227.     @help_window.back_opacity = HELP_WIN_OPACITY
    228.     @list_window = KDListWindow.new(lx, ly, lw, lh)
    229.     @list_window.back_opacity = lbo
    230.     @list_window.visible = SHOW_DATES
    231.     @dummy_window = KDDummyWindow.new(dx, dy, dw, dh)
    232.     @dummy_window.back_opacity = dbo
    233.     @dummy_window.visible = SHOW_DATES
    234.     @list_window.desc_window = @dummy_window
    235.     @info_window = KDInfoWindow.new(ix, iy, iw, ih)
    236.     @info_window.back_opacity = ibo
    237.     @info_window.visible = !SHOW_DATES
    238.     open_last_entry
    239.   end
    240.   def open_last_entry
    241.     if SHOW_DATES
    242.       date = @list_window.item
    243.       @info_window.show_entries(date.entries)
    244.     else
    245.       entries = $game_party.journal_entries.map{|date| date.entries }
    246.       entries = entries.flatten
    247.       @info_window.show_entries(entries)
    248.     end
    249.     @stage = :info
    250.   end
    251.   def terminate
    252.     super
    253.     @backdrop.bitmap.dispose
    254.     @backdrop.dispose
    255.   end
    256.   def update
    257.     Graphics.update
    258.     Input.update
    259.     case @stage
    260.     when :list
    261.       update_list
    262.     when :info
    263.       update_info
    264.     end
    265.   end
    266.   def update_list
    267.     @list_window.update
    268.     if Input.trigger?(:B)
    269.       Sound.play_cancel
    270.       SceneManager.call(Scene_Map)
    271.       return
    272.     elsif Input.trigger?(:C)
    273.       Sound.play_ok
    274.       @dummy_window.visible = false
    275.       open_last_entry
    276.     end
    277.   end
    278.   def update_info
    279.     @info_window.update
    280.     if Input.trigger?(:B)
    281.       Sound.play_cancel
    282.       unless SHOW_DATES
    283.         SceneManager.call(Scene_Map)
    284.         return
    285.       end
    286.       @info_window.visible = false
    287.       @info_window.clear
    288.       @dummy_window.visible = true
    289.       @stage = :list
    290.     end
    291.   end
    292. end
    293. end
    294. class Game_Party
    295.   alias :kyon_diurnalis_gm_pty_init :initialize
    296.   def initialize
    297.     kyon_diurnalis_gm_pty_init
    298.     @journal_entries = KDiurnalis::KDJournal.new
    299.   end
    300.   def add_journal_entry(title, place)
    301.     place = $game_map.display_name if place == :map
    302.     date = @journal_entries.last_date
    303.     time = Time.now
    304.     KDiurnalis.use_message_window = true
    305.     entry = KDiurnalis::KDEntry.new(title)
    306.     entry.location = place
    307.     if date and date.same_date?(time.year, time.month, time.day)
    308.       date.add_entry(entry)
    309.     else
    310.       date = KDiurnalis::KDDate.new
    311.       date.add_entry(entry)
    312.       @journal_entries.add_date(date)
    313.     end
    314.   end
    315.   def total_journal_entries?(n)
    316.     @journal_entries.size == n
    317.   end
    318.   def last_journal_entry_pages?(n)
    319.     @journal_entries.last.entries.size == n
    320.   end
    321.   attr_reader :journal_entries
    322. end
    323. class Game_Event
    324.   def name() @event.name end
    325.   def name=(text) @event.name = text end
    326. end
    327. class Game_Interpreter
    328.   alias :kyon_diurnalis_gm_int_comm_101 :command_101
    329.   def process_journal_entries
    330.     @index += 1
    331.     date = $game_party.journal_entries.last_date
    332.     entry = date.last_entry
    333.     codes = [101, 401]
    334.     command = @list[@index]
    335.     while codes.include?(command.code)
    336.       if command.code == 401
    337.         line = command.parameters[0]
    338.         line.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
    339.         line.gsub!(/\\E\[([0-9]+)\]/i) { $game_map.events[$1.to_i].name }
    340.         entry.texts << line
    341.       end
    342.       @index += 1
    343.       command = @list[@index]
    344.     end
    345.     @index -= 1
    346.     KDiurnalis.end_of_message!
    347.     true
    348.   end
    349.   def command_101
    350.     if KDiurnalis.use_message_window
    351.       process_journal_entries
    352.     else
    353.       kyon_diurnalis_gm_int_comm_101
    354.     end
    355.   end
    356. end
    357. class Scene_Load
    358.   def on_load_success
    359.     Sound.play_load
    360.     fadeout_all
    361.     $game_system.on_after_load
    362.     KDiurnalis.after_load_scene
    363.   end
    364. end
    复制代码





    Terms & Conditions

    Free as in beer for non commercial games.
    Contact me if you want to go commercial. (There will be an inexpensive charge for this script only.)


    本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/kdiurnalis-ace.148557/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-17 08:32 , Processed in 0.136299 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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