Jump to content
dbchest

dbchest's Datalog

Recommended Posts

#==============================================================================
# ** dbchest's Datalog (v2.0)
#==============================================================================
# ** Credits (Freeware)
#------------------------------------------------------------------------------
#  a list of credits for those involved in the production of said script.
#  you are responsible for crediting those mentioned (using discretion).
#  you do not have to credit special mentions. they are being thanked now.
#------------------------------------------------------------------------------
#  programmer: dbchest (none required, always appreciated)
#  special thanks: Riff (rpgmakervxace.net) # for general help RGSS3.
#==============================================================================
# ** Details
#------------------------------------------------------------------------------
#  any notable programmer would have one to include in their resume! it's my
#  pleasure to present you with what i consider to be a satisfactory grade
#  datalog script. included in your project, you will give your players the
#  opportunity to review important events, people, places, and more. should you
#  come across any programming errors, be sure to contact me at
#  rpgmakervxace.net (dbchest) with information of your findings. thanks for
#  trying me out.
#==============================================================================
# ** Features
#------------------------------------------------------------------------------
#  access your datalog from your menu.
#  record and review important events, people, places, etc...
#  organize information into multiple pages for each subject. ** NEW
#  control the order in which commands and information is added to your log.
#==============================================================================
# ** Installation Instructions (Plug and Play)
#------------------------------------------------------------------------------
#  paste script in "Materials" section of the script editor.
#  no known compatibility issues.
#  no foreign script requirements.
#==============================================================================

here is a link to the official demo: (v1.0)

http://www.mediafire.com/download/q1b8a7k47cx05mj/dbchest's_Datalog_v1.0.exe

 

here is a link to the official demo: (v2.0)

http://www.mediafire.com/download/4whir2ioayp1s36/dbchest's_Datalog_v2.0_(final).exe

 

here is a mirror link to the official demo: (v2.0)

https://www.dropbox.com/s/qgsj9qlklpv51ms/dbchest%27s%20Datalog%20v2.0%20%28final%29.exe?dl=0

 

i'm happy to share v2.0 of dbchest's Datalog with you all. this new version features a complete rewrite of the script's framework from the ground up. the cleaner code and hash arrays provide a simpler means of introducing information into the datalog than in the previous version. apart from functionality and convenience, aesthetics were also considered in v2.0. i believe i did a good job integrating the natural flow of the RTP into the design of this script.

 

what's next?

well...what do you guys think it needs?

 

Script:

 

 

#==============================================================================
# ** dbchest's Datalog (v2.0)
#==============================================================================
# ** Credits (Freeware)
#------------------------------------------------------------------------------
#  a list of credits for those involved in the production of said script.
#  you are responsible for crediting those mentioned (using discretion).
#  you do not have to credit special mentions. they are being thanked now.
#------------------------------------------------------------------------------
#  programmer: dbchest (none required, always appreciated)
#  special thanks: Riff (rpgmakervxace.net) # for general help RGSS3.
#==============================================================================
# ** Details
#------------------------------------------------------------------------------
#  any notable programmer would have one to include in their resume! it's my
#  pleasure to present you with what i consider to be a satisfactory grade
#  datalog script. included in your project, you will give your players the
#  opportunity to review important events, people, places, and more. should you
#  come across any programming errors, be sure to contact me at
#  rpgmakervxace.net (dbchest) with information of your findings. thanks for
#  trying me out.
#==============================================================================
# ** Features
#------------------------------------------------------------------------------
#  access your datalog from your menu.
#  record and review important events, people, places, etc...
#  control the order in which commands and information is added to your log.
#==============================================================================
# ** Installation Instructions (Plug and Play)
#------------------------------------------------------------------------------
#  paste script in "Materials" section of the script editor.
#  no known compatibility issues.
#  no foreign script requirements.
#==============================================================================

#==============================================================================
# ** Datalog
#------------------------------------------------------------------------------
#  This module defines subjects and their content within the datalog. The
# display window can accomodate fifty-one text characters per line. Begin new
# lines by using the \n expression.
#==============================================================================

