Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> Super Simple Journal
amaranth
post Dec 21 2008, 07:05 PM
Post #1


Level 6
Group Icon

Group: Member
Posts: 78
Type: Developer
RM Skill: Masterful




I'm moving all of my scripts from rmxp.org to this site. I like it here better.

Introduction
If you want a very simple journal, this is the script for you. This script creates a new journal screen for you that contains a list of quests that your character needs to complete. The player can scroll through the list, and that's it. You define your journal entries in the script, and then use switches to turn the entries on and off in your game. Easy!

Create Window_Journal

In this section, we will create the journal and its window.

1. Open your game and script editor.

2. Add a new script called Window_Journal below Window_Menu in your script list.

3. In Window_Journal, add the following code:

CODE
#==============================================================================
# ** Journal
#------------------------------------------------------------------------------
#  This window displays a journal.
#==============================================================================

class Window_Journal < Window_Selectable
# ------------------------
def initialize
   super(0, 32, 460, 330)
   @column_max = 1
   refresh
   self.index = 0
end


#--------------------------------------------------------------------------
# * Draw the contents of the item window
#--------------------------------------------------------------------------
def refresh
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
  
   # variables
   @journal_height = (2)*32   # y coord of entire journal (# of entries - 1) * 32
   @n = 0                     # y coord for each entry
   @item_max = 0              # max items to dispaly
  
   # draw the bitmap. the text will appear on this bitmap
   self.contents = Bitmap.new(width - 32, height+@journal_height)
      
   # populate your journal with entries. Each entry must match its switch number!
   @data = []
   @data[1] = "Task 1"
   @data[2] = "Task 2"
   @data[3] = "Task 3"
  
   for i in 1..3
     if $game_switches[i] == true
       draw_item(i)
       @item_max += 1
     end
   end        
  
end
  
#--------------------------------------------------------------------------
# * Draw an individual item in the window
#     index : Index of the item to be drawn
#--------------------------------------------------------------------------

def draw_item(index)
      item = @data[index]
      rect = Rect.new(10, @n, 640, 32)
      self.contents.fill_rect(rect, Color.new(0,0,0,0))        
      self.contents.draw_text(10, @n, 640, 32, "●", 0)
      self.contents.draw_text(25, @n, 640, 32, item, 0)
      @n += 32
      
end

end



Create Scene_Journal

In this section, we will create the scene that will contain our journal window. The scene determines where the journal window will appear to users and what happens when keys are pressed.

1. Open your game and script editor.

2. Add a new script called Scene_Journal below Scene_Menu in your script list.

3. In Scene_Journal, add the following code:

CODE
#==============================================================================
# ■ Scene_Status
#------------------------------------------------------------------------------
#  This class contains the windows for the character status menu that can be
#   accessed from the main menu.
#==============================================================================

class Scene_Journal
  #--------------------------------------------------------------------------
  # ● Initialize the Status menu
  #--------------------------------------------------------------------------
  def main

    @journal_window = Window_Journal.new
    @journal_window.x = 90
    @journal_window.y = 70
    
    Graphics.transition

    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end  
    end

    Graphics.freeze
    @journal_window.dispose

  end
  #--------------------------------------------------------------------------
  # ● Draw the Status menu
  #--------------------------------------------------------------------------
  def update
    @journal_window.update
    if @journal_window.active
      update_item
      return
    end
  end

  #--------------------------------------------------------------------------
  # ● Update menu after player makes a selection
  #--------------------------------------------------------------------------
  def update_item
  
    # Cancel key pressed (go to menu)
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(5)
      return
    end
    
  end
  
end



Update Window_Menu

In this section, we will add Journal to the main menu. It will appear at the bottom of the menu after Quit.

Note: This section assumes that you now have 7 items in your main menu, and the journal is the 7th item.

1. Open the Window_Menu script.

2. Find @item_max and add 1 to it. (@item_max = 7)

3. Find the data[] array, and add an additional item. (@data[7] = "Journal")

4. Below the data[] array, add 1 to the for loop. (for i in 1..7)


Update Scene_Menu

In this section we will add a link to the journal. This scene controls main menu navigation.

Note: This section assumes that you now have 7 items in your main menu, and the journal is the 7th item.

1. Open the Scene_Menu script.

2. Under def update_command, under case @menu_window.index, add the following line (this assumes that you have 7 items in your menu, and this is the 7th item):

CODE
      when 6  # Journal selected
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Journal.new


Create Journal Entries

Now that you have your Journal set up, you need to add journal entries to it.

1. Go to your Window_Journal script.

2. Find this section:
@data[1] = "Task 1"
@data[2] = "Task 2"
@data[3] = "Task 3"


3. Replace the tasks with your own. For example:
@data[1] = "Find treasure for Jake"
@data[2] = "Get milk for Ma"
@data[3] = "Destroy the world"



