Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: ForeverZer0 on July 06, 2010, 09:26:47 pm

Title: [XP] Journal
Post by: ForeverZer0 on July 06, 2010, 09:26:47 pm
Journal
Authors: ForeverZer0
Version: 2.4
Type: Misc. Add-On
Key Term: Misc Add-on



Introduction

I wrote this script after seeing a request here on CP for something similar.
It basically just allows the player to view a Journal that show the player
information about people they have encountered and places they have visited.
Can also log weapons, armors, and items.


Features




Screenshots

Spoiler: ShowHide
(http://dl.dropbox.com/u/20787370/Scripts/Journal%202.3/Journal1.png)



Demo

None.


Script

Here.
Spoiler: ShowHide

#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# Journal
# Author: ForeverZer0
# Version: 2.4
# Data: 12.30.2010
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
# Introduction:
#   I wrote this script after seeing a request here on CP for something similar.
#   It basically just allows the player to view a Journal that show the player
#   information about people they have encountered and places they have visited.
#   Can also log weapons, armors, and items.
#  
# Features:
#   - Easy to use/configure
#   - Nice simple interface
#   - Will log people, places, weapons, armors, and items seperately
#   - Configurable what type of entries you would like to log.
#   - Configurable layout
#   - Option to use pictures
#   - Fully compatible "stats" you want the system to display.
#
# Instructions:
#   - Place script in the usual place.
#   - All configuration is below, and explained in each section.
#   - All pictures must be in folder labeled "Journal" within your game's
#     Picture folder.
#   - All you have to do is assign arbitrary "ids" to each person and location
#     respectively. After you have completed configuration, when you want the
#     person/place to be added to the Journal, use these script calls:
#
#       Journal.add_character(ID)
#       Journal.add_location(ID)
#       Journal.add_weapon(ID)
#       Journal.add_armor(ID)
#       Journal.add_item(ID)
#
#       You can also delete entries in the same way:
#
#       Journal.delete_character(id)
#       Journal.delete_location(id)
#       Journal.delete_weapon(id)
#       Journal.delete_armor(id)
#       Journal.delete_item(id)
#
#     Where the "ID" is the number you assigned to each.
#   - To call the scene, use this script call:
#
#       $scene = Scene_Journal.new
#
#   - The script comes with a fix for those who like to use smaller text sizes
#     (like myself), which will allow for more information to be displayed on
#     the screen at once.
#   - If you would like to change the look up a little bit, just change around
#     the X and Y values in Window_Journal.
#
# Credits/Thanks:
#   - ForeverZer0, for the script.
#
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
#                           BEGIN CONFIGURATION
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

module Journal
 
 # If true, a line height of 20 pixels will be used, which looks better with
 # smaller font sizes.
 SMALL_TEXT = true
 # The width of the entry list used for Scene_Journal. The other windows will
 # automatically adjust to this width.
 LIST_WIDTH = 192
 
 # Define what aspects of the journal you would like to use. Choose from the
 # values listed below and add them to the array. DO NOT change the values.
 # Omit values for types you do not want to use.
 #        'People' - 'Places' - 'Weapons' - 'Armors' - 'Items'
 LIST_ORDER = ['People', 'Places', 'Weapons', 'Armors', 'Items']
 
 # Configure if you would like for items, weapons, and armors to be unlocked
 # automatically when they are first aquired by the player. If using this
 # options, IDs MUST match the IDs used in the Database. You will also need to
 # manually add anything the player begins with at game start.
 AUTO_WEAPONS = true
 AUTO_ARMORS = true
 AUTO_ITEMS = true
 
#-------------------------------------------------------------------------------
 CHARACTER_STATS = ['Name:', 'Race:', 'Age:', 'Height:', 'Weight:']
 
 # Configure the values used for the above array for each character. Just make
 # sure the value that corresponds to each stat is at the same index in the [].
 # Just make sure that the first stat is the name, it will be used on the menu
 # to select which character/location will be viewed.
 def self.character_info(id)
   info = case id
   when 1 then ['Aluxes', 'Human', '19', '5\'10"', '165 lbs.']
   when 2 then ['Hilda', 'Human', '20', '5\'5"', '113']
   when 3 then ['Basil', 'Human', '24', '6\'0"', '187 lbs.']
   end
   return info != nil ? info : []
 end
 
 # Short paragraph/description of character. Uses Blizzard's slice_text method
 # to automatically break to next line when needed, so do not concern yourself
 # with that.
 def self.character_bio(id)
   text = case id
   when 1
     'Our everyday hero, that seems to make an appearance in every demo.'
   when 2
     'Random witch girl.'
   when 3
     'Another RPGXP character.'
   end
   return text != nil ? text : ''
 end
#-------------------------------------------------------------------------------
 LOCATION_STATS = ['Name:', 'Country:']
 
 # Configure the values used for the above array for each location. Just make
 # sure the value that corresponds to each stat is at the same index in the [].
 # Just make sure that the first stat is the name, it will be used on the menu
 # to select which character/location will be viewed.
 def self.location_info(id)
   info = case id
   when 1 then ['New York', 'USA']
   when 2 then ['Ohio', 'USA']
   when 3 then ['Iowa', 'Who cares...']
   end
   return info != nil ? info : []
 end
 
 # Short paragraph/description of location. Uses Blizzard's slice_text method
 # to automatically break to next line when needed, so do not concern yourself
 # with that.
 def self.location_bio(id)
   return case id
   when 1
     'The state north of Pennsylvania.'
   when 2
     'The state west of Pennsylvania.'
   when 3
     'A boring state.'
   else
     ''
   end
 end
#-------------------------------------------------------------------------------
 WEAPON_STATS = ['Name:', 'Origin:']
   
 def self.weapon_info(id)
   text = case id
   when 1 then ['Bronze Sword', 'Everywhere.']
   when 2 then ['Iron Sword', 'Right here.']
   when 3 then ['Mythril Sword', 'Blah blah.']
   end
 end
 
 def self.weapon_bio(id)
   return case id
   when 1
     'Simple sword. Seems to be the standard that all RPG games have the hero start with.'
   when 2
     'Slighly better than the Bronze sword.'
   when 3
     'Yet another sword that is in almost every RPG.'
   else
     ''
   end
 end
#-------------------------------------------------------------------------------
 ARMOR_STATS = ['Name:', 'Origin:']
   
 def self.armor_info(id)
   text = case id
   when 1 then ['', '']
   when 2 then ['', '']
   when 3 then ['', '']
   end
 end
 
 def self.armor_bio(id)
   return case id
   when 1
     ''
   when 2
     ''
   when 3
     ''
   else
     ''
   end
 end
#-------------------------------------------------------------------------------
 ITEM_STATS = ['Name:', 'Origin:']
 
 def self.item_info(id)
   text = case id
   when 1 then ['', '']
   when 2 then ['', '']
   when 3 then ['', '']
   end
 end
 
 def self.item_bio(id)
   return case id
   when 1
     ''
   when 2
     ''
   when 3
     ''
   else
     ''
   end
 end
#-------------------------------------------------------------------------------

 # Set the following to true if you would loke pictures to be displayed for
 # the respective type of Journal entries. They will be defined below.
 CHARACTER_PIC = true
 LOCATION_PIC = true
 WEAPON_PIC = true
 ARMOR_PIC = true
 ITEM_PIC = true
 
 # Filenames of character pictures.
 def self.character_pic(id)
   file = case id
   when 1 then 'Aluxes'
   when 2 then 'Hilda'
   when 3 then 'Basil'
   end
   return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
 end
 
 # Filenames of location pictures.
 def self.location_pic(id)
   file = case id
   when 1 then ''
   when 2 then ''
   when 3 then ''
   end
   return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
 end  
 
 # Filename of weapon pictures.
 def self.weapon_pic(id)
   file = case id
   when 1 then ''
   when 2 then ''
   when 3 then ''
   end
   return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
 end
 
 # Filename of weapon pictures.
 def self.armor_pic(id)
   file = case id
   when 1 then ''
   when 2 then ''
   when 3 then ''
   end
   return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
 end

 # Filenames of item pictures.
 def self.item_pic(id)
   file = case id
   when 1 then ''
   when 2 then ''
   when 3 then ''
   end
   return file != nil ? RPG::Cache.picture("Journal/#{file}") : Bitmap.new(1,1)
 end

#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
#                           END CONFIGURATION
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

 def self.add_character(id)
   unless $game_system.journal['People'].include?(id)
     $game_system.journal['People'].push(id)
     $game_system.journal['People'].sort!
   end
 end
 
 def self.add_location(id)
   unless $game_system.journal['Places'].include?(id)
     $game_system.journal['Places'].push(id)
     $game_system.journal['Places'].sort!
   end
 end
 
 def self.add_weapon(id)
   unless $game_system.journal['Weapons'].include?(id)
     $game_system.journal['Weapons'].push(id)
     $game_system.journal['Weapons'].sort!
   end
 end
 
 def self.add_armor(id)
   unless $game_system.journal['Armors'].include?(id)
     $game_system.journal['Armors'].push(id)
     $game_system.journal['Armors'].sort!
   end
 end
 
 def self.add_item(id)
   unless $game_system.journal['Items'].include?(id)
     $game_system.journal['Items'].push(id)
     $game_system.journal['Items'].sort!
   end
 end

 def self.delete_character(id)
   $game_system.journal['People'].delete(id)
   $game_system.journal['People'].sort!
 end
 
 def self.delete_location(id)
   $game_system.journal['Places'].delete(id)
   $game_system.journal['Places'].sort!
 end
 
 def self.delete_weapon(id)
   $game_system.journal['Weapons'].delete(id)
   $game_system.journal['Weapons'].sort!
 end
 
 def self.delete_armor(id)
   $game_system.journal['Armors'].delete(id)
   $game_system.journal['Armors'].sort!
 end
 
 def self.delete_item(id)
   $game_system.journal['Items'].delete(id)
   $game_system.journal['Items'].sort!
 end
end

#===============================================================================
# ** Game_System
#===============================================================================

class Game_System
 
 attr_accessor :journal
 
 alias zer0_journal_init initialize
 def initialize
   zer0_journal_init
   @journal = {}
   Journal::LIST_ORDER.each {|key| @journal[key] = [] }
 end
 
 def journal_entries(type)
   entries = []
   case type
   when 'People'
     @journal[type].each {|id| entries.push(Journal.character_info(id)[0]) }
   when 'Places'
     @journal[type].each {|id| entries.push(Journal.location_info(id)[0]) }
   when 'Weapons'
     @journal[type].each {|id| entries.push(Journal.weapon_info(id)[0]) }
   when 'Armors'
     @journal[type].each {|id| entries.push(Journal.armor_info(id)[0]) }
   when 'Items'
     @journal[type].each {|id| entries.push(Journal.item_info(id)[0]) }
   end
   return entries.empty? ? ['None'] : entries
 end
end

#===============================================================================
# ** Game_Party
#===============================================================================

class Game_Party
 
 alias zer0_auto_add_weapon gain_weapon
 def gain_weapon(weapon_id, n)
   # Unlock weapon ID if recieved.
   if Journal::AUTO_WEAPONS& ![nil, 0].include?(weapon_id)
     Journal.add_weapon(weapon_id)
   end
   zer0_auto_add_weapon(weapon_id, n)
 end

 alias zer0_auto_add_armor gain_armor
 def gain_armor(armor_id, n)
   # Unlock armor ID if recieved.
   if Journal::AUTO_ARMORS && ![nil, 0].include?(armor_id)
     Journal.add_armor(armor_id)
   end
   zer0_auto_add_armor(armor_id, n)
 end
 
 alias zer0_auto_add_item gain_item
 def gain_item(item_id, n)
   # Unlock item ID if recieved.
    if Journal::AUTO_ITEMS && ![nil, 0].include?(item_id)
     Journal.add_item(item_id)
   end
   zer0_auto_add_item(item_id, n)
 end
end

#===============================================================================
# ** Bitmap (slice_text method by Blizzard)
#===============================================================================

class Bitmap
 
 def slice_text(text, width)
   words = text.split(' ')
   return words if words.size == 1
   result, current_text = [], words.shift
   words.each_index {|i|
   if self.text_size("#{current_text} #{words[i]}").width > width
     result.push(current_text)
     current_text = words[i]
   else
     current_text = "#{current_text} #{words[i]}"
   end
   result.push(current_text) if i >= words.size - 1}
   return result
 end
end

#===============================================================================
# ** Window_Journal
#===============================================================================

class Window_Journal < Window_Base
 
 attr_accessor :type
 
 def initialize
   super(Journal::LIST_WIDTH, 0, 640 - Journal::LIST_WIDTH, 480)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.visible = false
   @type = ''
 end
 
 def id=(id)
   @id = id
   refresh
 end
 
 def refresh
   self.contents.clear
   return if @id == nil
   # Set local variables, branching by what type is being viewed.
   case @type
   when 'People'
     stats = Journal::CHARACTER_STATS
     info = Journal.character_info(@id)
     bio = Journal.character_bio(@id)
     pic = Journal::CHARACTER_PIC ? Journal.character_pic(@id) : nil
   when 'Places'
     stats = Journal::LOCATION_STATS
     info = Journal.location_info(@id)
     bio = Journal.location_bio(@id)
     pic = Journal::LOCATION_PIC ? Journal.location_pic(@id) : nil
   when 'Weapons'
     stats = Journal::WEAPON_STATS
     info = Journal.weapon_info(@id)
     bio = Journal.weapon_bio(@id)
     pic = Journal::WEAPON_PIC ? Journal.weapon_pic(@id) : nil
   when 'Armors'
     stats = Journal::ARMOR_STATS
     info = Journal.armor_info(@id)
     bio = Journal.armor_bio(@id)
     pic = Journal::ARMOR_PIC ? Journal.armor_pic(@id) : nil
   when 'Items'
     stats = Journal::ITEM_STATS
     info = Journal.item_info(@id)
     bio = Journal.item_bio(@id)
     pic = Journal::ITEM_PIC ? Journal.item_pic(@id) : nil
   end
   width = 640 - Journal::LIST_WIDTH - 40
   bio = self.contents.slice_text(bio, width)
   if pic != nil
     rect = Rect.new(0, 0, pic.width, pic.height)
     self.contents.blt(self.width-pic.width-64, 32, pic, rect)
   end
   # Draw the values on the window's bitmap.
   self.contents.font.color = system_color
   y = Journal::SMALL_TEXT ? 20 : 32
   stats.each_index {|i| self.contents.draw_text(0, i*(y*2), 128, y, stats[i])}
   self.contents.draw_text(0, 320, 128, y, 'Description:')
   self.contents.font.color = normal_color
   info.each_index {|i| self.contents.draw_text(8, y+i*(y*2), 128, y, info[i])}
   bio.each_index {|i| self.contents.draw_text(8, (320+y)+i*y, width, y, bio[i])}  
 end
end

#===============================================================================
# ** Scene_Journal
#===============================================================================

class Scene_Journal
#-------------------------------------------------------------------------------
 def main
   # Create lists of the entries for each Journal content type.
   @entry_lists, @index = [], 0
   # Create list of entry titles.
   Journal::LIST_ORDER.each {|key|
     next unless $game_system.journal.has_key?(key)
     window = Window_Command.new(Journal::LIST_WIDTH, $game_system.journal_entries(key))
     window.visible = window.active = false
     window.height = 480
     @entry_lists.push(window)
   }
   # Create main command window.
   @command_window = Window_Command.new(Journal::LIST_WIDTH, Journal::LIST_ORDER)
   @command_window.height = 480
   # Create main window for viewing information and dummy window.
   @dummy_window = Window_Base.new(Journal::LIST_WIDTH, 0, 640 - Journal::LIST_WIDTH, 480)
   @journal_window = Window_Journal.new
   @windows = @entry_lists + [@journal_window, @command_window, @dummy_window]
   # Transition and start main loop for the scene.
   Graphics.transition
   loop {Graphics.update; Input.update; update; break if $scene != self}
   # Dispose all windows and prepare for transition.
   Graphics.freeze
   @windows.each {|window| window.dispose}
 end
#-------------------------------------------------------------------------------
 def update
   # Update all the windows.
   @windows.each {|window| window.update }
   # Branch update method depending on what window is active.
   @command_window.active ? update_command : update_entry_selection
 end
#-------------------------------------------------------------------------------
 def update_command
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Map.new
   elsif Input.trigger?(Input::C)
     # Deactivate command window and make selected entry list active.
     @index = @command_window.index
     @command_window.active = @command_window.visible = false
     @entry_lists[@index].active = @entry_lists[@index].visible = true
   end
 end
#-------------------------------------------------------------------------------
 def update_entry_selection
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     # Deactivate entry list and make command window active.
     @command_window.active = @command_window.visible = true
     @entry_lists[@index].active = @entry_lists[@index].visible = false
     @journal_window.visible = false
   elsif Input.trigger?(Input::C)
     @journal_window.visible = true
     $game_system.se_play($data_system.decision_se)
     type = Journal::LIST_ORDER[@index]
     # Set the type and id variables for the journal window and refresh.
     @journal_window.type = type
     @journal_window.id = $game_system.journal[type][@entry_lists[@index].index]
   end
 end
end



Instructions

See script.


Compatibility

No known issues.


Credits and Thanks




Author's Notes

Enjoy!
Title: Re: [XP] Journal
Post by: Nadim13 on July 09, 2010, 04:50:05 am
It seems cool! I'll try it later! Good work! (lv.++)
Title: Re: [XP] Journal
Post by: Shining Riku on July 09, 2010, 12:30:56 pm
This script is great, it's exactly what I needed for one of my games!
Excellent work on the script! ^_^
Title: Re: [XP] Journal
Post by: SquareMan on July 17, 2010, 11:32:11 pm
This is awesome! Lvl up. :-*
Edit: Is it possible to modify some values to make it to where you can have two journals? Since I have basic RGSS know how i attempted it my self,...., but failed and ended up with this error when i tryed to start my game.
something like this.
QuoteError on line 175 in script "Scene_Journal" (thats what i named it in the editor) Stack level too deep.

what i did was dupe the script rename it to Scene_Journal2 in the page list. then I changed those things that add info right after the config ends by adding a 2 to the end of the thingys. then i scrolled down to where it said class Scene_Journal and changed it to this Scene_Journal2 any help?
It all worked fine before i duped the script. when i deleted the dupe, it was all fine.
Title: Re: [XP] Journal
Post by: ForeverZer0 on July 18, 2010, 05:53:35 pm
Quote from: SquareMan on July 17, 2010, 11:32:11 pm
This is awesome! Lvl up. :-*
Edit: Is it possible to modify some values to make it to where you can have two journals? Since I have basic RGSS know how i attempted it my self,...., but failed and ended up with this error when i tryed to start my game.
something like this.
QuoteError on line 175 in script "Scene_Journal" (thats what i named it in the editor) Stack level too deep.

what i did was dupe the script rename it to Scene_Journal2 in the page list. then I changed those things that add info right after the config ends by adding a 2 to the end of the thingys. then i scrolled down to where it said class Scene_Journal and changed it to this Scene_Journal2 any help?
It all worked fine before i duped the script. when i deleted the dupe, it was all fine.


Copying the script wont do you much good. I'm not positive exactly what your trying to do, but try just renaming the scripts and config differently and calling them as such. For example instead of the Journal module, have a Journal_1 and Journal_2 module, and the same with the scenes. Just make sure that each scene calls from the appropriate Journal, etc, etc. You may also need to make some edits to have different variables that keep track of what is unlocked for each Journal. Hope that was helpful!
Title: Re: [XP] Journal
Post by: SquareMan on July 18, 2010, 09:24:45 pm
ok i might try it again when i learn more of rgss and not just basics.
Title: Re: [XP] Journal
Post by: XaineC on August 21, 2010, 05:02:08 am
Is there any way to make it so that the journal shows the actors names as dictated by the database? I ask this because I make it so the player can name the main character what they want and I want the journal to change accordingly.
Title: Re: [XP] Journal
Post by: ForeverZer0 on August 23, 2010, 12:26:54 pm
Quote from: XaineC on August 21, 2010, 05:02:08 am
Is there any way to make it so that the journal shows the actors names as dictated by the database? I ask this because I make it so the player can name the main character what they want and I want the journal to change accordingly.


Don't got my game in front of me right now, but I think if you use...
$data_actors[ACTOR_ID].name

...it will show the name of the actor with that ID.
Title: Re: [XP] Journal
Post by: XaineC on August 24, 2010, 06:15:11 pm
Thanks, that worked. One more question. What if I want to change the picture I use for a certain actor during the game. Is there any way to do that???
Title: Re: [XP] Journal
Post by: ForeverZer0 on August 25, 2010, 12:09:13 pm
Quote from: XaineC on August 24, 2010, 06:15:11 pm
Thanks, that worked. One more question. What if I want to change the picture I use for a certain actor during the game. Is there any way to do that???


Simplest way I can think of off-hand without changing the method would be to set a switch to it.
Here's an example, using Switch #10. In the part where you configure the bitmap of char with ID...
when 1 then $game_switches[10] ? 'BITMAP SWITCH ON' : 'BITMAP SWITCH OFF'


Try that. Let me know if it works.
Title: Re: [XP] Journal
Post by: XaineC on August 25, 2010, 10:52:36 pm
Thanks Zero. It worked great. Epic you are.
Title: Re: [XP] Journal
Post by: Acolyte on September 05, 2010, 01:27:10 am
Would it be possible to put in an option for items? Not like an inventory list, just important artifacts.
Title: Re: [XP] Journal
Post by: ForeverZer0 on September 07, 2010, 12:08:19 pm
Yeah that wouldn't be hard. I'll make you a mod sometime here when I get a chance. If I forget, just PM me or bump for update.
Title: Re: [XP] Journal
Post by: Acolyte on September 22, 2010, 10:08:28 pm
Just checking to see if you're still working on it.
Title: Re: [XP] Journal
Post by: Calintz on September 22, 2010, 10:34:30 pm
Always a great addition to any game when used right.
Title: Re: [XP] Journal
Post by: ForeverZer0 on September 30, 2010, 12:16:54 pm
* UPDATES *

Version is now 2.0
- Totally overworked code for better performance and overview
- Added options to log weapons, armors, and items
- Add ability to choose what options (ie. Places, People, Items, etc.) to use in your journal
- Basic configurables for the window look/layout.
- Feature to Auto-Unlock weapons, armors, and items as the player aquires them if desired.
- Names will be defined by the database now in a list.

Thank you everyone for the suggestions. I think I added them all... :P
Title: Re: [XP] Journal
Post by: Acolyte on October 04, 2010, 09:15:36 pm
Awesome job. Thanks a lot. :D
Title: Re: [XP] Journal
Post by: Lauros on December 16, 2010, 09:05:44 pm
I wonder if you can added to the script a section for write what is hapenning in the game
Ex: after an encounter with a strange man, this appears in the section.                             
                                                 
                                                 (Title) "The strange Man"
(What happened)"We found a strange man who told us we were at the castle, I wonder who will be
                                                but we dont have time to follow and ask"

Then after a while it reappears the same strange man, after talking with him, and at the same section title("The strange Man") appears:

                                                 (Title) "The strange Man",
(What happened)"We found a strange man who told us we were at the castle, I wonder who will be
                                                but we dont have time to follow and ask.
                         The same strange man came back to help us, I dont understand, ┬┐why he help us?"

Something like that, and space for many titles
Title: Re: [XP] Journal
Post by: ForeverZer0 on December 17, 2010, 12:14:58 pm
That would not be a very hard script to write, but it would probably be easier to adapt this (http://forum.chaos-project.com/index.php?topic=7404.0).
Title: Re: [XP] Journal
Post by: Lauros on December 17, 2010, 01:20:27 pm
I have that script, if you can adapted to any of the two scripts would works for me,  :up:
Title: Re: [XP] Journal
Post by: Cates on December 30, 2010, 01:14:26 am
Hi ForeverZer0.

This is a great script! Exactly what I've been looking for. Easy to configure and looks great!

However, something odd is happening . . . when a weapon, armor, shield, etc. is unequipped, it vanishes, and nothing else shows up that is available for the player to equip--even the sword/shield/etc. you just unequipped.

For instance, I started a new game just by copying and pasting the journal script into the editor. No other scripts involved in this test. I started the game, unequipped Aluxes's bronze sword and it vanished. It can no longer be seen on the equip screen. You can't see it even on the "item" menu.

I'm a novice, and managed to find a way to add a your journal to the default menu before I realized what was happening. That's when I tested it on a generic game start and still saw the same "vanishing de-equipped item" effect.

Am I doing something wrong?
Title: Re: [XP] Journal
Post by: ForeverZer0 on December 30, 2010, 07:43:53 pm
I'm looking into right now. I just tested it real quick and had the same problem.  :shy:

EDIT:

* Updates to 2.1 *
Fixed the bug, I used the wrong method name when aliasing "gain_weapon" in Game_Party.
That was the only change made, so if you don't feel like repasting the script, you can easily just make the edit yourself. You simply need to change one word. Find the "Game_Party" section in the script and look at the first method, which looks like this:

  alias zer0_auto_add_weapon gain_item
  def gain_weapon(weapon_id, n)
    # Unlock weapon ID if recieved.
    Journal.add_weapon(weapon_id) if Journal::AUTO_WEAPONS
    zer0_auto_add_weapon(weapon_id, n)
  end


You simply need to change the "gain_item" in the first line to "gain_weapon".
alias zer0_auto_add_weapon gain_weapon


That should do it.  ;)
Title: Re: [XP] Journal
Post by: Cates on December 31, 2010, 12:04:42 am
Thanks for the fix - that did it for the weapons, but not for the other equipment slots. Sorry to be a pain!
Title: Re: [XP] Journal
Post by: ForeverZer0 on December 31, 2010, 01:09:07 am
* Updates to 2.2 *

Your not being a pain.  I appreciate you letting me know.
I'm the idiot who didn't look a few lines below the last bug.
The script is updated, but once again, if you want to change it yourself, do this.

Find the Game_Party class within the script, and find the aliased method "gain_armor" within it.
Change the line that reads:
zer0_auto_add_weapon(weapon_id, n)

and change it to...
zer0_auto_add_armor(weapon_id, n)


Sorry for all the little bugs.

@cates:
Thanks a bunch for pointing it out!  ;)