module Datalog
  #--------------------------------------------------------------------------
  # * Constants
  #--------------------------------------------------------------------------
  DATALOG = "Datalog"
  HELP    = "Review detailed information about " # 34 / 51 => *17 remaining*
  #--------------------------------------------------------------------------
  # * Constants (Subject Help)
  #--------------------------------------------------------------------------
  COM1HELP = "storyline events\nthat have taken shape thus far."
  COM2HELP = "the diverse\nenvironments you've explored."
  #--------------------------------------------------------------------------
  # * Constants (Content Help)
  #--------------------------------------------------------------------------
  SINGHELP = "."
  PLURHELP = "s."
  #--------------------------------------------------------------------------
  # * Constants (Content Text Display)
  #--------------------------------------------------------------------------
  INFO1 = "INFO1"
  INFO2 = "INFO2"
  INFO3 = "INFO3"
  INFO4 = "INFO4\nINFO5"
  #--------------------------------------------------------------------------
  # * Key Mapping (Subjects)
  #--------------------------------------------------------------------------
  SUBJECT = {}
  SUBJECT[:story]     =
         {:help       => COM1HELP,
          :string     => "Storyline",
          :content    => ["A New Day"]                                      }
  SUBJECT[:locations] =
         {:help       => COM2HELP,
          :string     => "Locations",
          :content    => ["Amarillo"]                                       }
  #--------------------------------------------------------------------------
  # * Key Mapping (Contents)
  #--------------------------------------------------------------------------
  CONTENT = {}
  CONTENT[:story]     =
         {:help       => SINGHELP,
          :anewday    => INFO1,
          :anewnight  => INFO2                                              }
  CONTENT[:locations] =
         {:help       => SINGHELP,
          :amarillo   => [INFO3, INFO4]                                     }
end
#==============================================================================
# ** Window_MenuCommand
#------------------------------------------------------------------------------
#  This command window appears on the menu screen.
#==============================================================================

class Window_MenuCommand < Window_Command
  #--------------------------------------------------------------------------
  # * For Adding Original Commands
  #--------------------------------------------------------------------------
  def add_original_commands
    add_command(Datalog::DATALOG, :datalog, datalog_enabled?)
  end
  #--------------------------------------------------------------------------
  # * Get Activation State of Datalog Commands
  #--------------------------------------------------------------------------
  def datalog_enabled?
    return true
    #return true if Datalog::SUBJECT[:story][:content].size > 0
    #return true if Datalog::SUBJECT[:locations][:content].size > 0
  end
end
#==============================================================================
# ** Window_DatalogHeader
#------------------------------------------------------------------------------
#  This window appears on the datalog screen.
#==============================================================================

class Window_DatalogHeader < Window_Base
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor   :text
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 72, window_width, window_height)
    @text = Datalog::DATALOG
    draw_header
  end
  #--------------------------------------------------------------------------
  # * Get Window Width
  #--------------------------------------------------------------------------
  def window_width
    return 160
  end
  #--------------------------------------------------------------------------
  # * Get Window Width
  #--------------------------------------------------------------------------
  def window_height
    return line_height + standard_padding * 2
  end
  #--------------------------------------------------------------------------
  # * Draw Header Text
  #--------------------------------------------------------------------------
  def draw_header
    contents.draw_text(4, 0, window_width, line_height, @text)
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    draw_header
  end
end
#==============================================================================
# ** Window_DatalogCommand
#------------------------------------------------------------------------------
#  This command window appears on the datalog screen.
#==============================================================================

class Window_DatalogCommand < Window_Command
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :subject                       # current subject
  attr_accessor :content                       # current content
  attr_accessor :command_list                  # current command list
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @subject = nil
    @content = nil
    @command_list = :subjects
    super(0, 120)
  end
  #--------------------------------------------------------------------------
  # * Window Width
  #--------------------------------------------------------------------------
  def window_width
    return 160
  end
  #--------------------------------------------------------------------------
  # * Window Height
  #--------------------------------------------------------------------------
  def window_height
    return Graphics.height - 120
  end
  #--------------------------------------------------------------------------
  # * Create Command List
  #--------------------------------------------------------------------------
  def make_command_list
    if @command_list == :subjects
      Datalog::SUBJECT.each do |key, value|
        add_command(value[:string], key, true)
      end
    elsif @command_list == :contents
      Datalog::SUBJECT[@subject][:content].each do |content|
        add_command(content, create_symbol(content), true,)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Create Symbol for Content
  #--------------------------------------------------------------------------
  def create_symbol(content)
    string = content.clone
    string.slice!(/\s/) until !string.include?(" ")
    return string.downcase.to_sym
  end
end
#==============================================================================
# ** Window_DatalogPages
#------------------------------------------------------------------------------
#  This window appears on the datalog screen.
#==============================================================================

class Window_DatalogPages < Window_Selectable
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :current_page                   # current page
  attr_accessor :max_page                       # maximum page
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(160, 72, window_width, window_height)
    @current_page = 1
    @max_page = nil
  end
  #--------------------------------------------------------------------------
  # * Window Width
  #--------------------------------------------------------------------------
  def window_width
    return Graphics.width - 160
  end
  #--------------------------------------------------------------------------
  # * Window Height
  #--------------------------------------------------------------------------
  def window_height
    return Graphics.height - 72
  end
  #--------------------------------------------------------------------------
  # * Get Number of Items
  #--------------------------------------------------------------------------
  def item_max
    return 1
  end
  #--------------------------------------------------------------------------
  # * Get Item Width
  #--------------------------------------------------------------------------
  def item_width
    current = @current_page.to_s
    max = @max_page.to_s
    text = "Page" + " " + current + "/" + max
    return text.size * 10.9
  end
  #--------------------------------------------------------------------------
  # * Draw Page Number
  #--------------------------------------------------------------------------
  def draw_page_number
    rect = Rect.new(4, 0, window_width, line_height)
    current = @current_page.to_s
    max = @max_page.to_s
    text = "Page" + " " + current + "/" + max
    draw_text(rect, text)
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    draw_page_number
  end
end
#==============================================================================
# ** Window_DatalogText
#------------------------------------------------------------------------------
#  This window shows detailed descriptions of selected content.
#==============================================================================

class Window_DatalogText < Window_Help
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(line_number = 13)
    super
  end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs the menu screen processing.
#==============================================================================

class Scene_Menu < Scene_MenuBase
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    @command_window = Window_MenuCommand.new
    @command_window.set_handler(:item,      method(:command_item))
    @command_window.set_handler(:skill,     method(:command_personal))
    @command_window.set_handler(:equip,     method(:command_personal))
    @command_window.set_handler(:status,    method(:command_personal))
    @command_window.set_handler(:formation, method(:command_formation))
    @command_window.set_handler(:datalog,   method(:command_datalog))
    @command_window.set_handler(:save,      method(:command_save))
    @command_window.set_handler(:game_end,  method(:command_game_end))
    @command_window.set_handler(:cancel,    method(:return_scene))
  end
  #--------------------------------------------------------------------------
  # * [Datalog] Command
  #--------------------------------------------------------------------------
  def command_datalog
    SceneManager.call(Scene_Datalog)
  end
end
#==============================================================================
# ** Scene_Datalog
#------------------------------------------------------------------------------
#  This class performs the datalog screen processing.
#==============================================================================