Create Journal Switches

Now that your journal entries are added to your journal, turn them on and off with switches.

Note: The number assigned to each data entry needs to match the number assigned to each switch. For example, @data[2] = "Get milk for Ma" | 0002: Help Ma.

1. Add a new event to one of your maps.

2. Open the Event Commands window.

3. Click Control Switches and add the following:
0001: Help Jake
0002: Help Ma
0003: Destroy World



Turn Entries On and Off

To turn entries on and off, simply turn the journal switches on or off in the Event Command window for an event on the map.


How do I add more journal entries?

To add new journal entries, you need to update your list of switches and your list of journal entires in Window_Journal.

1. Open the Window_Journal script and add another entry to the data[] array. (for example, data[4] = "Save the world")

2. In the Window_Journal script, update the journal_height variable. (+1 for each additional journal entry. For example: @journal_height = (3)*32)

3. In the Window_Journal script, update the for loop. (+1 for each additional journal entry. For example: for i in 1..4)

4. Exit the script editor, and open an event on your map. Add a new switch for the journal entry. (for example, 0004: Save World)


I don't want to start with switch 1

If you don't want to start your journal entry with switch 1, simply adjust your for loop in Window_Journal as follows:

Note: The following code assumes that you are starting at switch 100 instead of 1.

for i in 1..3
if $game_switches[i+99] == true
draw_item(i)
@item_max += 1
end
end


__________________________
Go to the top of the page
 
+Quote Post
   
 
Start new topic
Replies
RzrBladeMontage
post Feb 8 2009, 08:34 PM
Post #2


"Hey.. would you say... I became a Hero?" - Zack Fair
Group Icon

Group: Revolutionary
Posts: 773
Type: Event Designer
RM Skill: Advanced




Hey guys I just started using RMXP for a school project and this journal script is exactly what I need. I put everything in correctly and it works just as it's supposed to, but I was wondering if anyone knew how to select something in the journal to read more about it. Like if there was a quest called "Chop Wood" how could I make it so the player could select that option and read information about that quest? Thanks in advance smile.gif.


__________________________





Go to the top of the page
 
+Quote Post
   
obsorber
post Feb 9 2009, 03:03 AM
Post #3


Level 26
Group Icon

Group: Revolutionary
Posts: 591
Type: Writer
RM Skill: Skilled




You can't my friend. Thus the term super simple journal script. Well at least I don't think you can...


__________________________

The final release of Project Viral is finally here!


Eden Hall, demo released!
Go to the top of the page
 
+Quote Post
   

Posts in this topic
- amaranth   Super Simple Journal   Dec 21 2008, 07:05 PM
- - Unnamed   I like this idea, but I'm having trouble using...   Dec 29 2008, 11:57 AM
- - Giterdone   I'm kind of having trouble too. What is the W...   Dec 31 2008, 06:42 PM
- - Giterdone   Does anyone know how to use this journal script???...   Jan 2 2009, 03:18 PM
- - obsorber   I want to use this script but the maker needs to b...   Jan 26 2009, 02:59 PM
- - brewmeister   Super Simple Journal - V2 I agree this needs to b...   Jan 27 2009, 08:08 PM
|- - Unnamed   Thanks brewmeister this is working perfectly now   Jan 29 2009, 07:43 AM
|- - obsorber   QUOTE (Unnamed @ Jan 29 2009, 03:43 PM) T...   Jan 31 2009, 03:06 AM
- - obsorber   Turn Entries On and Off (To turn entries on and o...   Jan 31 2009, 03:45 AM
- - obsorber   Ok no errors I can find on the script. It is compl...   Jan 31 2009, 05:51 AM
- - RzrBladeMontage   You have a good point, I guess I should of thought...   Feb 9 2009, 03:24 AM
- - brewmeister   There are a bunch of other journal or "quest...   Feb 11 2009, 05:11 PM
- - Bt255   Hey everyone. Just started using this script, but ...   Feb 14 2009, 04:46 PM
- - brewmeister   Post your Window_Journal script from your project.   Feb 14 2009, 09:38 PM
- - Bt255   Well here's the script like you asked, if I re...   Feb 15 2009, 04:36 PM
- - brewmeister   Change @data[50] & @data[51] back to [1] ...   Feb 21 2009, 09:37 PM
- - Bt255   It all works perfectly now; and yeah, it is easier...   Feb 21 2009, 09:43 PM
- - patmi   Hello this is very nice, but it worked only with m...   Dec 24 2011, 08:07 AM
- - brewmeister   QUOTE (patmi @ Dec 24 2011, 11:07 AM) Hel...   Dec 25 2011, 05:49 AM


Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 18th June 2013 - 02:38 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker