#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+# Diary Scene# Author: ForeverZer0# Version: 1.11# Date: 1.17.2014#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+## Introduction:## This is a basic script that will allow you to keep a "diary" or notepad in # your game. It is very simple to use, and uses a simple interface for # displaying the notes.## Features:## - Group your notes into "chapters". # - Automatically formats text to fit on each line in a legible format.# - Simple script call to add text.# - Option to define each note in the script editor, then simply use a script # call to add it.# - Option to use the map as the background.## Instructions:## - Place script above main, and below default scripts.# - Make configurations below.# - To call the scene, use this syntax: $scene = Scene_Diary.new# - To add an entry, use this syntax:## Diary.add_entry(CHAPTER, TEXT)# # CHAPTER: An arbitrary integer to define what group to add the note to.# TEXT: Either a string which will be the text added to the diary, or an# integer which will return the string defined in the configuration# below. The second method will make it easier to make long notes# without filling up the little script call box.## Author's Notes:## - Please be sure to report any bugs/issues with the script. Enjoy!##+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+

MAP_BACKGROUND = true # Set to true if you would like the map to show behind the window. RETURN_SCENE = Scene_Map # The scene that the game returns to when you exit the diary. SCENE_ARGUMENTS = [] # Define any arguments that may need called with scene if need be. Place them # in the array in the order in which they are normally called.

def self.chapter_name(chapter) # Define the names of the "chapters". # when CHAPTER then "CHAPTER_NAME" return case chapter when 1 then 'Millenium Fair' when 2 then 'What Happened to Marle?' end end

def self.entry(index) # Define the strings that correspond with each index. The index can be called # instead of actual text to add an entry. # when INDEX then "TEXT" return case index when 0 then 'I forgot today was the day of the big fair!I was supposed to go and see Lucca\'s new invention.' when 1 then 'I need to escort Marle around the fair, and maybe play a few games.' when 2 then 'Marle was sucked into the vortex. I think it had something to do with that pendant that she was wearing...' when 3 then 'This place is very strange, and everyone talks funny. It\'s all vaguely the same, yet different. Where am I?' when 4 then 'Here\'s how you can skip lines.\n\nThat made a line break. Now to seeyour value stored in variable 5: \v[5]' end end

#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::# END CONFIGURATION#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

def self.add_entry(chapter, text) # Add the chapter number if it does not exist. if $game_party.diary[chapter] == nil $game_party.diary[chapter] = [] end if text.is_a?(String) # Add the new entry to the end of the chapter. $game_party.diary[chapter].push(text) elsif text.is_a?(Integer) # Get the defined note if the text is a number. $game_party.diary[chapter].push(self.entry(text)) end endend

It what happens when the text being sent to draw is undefined. The text argument is nil. It has to be a string. You are likely attempting to add an entry that does not have a chapter name defined in the config.

i.e. Trying to read an entry in chapter 5, when chapter 5 does not have a title defined. It could be a bug, I honestly forgot to test it without any entries already present. I just used a script call to add entries, with a call at the end to call the scene when testing it. I'll check it out tonight and see if it needs fixed, or just a configuation error.

Logged

I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

I also tried to find out yesterday, and realized the problem. This error can occur not only when you put the wrong chapter and text, but if you don't put a script call of chapter before run the Journal script. I'm see something like that on the Quest Log of game_guy, and only then realized.

Is there anyway I can "update" the text of a chapter by script call without the script making it a new page?

Better explanation:

You add chapter 1 and for now it shows you need to go x place, once you reach the place something happens and you take note on the diary but if you script call to add the updated text it will assume it's a new page instead of having the text updated.

So is there anyway to have let's say chapter one showing piece per piece via script call or at the very least a command that deletes the entry from the diary so adding the updated version would take it's place?

Hey there, I'm pretty n00bish to RGSS and Ruby in general. But I'm trying to learn by reading and using different scripts in my game. I put this script into my game, and I love it! It is exactly what I needed. The only problem is, and its quite probably due to the fact that I'm very new to all this, is that when I have more than one chapter added I can't see any of the chapters except the first one. When I press up and down with the window open it makes the sound but doesn't display any of the other pages. If you could let me in on why this might happen that'd be awesome!

For some reason when I make a the script call for a new chapter it won't happen. It stays at the lowest chapter I created. Is it meant to count down?

To describe my problem: When I make a script call for chapter 1 it works fine. Then when I make a script call for starting chapter 2 it won't happen and starts at chapter 1. However, If I start by using chapter 2 and then make a script call for going to chapter 1, it works