class Scene_Datalog < Scene_MenuBase
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  def start
    super
    @subject = nil
    @content = nil
    create_help_window
    create_header_window
    create_command_window
    create_pages_window
    create_text_window
  end
  #--------------------------------------------------------------------------
  # * Frame Update (Basic)
  #--------------------------------------------------------------------------
  def update_basic
    super
    update_help_window
    update_text_window
    update_display_window
  end
  #--------------------------------------------------------------------------
  # * Update Help Window
  #--------------------------------------------------------------------------
  def update_help_window
    return unless @command_window.active
    @help_window.set_text(help_text)
  end
  #--------------------------------------------------------------------------
  # * Get Help Window Text
  #--------------------------------------------------------------------------
  def help_text
    if @command_window.command_list == :subjects
      sub = Datalog::HELP
      main = Datalog::SUBJECT[@command_window.current_symbol][:help]
      return sub + main
    elsif @command_window.command_list == :contents
      sub = Datalog::HELP
      main = @command_window.command_name(@command_window.index)
      post = Datalog::CONTENT[@subject][:help]
      return sub + main + post
    end
  end
  #--------------------------------------------------------------------------
  # * Update Text Window
  #--------------------------------------------------------------------------
  def update_text_window
    return unless @pages.active
    @text_window.set_text(display_text)
  end
  #--------------------------------------------------------------------------
  # * Get Display Window Text
  #--------------------------------------------------------------------------
  def display_text
    if Datalog::CONTENT[@subject][@content].instance_of?(Array)
      path = Datalog::CONTENT[@subject][@content]
      return path[@pages.current_page - 1]
    else
      return Datalog::CONTENT[@subject][@content]
    end
  end
  #--------------------------------------------------------------------------
  # * Update Display Window
  #--------------------------------------------------------------------------
  def update_display_window
    return unless @pages.active
    if Input.trigger?(:LEFT)
      unless @pages.current_page == 1
        Sound.play_cursor
        @pages.current_page -= 1
      end
    elsif Input.trigger?(:RIGHT)
      unless @pages.current_page == @pages.max_page
        Sound.play_cursor
        @pages.current_page += 1
      end
    end
    @pages.refresh
  end
  #--------------------------------------------------------------------------
  # * Create Header Window
  #--------------------------------------------------------------------------
  def create_header_window
    @header_window = Window_DatalogHeader.new
  end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    @command_window = Window_DatalogCommand.new
    @command_window.set_handler(:cancel, method(:on_cancel))
    set_subject_handlers
    set_content_handlers
  end
  #--------------------------------------------------------------------------
  # * Set Command Window Subject Handlers
  #--------------------------------------------------------------------------
  def set_subject_handlers
    Datalog::SUBJECT.each do |key, value|
      @command_window.set_handler(key, method(:command_subject))
    end
  end
  #--------------------------------------------------------------------------
  # * Set Command Window Content Handlers
  #--------------------------------------------------------------------------
  def set_content_handlers
    Datalog::SUBJECT.each do |key, value|
      value[:content].each do |content|
        string = content.clone
        string.slice!(/\s/) until !string.include?(" ")
        symbol = string.downcase.to_sym
        @command_window.set_handler(symbol, method(:command_content))
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Create Pages Window
  #--------------------------------------------------------------------------
  def create_pages_window
    @pages = Window_DatalogPages.new
    @pages.set_handler(:cancel, method(:on_display_cancel))
  end
  #--------------------------------------------------------------------------
  # * Create Text Window
  #--------------------------------------------------------------------------
  def create_text_window
    @text_window = Window_DatalogText.new
    @text_window.x = 160
    @text_window.y = 96
    @text_window.width = 384
    @text_window.height = 344
    @text_window.opacity = 0
    @text_window.arrows_visible = false
  end
  #--------------------------------------------------------------------------
  # * [Subject] Command
  #--------------------------------------------------------------------------
  def command_subject
    set_subject
    update_command_window
    update_header_window
  end
  #--------------------------------------------------------------------------
  # * [Content] Command
  #--------------------------------------------------------------------------
  def command_content
    set_content
    set_max_page
    @command_window.deactivate
    @pages.refresh
    @pages.activate.select(0)
  end
  #--------------------------------------------------------------------------
  # * [Cancel] Display
  #--------------------------------------------------------------------------
  def on_display_cancel
    @text_window.clear
    @pages.contents.clear
    @pages.deactivate.unselect
    @pages.current_page = 1
    @command_window.activate
  end
  #--------------------------------------------------------------------------
  # * [Cancel]
  #--------------------------------------------------------------------------
  def on_cancel
    if @command_window.command_list == :subjects
      SceneManager.return
    elsif @command_window.command_list == :contents
      update_command_window
      update_header_window
    end
  end
  #--------------------------------------------------------------------------
  # * Set Subject
  #--------------------------------------------------------------------------
  def set_subject
    subject = @subject = @command_window.current_symbol
    @command_window.subject = subject
  end
  #--------------------------------------------------------------------------
  # * Set Content
  #--------------------------------------------------------------------------
  def set_content
    content = @content = @command_window.current_symbol
    @command_window.content = content
  end
  #--------------------------------------------------------------------------
  # * Set Max Page
  #--------------------------------------------------------------------------
  def set_max_page
    if Datalog::CONTENT[@subject][@content].instance_of?(Array)
      @pages.max_page = Datalog::CONTENT[@subject][@content].size
    else
      @pages.max_page = 1
    end
  end
  #--------------------------------------------------------------------------
  # * Update Command Window
  #--------------------------------------------------------------------------
  def update_command_window
    @command_window.deactivate.unselect
    if @command_window.command_list == :subjects
      @command_window.command_list = :contents
      @command_window.refresh
      @command_window.activate.select(0)
    elsif @command_window.command_list == :contents
      @command_window.command_list = :subjects
      @command_window.refresh
      @command_window.activate.select_symbol(@subject)
    end
  end
  #--------------------------------------------------------------------------
  # * Update Header Window
  #--------------------------------------------------------------------------
  def update_header_window
    if @command_window.command_list == :subjects
      @header_window.text = Datalog::DATALOG
    elsif @command_window.command_list == :contents
      @header_window.text = Datalog::SUBJECT[@subject][:string]
    end
    @header_window.refresh
  end
