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

[转载发布] KDiurnalis XP

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

    连续签到: 2 天

    [LV.7]常住居民III

    4471

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 前天 17:17 | 显示全部楼层 |阅读模式
    KDiurnalis XP
    versions 1.0.6 & 1.1.0

    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.
    $scene = KDiurnalis::Scene.new
    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 - version 1.0.6

                    Ruby:        
    1. # * KDiurnalis XP Kiwi
    2. #   Scripter : Kyonides Arkanthes
    3. #   v 1.0.6 - 2022-06-17
    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. # * Aliased Method * #
    9. # Scene_Load#on_decision
    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.   CHANGE_VIEWPORT_COLOR = true
    26.   SHOW_DATES = nil
    27.   # Place the Backdrop in the Titles directory.
    28.   # Options: "Filename" or nil
    29.   BACKDROP = nil #"backdrop circles blue"
    30.   TITLE = "%s's Journal"
    31.   TITLE_ALIGN = 1
    32.   NO_ENTRY = "No Entry Found"
    33.   module Start
    34.     TITLE = "My New Adventure"
    35.     LOCATION = "Home"
    36.     TEXT = []
    37.     TEXT << "My history begins today."
    38.     TEXT << "I am very excited indeed."
    39.   end
    40.   PAGES_FOUND = "%s Pages Found"
    41.   PAGES_LABEL = "Page %s/%s"
    42.   PAGES_LABEL_ALIGN = 2
    43.   HELP_WIN_OPACITY = 160
    44.   # Window's Coordinates = [X, Y, Width, Height, Opacity]
    45.   LIST_WIN_COORD  = [16, 84, 180, 384, 160]
    46.   DUMMY_WIN_COORD = [224, 84, 388, 84, 160]
    47.   INFO_WIN_COORD  = [224, 84, 388, 352, 160]
    48.   # * End of Setup * #
    49.   extend self
    50.   attr_accessor :use_message_window
    51.   def open!() $scene = Scene.new end
    52.   def after_load_scene
    53.     open! if LOAD_OPENS_JOURNAL
    54.   end
    55.   def end_of_entry!() @use_message_window = nil end
    56.   alias :end_of_message! :end_of_entry!
    57. class KDJournal
    58.   def initialize
    59.     @dates = []
    60.     date = KDDate.new
    61.     entry = KDEntry.new(Start::TITLE.dup)
    62.     entry.location = Start::LOCATION
    63.     entry.texts = Start::TEXT.dup
    64.     date.add_entry(entry)
    65.     add_date(date)
    66.   end
    67.   def add_date(date)
    68.     @dates.unshift(date)
    69.     @last_date = date
    70.   end
    71.   def map(&blk) @dates.map(&blk) end
    72.   def last() @dates[-1] end
    73.   def [](pos) @dates[pos] end
    74.   def empty?() @dates.empty? end
    75.   def any?() @dates.any? end
    76.   def size() @dates.size end
    77.   attr_reader :dates, :last_date
    78. end
    79. class KDDate
    80.   def initialize
    81.     time = Time.now
    82.     @year = time.year
    83.     @month = time.month
    84.     @month_name = time.strftime("%b")
    85.     @day = time.mday
    86.     @day_name = time.strftime("%a")
    87.     @title = "#{@month_name} #{@day}, #{@year}"
    88.     @entries = []
    89.   end
    90.   def same_date?(nyear, nmonth, nday)
    91.     nyear == @year && nmonth == @month && nday == @day
    92.   end
    93.   def add_entry(entry)
    94.     @entries << entry
    95.     @last_entry = entry
    96.   end
    97.   attr_reader :year, :month, :month_name, :day, :day_name, :entries, :last_entry
    98.   attr_accessor :title
    99. end
    100. class KDEntry
    101.   def initialize(new_title)
    102.     @title = new_title
    103.     @location = ""
    104.     @texts = []
    105.   end
    106.   attr_reader :title
    107.   attr_accessor :texts, :location
    108. end
    109. class KDHelpWindow < Window_Base
    110.   def initialize
    111.     x, w = 80, Graphics.width
    112.     super(x, 12, w - x * 2, 56)
    113.     self.contents = Bitmap.new(width - 32, height - 32)
    114.   end
    115.   def set_text(text, align=0)
    116.     return if text == @text or align == @align
    117.     @text = text
    118.     @align = align
    119.     refresh
    120.   end
    121.   def refresh
    122.     contents.clear
    123.     contents.draw_text(0, 0, width - 32, 24, @text, @align)
    124.   end
    125. end
    126. class KDListWindow < Window_Selectable
    127.   def initialize(wx, wy, w, h)
    128.     @data = []
    129.     super
    130.     @data = $game_party.journal_entries
    131.     @item_max = @data.size
    132.     refresh
    133.     @index = 0
    134.   end
    135.   def draw_item(index)
    136.     item = @data[index]
    137.     contents.draw_text(4, index * 32, width - 32, 32, item.title)
    138.   end
    139.   def refresh
    140.     self.contents = Bitmap.new(width - 32, row_max * 32)
    141.     @item_max.times{|i| draw_item(i) }
    142.   end
    143.   def update_help() @help_window.index = @index end
    144.   def item() @data[@index] end
    145. end
    146. class KDDummyWindow < Window_Base
    147.   def initialize(wx, wy, w, h)
    148.     super
    149.     @index = 0
    150.     self.contents = Bitmap.new(width - 32, h - 32)
    151.     refresh
    152.   end
    153.   def refresh
    154.     contents.clear
    155.     date = $game_party.journal_entries[@index]
    156.     pages = sprintf(PAGES_FOUND, date.entries.size)
    157.     contents.draw_text(0, 0, width - 32, 24, pages)
    158.   end
    159.   def index=(pos)
    160.     return if @index == pos
    161.     @index = pos
    162.     refresh
    163.   end
    164. end
    165. class KDInfoWindow < Window_Base
    166.   def show_entries(entry)
    167.     self.visible = true
    168.     @entries = entry
    169.     @total = @entries.size
    170.     @index = @total - 1
    171.     @entry = @entries.last
    172.     self.contents = Bitmap.new(width - 32, height - 32)
    173.     refresh
    174.   end
    175.   def refresh
    176.     contents.clear
    177.     w = width - 32
    178.     f = contents.font
    179.     f.bold = true
    180.     contents.draw_text(0, 0, w, 24, @entry.title, 1)
    181.     contents.draw_text(4, 32, w, 24, @entry.location)
    182.     f.bold = false
    183.     ly = 64
    184.     @entry.texts.each do |text|
    185.       contents.draw_text(4, ly, w, 24, text)
    186.       ly += 24
    187.     end
    188.     ly = height - 56
    189.     pages = sprintf(PAGES_LABEL, @index + 1, @entries.size)
    190.     contents.draw_text(0, ly, w, 24, pages, PAGES_LABEL_ALIGN)
    191.   end
    192.   def update
    193.     if Input.trigger?(Input::LEFT)
    194.       return $game_system.se_play($data_system.buzzer_se) if @total == 1
    195.       $game_system.se_play($data_system.cursor_se)
    196.       @index = (@index - 1) % @total
    197.       @entry = @entries[@index]
    198.       refresh
    199.       return
    200.     elsif Input.trigger?(Input::RIGHT)
    201.       return $game_system.se_play($data_system.buzzer_se) if @total == 1
    202.       $game_system.se_play($data_system.cursor_se)
    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
    211.   def main
    212.     start
    213.     Graphics.transition
    214.     while @stage
    215.       Graphics.update
    216.       Input.update
    217.       update
    218.     end
    219.     Graphics.freeze
    220.     terminate
    221.   end
    222.   def create_backdrop
    223.     if BACKDROP
    224.       @backdrop = Sprite.new
    225.       @backdrop.bitmap = RPG::Cache.title(BACKDROP).dup
    226.     else
    227.       @backdrop = Spriteset_Map.new
    228.       @backdrop.alter_viewport_color if CHANGE_VIEWPORT_COLOR
    229.     end
    230.   end
    231.   def start
    232.     @stage = SHOW_DATES ? :list : :info
    233.     lx, ly, lw, lh, lbo = LIST_WIN_COORD
    234.     dx, dy, dw, dh, dbo = DUMMY_WIN_COORD
    235.     ix, iy, iw, ih, ibo = INFO_WIN_COORD
    236.     create_backdrop
    237.     @help_window = KDHelpWindow.new
    238.     text = sprintf(TITLE, $game_party.leader.name)
    239.     @help_window.set_text(text, TITLE_ALIGN)
    240.     @help_window.back_opacity = HELP_WIN_OPACITY
    241.     @list_window = KDListWindow.new(lx, ly, lw, lh)
    242.     @list_window.back_opacity = lbo
    243.     @list_window.visible = SHOW_DATES
    244.     @dummy_window = KDDummyWindow.new(dx, dy, dw, dh)
    245.     @dummy_window.back_opacity = dbo
    246.     @dummy_window.visible = SHOW_DATES
    247.     @list_window.help_window = @dummy_window
    248.     @info_window = KDInfoWindow.new(ix, iy, iw, ih)
    249.     @info_window.back_opacity = ibo
    250.     @info_window.visible = !SHOW_DATES
    251.     open_last_entry
    252.   end
    253.   def open_last_entry
    254.     if SHOW_DATES
    255.       date = @list_window.item
    256.       @info_window.show_entries(date.entries)
    257.     else
    258.       entries = $game_party.journal_entries.map{|date| date.entries }
    259.       entries = entries.flatten
    260.       @info_window.show_entries(entries)
    261.     end
    262.     @stage = :info
    263.   end
    264.   def terminate
    265.     @help_window.dispose
    266.     @list_window.dispose
    267.     @dummy_window.dispose
    268.     @info_window.dispose
    269.     @backdrop.bitmap.dispose if BACKDROP
    270.     @backdrop.dispose
    271.   end
    272.   def update
    273.     case @stage
    274.     when :list
    275.       update_list
    276.     when :info
    277.       update_info
    278.     end
    279.   end
    280.   def update_list
    281.     @list_window.update
    282.     if Input.trigger?(Input::B)
    283.       $game_system.se_play($data_system.cancel_se)
    284.       $scene = Scene_Map.new
    285.       return @stage = nil
    286.     elsif Input.trigger?(Input::C)
    287.       $game_system.se_play($data_system.decision_se)
    288.       @dummy_window.visible = false
    289.       open_last_entry
    290.     end
    291.   end
    292.   def update_info
    293.     @info_window.update
    294.     if Input.trigger?(Input::B)
    295.       $game_system.se_play($data_system.cancel_se)
    296.       unless SHOW_DATES
    297.         $scene = Scene_Map.new
    298.         return @stage = nil
    299.       end
    300.       @info_window.visible = false
    301.       @info_window.clear
    302.       @dummy_window.visible = true
    303.       @stage = :list
    304.     end
    305.   end
    306. end
    307. end
    308. unless $HIDDENCHEST or $MKXP
    309. module Graphics
    310.   def self.width() 640 end
    311.   def self.height() 480 end
    312. end
    313. end
    314. class Game_Party
    315.   alias :kyon_diurnalis_gm_pty_init :initialize
    316.   def initialize
    317.     kyon_diurnalis_gm_pty_init
    318.     @journal_entries = KDiurnalis::KDJournal.new
    319.   end
    320.   def add_journal_entry(title, place)
    321.     place = $game_map.map_name if place == :map
    322.     date = @journal_entries.last_date
    323.     time = Time.now
    324.     KDiurnalis.use_message_window = true
    325.     entry = KDiurnalis::KDEntry.new(title)
    326.     entry.location = place
    327.     if date and date.same_date?(time.year, time.month, time.day)
    328.       date.add_entry(entry)
    329.     else
    330.       date = KDiurnalis::KDDate.new
    331.       date.add_entry(entry)
    332.       @journal_entries.add_date(date)
    333.     end
    334.   end
    335.   def total_journal_entries?(n)
    336.     @journal_entries.size == n
    337.   end
    338.   def last_journal_entry_pages?(n)
    339.     @journal_entries.last.entries.size == n
    340.   end
    341.   def leader() @actors[0] end
    342.   attr_reader :journal_entries
    343. end
    344. class Game_Map
    345.   alias :kyon_diurnalis_gm_map_setup :setup
    346.   def setup(map_id)
    347.     kyon_diurnalis_gm_map_setup(map_id)
    348.     @map_name = load_data("Data/MapInfos.rxdata")[map_id].name
    349.   end
    350.   attr_reader :map_name
    351. end
    352. class Game_Event
    353.   def name() @event.name end
    354.   def name=(text) @event.name = text end
    355. end
    356. class Interpreter
    357.   alias :kyon_diurnalis_gm_int_comm_101 :command_101
    358.   def process_journal_entries
    359.     date = $game_party.journal_entries.last_date
    360.     entry = date.last_entry
    361.     command = @list[@index]
    362.     codes = [101, 401]
    363.     while codes.include?(command.code)
    364.       line = command.parameters[0]
    365.       line.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
    366.       line.gsub!(/\\E\[([0-9]+)\]/i) { $game_map.events[$1.to_i].name }
    367.       entry.texts << line
    368.       @index += 1
    369.       command = @list[@index]
    370.     end
    371.     KDiurnalis.end_of_message!
    372.     false
    373.   end
    374.   def command_101
    375.     if KDiurnalis.use_message_window
    376.       process_journal_entries
    377.     else
    378.       kyon_diurnalis_gm_int_comm_101
    379.     end
    380.   end
    381. end
    382. class Spriteset_Map
    383.   def alter_viewport_color
    384.     @viewport1.color.set(16, 16, 16, 128)
    385.     @viewport1.update
    386.   end
    387. end
    388. class Scene_Load
    389.   alias :kyon_diurnalis_scn_load_on_dec on_decision
    390.   def on_decision(filename)
    391.     kyon_diurnalis_scn_load_on_dec(filename)
    392.     KDiurnalis.after_load_scene
    393.   end
    394. 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-xp.148595/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-14 17:58 , Processed in 0.077662 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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