Title: Re: [XP] Journal
Post by: Cates on December 31, 2010, 02:16:14 am
OK! That error seems to be fixed.

Here's another issue, when I have the auto updates set to "true" in the config of the script, I'm getting a method error on the line that relates to whatever equipment I'm trying to change. (such as 332 for weapons).

This was happening with the default items equipped on Aluxes and the gang, so I thought maybe that's because I hadn't defined anything in the lower journal entries.  So, I deleted everyone but aluxes and gave him only a single sword. I had an event call that journal addition and it was so far, so good. Then I added another event to give him a second sword to test the auto-update, the method error came up again.

When I set the auto updates to false, and called the scripts for each of those two individual swords, everything worked smoothly. Let me know if you'd like me to upload my little testing demo for you to check out.

Thanks for your quick responses! This is such a useful and versatile script!
Title: Re: [XP] Journal
Post by: ForeverZer0 on December 31, 2010, 02:35:22 am
I found the problem. It occurs when an ID of 0 gets passed as the weapon ID. I'm fixing it now.

EDIT::

* update to 2.3 *

...and yet another bug fixed. I didn't think that if the player unequips a weapon, it passes an ID of 0 to the array, which throws an error when the game attempts to see what weapon/armor that is. I couldn't get the error to repeat at first because I kept switching back and forth between two weapons, and not just straight unequipping to nothing.