end

 

 

 

** screenshots are of v2.0

** script is broken into its individual elements within the demo (v2.0)

post-8551-0-50650100-1414021098_thumb.png

post-8551-0-12062600-1414021106_thumb.png

post-8551-0-31847500-1414021131_thumb.png

Edited by dbchest

Share this post


Link to post
Share on other sites

How are there no comments here yet? This is incredible! I've been trying to get a Journal script to do something like this, but it's annoying to try and get it to do stuff like this with it, because nothing is in sections, it's all a mess. So this will be very handy! Very handy indeed!

Edited by KevinFrost

Share this post


Link to post
Share on other sites

this is a VERY basic version of what it will become.

i plan to develop this into an extremely diverse datalog, complete with a bestiary built in...

Share this post


Link to post
Share on other sites

Wow,this compliments my evented enemy scan perfectly,thanks!

Share this post


Link to post
Share on other sites

While this is exactly what I need, though I am at a loss as to how to use it. There is no instructions on how to use this, no indication of any script calls or anything like that, and what's worse is that the mediafire link you provided is being flagged by my antivirus as a specific virus called 'Suspicious.Cloud.7.EP', which means I cannot look at the demo to determine how to use it. Can you please provide me with an explanation?

Share this post


Link to post
Share on other sites

Amazing script. However not sure if it's just me, but every time I save the game once I continue it everything disappears from the datalog. why is that?

Share this post


Link to post
Share on other sites

v2.0 is ready and available for download.

any and all feedback is greatly appreciated.

this script is going to be the benchmark datalog for my game, so all criticism is welcomed.

Edited by dbchest

Share this post


Link to post
Share on other sites

removing this scene from the main menu is a simple task. open the script in the script editor and scroll to the menu scene code. as you're browsing, you should see the place where all of the commands are manually added to the menu screen. just remove this scene from them.

 

I no longer support rmvxace, apologies; I've made a full transition to mv.

Share this post


Link to post
Share on other sites

Definitely a necropost, I'm aware, and I'm also aware that dbchest is no longer supporting rmvxace, but question to everyone who's used this...

 

I'm having an issue with music canceling when I enter the datalog through Yanfly's System Options, then never coming back on when the datalog is exited. 

Basically, I'm currently accessing the Datalog through that menu as an added command, rather than through the main pause menu itself. 

 

Most likely I won't be asking for help on how to FIX it, so much as I'm asking what's going on? What's the exact issue when these two scripts are combined in such a way?

Edited by DoctorArtist

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted