Seamsquall

dhbchest's Datalog script refreshing each time you restart the game.

3 posts in this topic

Hello. I have been using dbchest's datalog script and it has been working great. However, after making around 120 pages of datalog with it, I realised that upon restarting the game, it isn't saving the datalogs and sort of "resetting to default" forgetting all the datalogs unlocked during the game. 

I checked and this problem is in the script, it is not influenced by other scripts. 

 

Here is the 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

 

 

and here is the link to the original post of the script. http://www.rpgmakercentral.com/topic/18719-dbchests-datalog/

 

I know there are other scripts that have similar features, but this one by far is the one I prefer, and I have already used it a lot. 

 

I did a new post here since the scripter now only works on MV. 

Thanks in advance for your help! 

Edited by Seamsquall

Share this post


Link to post
Share on other sites

You should have put that script into a spoiler. Saves space when scrolling down.

 

I'm not a scripter or a master of ruby, but I try to help.

 

I downloaded the demo and tried it out. It also does not save information. The problem is that the script does not seem to be set to save information by default.

Without the script be rewritten (hopefully by the author) then don't put a lot of trust that someone will help with this (unless they have used it before).

 

I suspect that you will have to script a common event to check what the player has found (possibly by switches) and add the information into the datalog every time the player starts the game.

 

Good luck.

Share this post


Link to post
Share on other sites

Thank you for the advice. It is the first time I wrote a post so I didn't know. 

 

I don't think the fix is hard if you know how Ruby.  

 

The problem definitely comes from the script and not from interfering with other scripts indeed. I could indeed use switches however it would be very complicated since there is 120 pages of datalog already, and I plan to add another 100. I guess I will do that if no one finds out a way. 

 

Anyway, I might have found a lead. There was another script which had the same problem, DoctorTodd's  

http://rmrk.net/index.php?topic=46302.0

 

And someone just added this to the code to fix it : 

 

class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :todd_difficulty # save forbidden
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias todd_difficulty_gamesystem_init initialize
def initialize
@todd_difficulty = 0
todd_difficulty_gamesystem_init
end
end

 

 

I'm assuming the same code can be used and just change to the right class. I might be wrong though. 

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.