Either way, another big thanks and a level up to Cates for pointing it out.  :D
Title: Re: [XP] Journal
Post by: Cates on January 01, 2011, 02:46:53 am
Awesome, man. It now works perfectly. Thanks!
Title: Re: [XP] Journal
Post by: elmangakac on March 01, 2011, 08:24:38 pm
GIves me an error:

????????? "Journal" 396???? No Method Error????

private method "split" called for Nil:Class


:'(
Title: Re: [XP] Journal
Post by: ForeverZer0 on March 01, 2011, 08:48:37 pm
You're not configuring it properly. From the sounds of it, something in one of the ?????_bio(id) methods is not set up right. Basically this method needs a string passed to it, which is not being done if you're getting that error. Since the string is retrieved from the config, this is your likely problem.
Title: Re: [XP] Journal
Post by: elmangakac on March 01, 2011, 09:02:20 pm
I understand it!!! That is because i change the words... (My game its spanish) and i change the word "People" by "Gente" and also the others... I delete my script with spanish words and i put the original and works good....

Thank you very much...
Title: Re: [XP] Journal
Post by: elmangakac on March 18, 2011, 12:18:02 am
Exist a limit of elements in the list? Or can shows all the items... Because just shows some items and not all that i get.... O_O ?
Title: Re: [XP] Journaler
Post by: OracleGames on March 24, 2011, 07:17:10 pm
Hey Foreverzer0, it would be really nice to add this to the game menu, is it even possible?
Title: Re: [XP] Journal
Post by: ForeverZer0 on March 24, 2011, 07:53:21 pm
Yes, you can link it to a menu option the same as any any other scene. The only edit that will need to be made is it to change the scene it returns to after exit. At the bottom of the script find the line that reads:
$scene = Scene_Map.new

and change the scene to Scene_Map or whatever scene you would like for it to go to after it ends.
Title: Re: [XP] Journal
Post by: TJ01 on April 07, 2011, 11:39:13 am
I`ve got a question, can it be done, that you can remove an entry?
Title: Re: [XP] Journal
Post by: ForeverZer0 on April 07, 2011, 07:16:09 pm
You can, though there is no method to do it easily by default. I wrote this code real quick, its untested, but should do the job. Just add it to your scripts any old where.

Spoiler: ShowHide

module Journal
 
 def self.delete_character(id)
   $game_system.journal['People'].delete(id)
   $game_system.journal['People'].sort!
 end
 
 def self.delete_location(id)
   $game_system.journal['Places'].delete(id)
   $game_system.journal['Places'].sort!
 end
 
 def self.delete_weapon(id)
   $game_system.journal['Weapons'].delete(id)
   $game_system.journal['Weapons'].sort!
 end
 
 def self.delete_armor(id)
   $game_system.journal['Armors'].delete(id)
   $game_system.journal['Armors'].sort!
 end
 
 def self.delete_item(id)
   $game_system.journal['Items'].delete(id)
   $game_system.journal['Items'].sort!
 end
end


Use the methods the same as you would with Journal.add_PARAMETER(id), except use the word "delete", like this:

Journal.delete_weapon(ID)


Let me know how that works out for you.  ;)

I made add it to the script when I'm not feeling so lazy.
Title: Re: [XP] Journal
Post by: nathmatt on April 07, 2011, 07:19:18 pm
Quote from: ForeverZer0 on April 07, 2011, 07:16:09 pm
Spoiler: ShowHide

 def self.delete_character(id)
   $game_system.journal['People'].delete(id)
   $game_system.journal['People'].push(id)
 end



use this lol just fixed that

Spoiler: ShowHide
module Journal
 
 def self.delete_character(id)
   $game_system.journal['People'].delete(id)
   $game_system.journal['People'].sort!
 end
 
 def self.delete_location(id)
   $game_system.journal['Places'].delete(id)
   $game_system.journal['Places'].sort!
 end
 
 def self.delete_weapon(id)
   $game_system.journal['Weapons'].delete(id)
   $game_system.journal['Weapons'].sort!
 end
 
 def self.delete_armor(id)
   $game_system.journal['Armors'].delete(id)
   $game_system.journal['Armors'].sort!
 end
 
 def self.delete_item(id)
   $game_system.journal['Items'].delete(id)
   $game_system.journal['Items'].sort!
 end
end
Title: Re: [XP] Journal
Post by: ForeverZer0 on April 07, 2011, 07:21:44 pm
 :P
Thanks, nathmatt.

I just edited the "add" methods real fast, apparently I did that one wrong. Fixed now.
Title: Re: [XP] Journal
Post by: TJ01 on April 08, 2011, 10:18:18 am
Jeah, it works, thank you!
But if I call the Journey, there comes a warning message, like them from windows:
Spoiler: ShowHide
(http://s1.directupload.net/images/110408/temp/gxym3a55.png) (http://s1.directupload.net/file/d/2488/gxym3a55_png.htm)

Before, there is an other just with armors.
Title: Re: [XP] Journal
Post by: elmangakac on April 10, 2011, 05:46:07 pm
I have the same "window" problem O:O
Title: Re: [XP] Journal
Post by: ForeverZer0 on April 10, 2011, 06:16:53 pm
Okay, I fixed that.
I had accidentally left a few lines in it that were there for debugging it.
Title: Re: [XP] Journal
Post by: TJ01 on April 12, 2011, 10:54:51 am
Now the game crashes, when I call "$scene = Scene_Journal.new"
(http://s7.directupload.net/images/110412/temp/sy5c6rwu.png) (http://s7.directupload.net/file/d/2492/sy5c6rwu_png.htm)
Title: Re: [XP] Journal
Post by: ForeverZer0 on April 12, 2011, 05:50:55 pm
That probably means something is not being configured correctly, but I will look into it. The lines I removed captured an exception if there was an error referencing the configuration. They would prevent a crash and print the ID that was passed.
Title: Re: [XP] Journal
Post by: elmangakac on April 12, 2011, 09:30:22 pm
i have the same mistake.... and the only thing that i change was the info of the items.....maybe its the script.... O_o
Title: Re: [XP] Journal
Post by: Heart of Onyx on July 07, 2011, 12:27:02 pm
Having a problem.

My game has quite a few actors in it. (12 to be exact.) And, I keep getting syntax error when I playtest the game. The problem is with the following line:

    when 9 then ['Name', 'Race', 'Age', 'Height', 'Weight']  


It's bizarre. If I delete this line, it works. I can't wrap my head around what the problem is.

EDIT: Turns out It was caused by another script. No worries, I fixed it.
Title: Re: [XP] Journal
Post by: Cates on July 25, 2011, 11:15:46 pm
I have a suggestion for an addition: have the journal recognize an actor's name after it has been changed by the player.

For instance, let's say actor 1 is named Serge, and I set up a journal entry for Serge when the game begins. Now, however, if I give the player the option to change Serge's name, and they rename him Bubba, the journal (of course) still says "Serge."

Don't know how possible it is, but It would be really cool if there was a way within the journal to recognize a name input change and change the journal entry.
Title: Re: [XP] Journal
Post by: ForeverZer0 on July 25, 2011, 11:49:21 pm
In the config, set the value for the actor's name to:

$game_actors[DATABASE_ID].name


This will display the name dynamically in the scene to what it is currently.
Title: Re: [XP] Journal
Post by: Cates on July 26, 2011, 12:48:44 am
Great! Thanks.
Title: Re: [XP] Journal
Post by: geebrit on August 09, 2011, 10:31:06 pm
Thank you so much for the wonderful script! It's just what I needed.

I have some questions, if it's alright?

1) How can I delete entries in the journal?
2) How can I replace the default main menu with this journal?
Title: Re: [XP] Journal
Post by: ForeverZer0 on August 09, 2011, 10:57:38 pm
* Updates script to 2.4 *

I added script calls for deleting entries.
Basically just added the little scriptlet from this (http://forum.chaos-project.com/index.php/topic,6783.msg140938.html#msg140938) post to the main script.

@geebrit:
I hope the update answers your first question.
As for the second question...

Spoiler: ShowHide
class Scene_Menu
 
  def call_menu
    $game_temp.menu_calling = false
    if $game_temp.menu_beep
      $game_system.se_play($data_system.decision_se)
      $game_temp.menu_beep = false
    end
    $game_player.straighten
    $scene = Scene_Journal.new
  end
end


Just paste that below the default scripts.
Title: Re: [XP] Journal
Post by: geebrit on August 10, 2011, 12:42:27 am
Quote from: ForeverZer0 on August 09, 2011, 10:57:38 pm
* Updates script to 2.4 *

I added script calls for deleting entries.
Basically just added the little scriptlet from this (http://forum.chaos-project.com/index.php/topic,6783.msg140938.html#msg140938) post to the main script.

@geebrit:
I hope the update answers your first question.
As for the second question...

Spoiler: ShowHide
class Scene_Menu
 
  def call_menu
    $game_temp.menu_calling = false
    if $game_temp.menu_beep
      $game_system.se_play($data_system.decision_se)
      $game_temp.menu_beep = false
    end
    $game_player.straighten
    $scene = Scene_Journal.new
  end
end


Just paste that below the default scripts.


Works like a charm!

At first the menu replacement didn't work, but I realized you probably meant "Scene_Map" and not "Scene_Menu." It's looking great now. Thanks for all of the help!  :haha:
Title: Re: [XP] Journal
Post by: ForeverZer0 on August 10, 2011, 08:00:48 am
Ooops, yeah, that should be Scene_Map. :P
Title: Re: [XP] Journal
Post by: A Better Bard on September 05, 2011, 02:33:15 pm
I fiddled with this a bit, but the extent of my scripting knowledge wasn't enough to accomplish my goal.

How would I embed new categories in each section?

So lets say I select 'People', it would give me another list categories like 'Heroes', 'Villains', 'Gods', and each one of those would have the usual selections with info... For example.

:)
Title: Re: [XP] Journal
Post by: ForeverZer0 on September 05, 2011, 02:54:58 pm
This script is rather simple and is not really set up for that.  There is no simple and quick explanation on how to do it, you kinda just need to know scripting well enough.  Basically, create a sub-window with configurable commands, and update methods for each that will take you to the appropriate entry when selected.
Title: Re: [XP] Journal
Post by: A Better Bard on September 05, 2011, 03:16:10 pm
Thaat's what I figured. I guess i'll just mess around with it some more until something works. Hah, thanks.

Love the script by the way!
Title: Re: [XP] Journal
Post by: hyakkivn on September 06, 2011, 08:49:54 am
How can I call this script from menu bar.
Quote$scene = Scene_Journal.new

One more question: How can I add the point adding system after level up in the menu bar as well.
Actually, I'm a :n00b: and don't know about scripting, for the Point adding system that I found in this forum, I have to create an event and call the script from that event. It is unconfortable. 
Title: Re: [XP] Journal
Post by: Solusandra on October 05, 2011, 03:19:31 pm
Hey, sorry for bumping up an old topic. I'm loving this script, I was just wondering how you could make an item show up in blue or something when it's a new addition.

I fiddled around a bit, I figure you want a true / false trigger so when you do the "add" entry it flags as new, then when you read it, the read sets the trigger to false / read. Might help if a script trigger can flag it as new as well, in case the entry gets updated (which I figured out pretty readily, but that unfortunately is the limit of my own script customising abilities)