RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[VX] Making a script.

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 69
RMRK Junior
Ok, so I have learned how to know what I'm looking at in the Script_Editor, and now I'm going to attempt to make my own script.

I have three questions:

1.  How do you call "in-game" variables within a script?
   ie.  If I wanted to display a certain text statement by pressing a button like F or G, but only after a certain in game variable has been set to 1.

Like this:

    The party vanquishes the evil wizard, Snuffleufagus.
   Control Variable:[0001] +=1

  I want the script to say "You've vanquished Snuffleufagus."  if variable:[0001] == 1
upon pressing the g key on your keyboard.  And then I want the x (cancel) button to exit the window.

2.  I want this to change throughout the game, so I guess it will look like this (my mind, not true script)

        If variable:[0001] == 1
             "text"
       If variable:[0001] == 2
             "different text"

I have an idea on how to do the second part, the first question is the real problem..  how to make a script change upon an in game variable..
     
       

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Well, what you are describing is way better done in a common event, but to check the value of an in-game variable, you simply use the code:

Code: [Select]
$game_variables[x]

Where x is the ID of the variable you want to check (without leading zeros). So, in your example, it would be:

Code: [Select]
$game_variables[1]

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
I think that pressing G on the keyboard to do something is a little ambitious. By default, there's no button that uses the G key to do something. You may need a custom input script to achieve this. Aside from that, MA's got you covered.
Code: [Select]
if $game_variables[1] == 1
  do_cool_stuff
elsif $game_variables[1] == 2
  do_better_stuff
end
If that all makes sense.
it's like a metaphor or something i don't know

***
Rep:
Level 69
RMRK Junior
Ok, I got things to do stuff!!  However..  the window remains on the screen after I call the event, how do you make it so you press enter or spacebar and make the window go away?  And how would you go about making a custom input script to call the window?

I'm attempting to make my own rendition of Quest Objectives, So after you do something in my game, you call the script and it reminds you of what you should do next.  This is what I have so far:
 
I don't know how to put that nifty Code/Select thing in.. but here:

#---------------------------------------------------------------------------
#                        Current Objective
#       Script Version 0.1 // Written by DM Thanatos
#       Special Thanks to Modern Algebra and Pacman for putting up
#       With my many annoying questions
#---------------------------------------------------------------------------

#---------------------------------------------------------------------------
# *This section defines the window
#---------------------------------------------------------------------------

class Quest_Log < Window_Base
 
 
#-------------------------------------------------------------------------
# * This section is used to define what is said in the quest log through
# your game variable.
#-------------------------------------------------------------------------

 def initialize
   @@quest_log = $game_variables[1]
   
   case @@quest_log
    when 1
      def initialize
        super(0,270,545,146)
       self.contents = Bitmap.new(width-32, height-32)
       self.contents.font.name = "Arial"
       self.contents.font.size = 22
       self.contents.draw_text(0, 0, 600, 32, "The Sailor spoke of a mysterious island to the west.")
       
      end
   end
end
 


*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
There's definitely nothing wrong with that there (by the way, to use the nifty code dealy use [-code-][-/code-] without the -s), but there is something I want to question.
Why did you make it @@quest_log when you could've just made it @quest_log or even just quest_log? What do you plan on doing with that constant? Also, why couldn't you just use
Code: [Select]
case $game_variables[1]
?
Also, I don't understand how/why you've put def initialize in the definition of the initialize method. It would be better to call another method with the arguments you set in the super.
One more thing... you can define the text to use in the draw_text call in a previous line to take up less space and make you script look nicer. It does next to nothing in the actual script, but it's just my OCD pointing something out. For example,
Code: [Select]
case @@quest_log
  when 1
    def initialize
    super(0,270,545,146)
    self.contents = Bitmap.new(width-32, height-32)
    self.contents.font.name = "Arial"
    self.contents.font.size = 22
    text = "The Sailor spoke of a mysterious island to the west."
    self.contents.draw_text(0, 0, 600, 32, text)
    end
end
it's like a metaphor or something i don't know

***
Rep:
Level 69
RMRK Junior
I wasn't sure if I needed to make it a variable as well, which is why I used @@_Quest_Log, I'm not too familiar with scripting just yet.  The thing is, the window that is called remains on the screen.  How do I get it to go away by pressing enter or spacebar, the way that show text commands in RM work?

I know you said it's ambitious to use a key to call the script, however.  This is what I need to happen.  The scripts purpose is to always update what you need to do next in my game, or rather hint at it.  I would prefer to call it with an input trigger.  >.<

I tried Dubealex' tutorial but his scripts are written for XP and I'm using VX.  The variables he uses don't exist, and I am not adept enough to find the strings that I need to make them work.  Do you possibly have a reference to a tutorial to RGSS for VX?

*
Rep:
Level 82
GIAW 14: 1st Place (Easy Mode)2013 Project of the Year2013 Best RPG Maker User (Programming)2013 Most Promising ProjectParticipant - GIAW 11Bronze - GIAW 10
When I was first learning Ruby and the structures of VX, I browsed through the RGSS code to try and find my answers. Game_Interpreter (along with Game_Player) has a lot of interesting tidbits of information if you look under certain areas as the script is fairly well commented and contains the exact names as are in the event edtior. If I was interested in changing the amount of items the party has, I'd search for 'Change Items' or if I wanted to disable the menu from a script, I'd look under 'Change Menu Access'.

Also, I found diving through the help file that comes with VX helped quite a bit as well. Doing a search for 'RPG::' reveals all of the data structures that are used.

Anyway, right now your window is just sitting there and hasn't been told to update. So, to catch any input, it will need an update method. If you look at Window_NameInput and search the help file for 'Input' that might help you out :

Code: [Select]
  def update
    if Input.press?(Input::F5)
      # Get rid of the window
      self.dispose
    end
  end

That ... should work. I'm fairly new to working with windows myself, so there may be some issues with the 'self.dispose' part. Also, once your window is initialized, it won't refresh with new quests when you bring it up next. So, we'll need a refresh module as well :

Code: [Select]
  def refresh
    # Clear the current contents
    self.contents.clear

    case @@quest_log
      when 1
        super(0,270,545,146)
        self.contents = Bitmap.new(width-32, height-32)
        self.contents.font.name = "Arial"
        self.contents.font.size = 22
        text = "The Sailor spoke of a mysterious island to the west."
        self.contents.draw_text(0, 0, 600, 32, text)
      when 2
        # etc ...
    end
  end
« Last Edit: June 28, 2011, 07:59:43 PM by Exhydra »

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
That said, make sure you get rid of the case in the initialize method, so overall we just have:
Code: [Select]
def initialize
  @@quest_log = $game_variables[1]
  refresh
end
def refresh
  case @@quest_log
    when 1
      etc.
I also recommend putting the
Code: [Select]
        self.contents = Bitmap.new(width-32, height-32)
        self.contents.font.name = "Arial"
        self.contents.font.size = 22
before the case or at least before the first when to take up less space in the script.
it's like a metaphor or something i don't know

***
Rep:
Level 69
RMRK Junior
Ok, my brain exploded.  ::)

I keep getting syntax errors, and I fixed those, then I get method errors.  >.<

I need some kind of guide or tutorial.  Can any of you point me to one?

(Theres no point in writing a script if I don't understand basics and different functions..)

*
Rep:
Level 82
GIAW 14: 1st Place (Easy Mode)2013 Project of the Year2013 Best RPG Maker User (Programming)2013 Most Promising ProjectParticipant - GIAW 11Bronze - GIAW 10
Hmm, sorry ... I didn't learn that way, so I really don't have any tutorials or guides I can give you. I would start small and go bigger, adding things in as you go along and using a copy of another window class. Something I use occasionally is the Ruby core reference, but that might be confusing as VX uses an older version of Ruby and some things listed might not work.

Here's a working version of what you were after, with comments. Hopefully this will help you out a little more!


Code: [Select]
#   You can call this window anywhere by using the following in a script input box : Quest_Log.new
#   To make sure that the player doesn't open multiple quest windows before closing the first,
# you can call the script like so : Quest_Log.new unless $QUEST_LOG_WND != nil


#   Sets a Global Variable; this will keep track of if the window is currently
# open or not.
$QUEST_LOG_WND = nil



#   To catch keyboard strokes, we need a reliable way of calling the update
# method within our Quest_Log window. Scene_Map is updated every frame, so
# we'll use that to make sure our window is both updated and terminated
# properly since our window can't update itself without causing a fatal
# loop.
class Scene_Map
 
  #   We'll make an alias of Scene_Map's terminate and update so we don't
  # over-write the methods, thus increasing compatability with other scripts.
  alias quest_log_terminate terminate unless $@

  def terminate
    # We'll call our alias first.
    quest_log_terminate

    # Dispose of the Quest_Log window unless it isn't open.
    $QUEST_LOG_WND.dispose unless $QUEST_LOG_WND == nil
  end



  alias quest_log_update update unless $@

  def update
    # We'll call our alias first.
    quest_log_update

    # Update the Quest_Log window unless it isn't open.
    $QUEST_LOG_WND.update unless $QUEST_LOG_WND == nil
  end
 
end # Scene_Map




class Quest_Log < Window_Selectable

  def initialize
    super(0,270,545,146)

    #   We'll set the Global Variable to the current window. Now it will update
    # and terminate properly.
    $QUEST_LOG_WND = self

    @@quest_log = $game_variables[1]

    #   We'll call the refresh method to display the text. Keep in mind that
    # currently, the player can run around with this window open and might
    # complete quests while showing the old data.
    refresh
  end

  def refresh
    # Clear the current contents
    self.contents.clear

    case @@quest_log
      when 1
        self.contents = Bitmap.new(width-32, height-32)
        self.contents.font.name = "Arial"
        self.contents.font.size = 22
        text = "The Sailor spoke of a mysterious island to the west."
        self.contents.draw_text(0, 0, 600, 32, text)
      when 2
        # etc ...
    end
  end

  def update
    if Input.press?(Input::F5)
      # Get rid of the window
      $QUEST_LOG_WND = nil
      self.dispose
    end
  end

end # Quest_Log
« Last Edit: June 29, 2011, 08:46:20 PM by Exhydra »

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Learn how to event first. It is a simpler language, easy to track and you can familiarize yourself with programming logic, which is the most important part. There is also more support for that in the RM community.

Once you are able to event really well, moving on to scripting is just a matter of syntax and becoming familiar with the library. And if you know how to event well, then you'll have an excellent resource for learning the library since you can just look at the Game_Interpreter class to see how you could do any number of things in scripting.

***
Rep:
Level 69
RMRK Junior
Now, when you say "Eventing",  I have around 7 hours of gameplay into my game thats all evented and working flawlessly, with variables, switches, and what not...  Is that what you mean? I have a pretty good logic on how to get things to happen in VX.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
It is what I mean, but I am referring to more complicated eventing, such as making menus, battle systems, etc... not just simpler things like random chests and tracking quest progress.

Maybe you do know how to do all of that stuff, IDK. But the thing you are asking for now can very easily be done by events - it's far easier and more malleable to do by events than using a script really. It would only take one switch, one variable and one common event (and the only event commands you would need to use in it are conditional branches and show texts). I assumed that if you couldn't see how to do it with events, then you weren't all that competent with them. I'm sorry if that assumption was wrong. Maybe you are just doing it to practice scripting?

***
Rep:
Level 69
RMRK Junior
 
It is what I mean, but I am referring to more complicated eventing, such as making menus, battle systems, etc... not just simpler things like random chests and tracking quest progress.

I mean I event animations, and dialog and what not and to the most part I think it's pretty good... WHat do you mean by battle systems and custom menus?  Could you point me in the right direction where I can see what you mean?



Exhydra:

I notice that the input trigger to get rid of the window is F5, I tried changing that and it didn't work..  Why is that?

Also I would like to press a key to call the script regardless of what map you're on.  How would we do that.. Like Press F1 to call the script, and F1 to close the window as well..   (Also thank you for writing it with me, I'm starting to understand a lot better now.

***
Rep:
Level 69
RMRK Junior
Also..  I was messing around with text positions and I was able to make a very nice window where the text fits perfectly, I have one question about scripting through text though.. 

  How do I change the color of word or phrase within a string?

 Such as:

  The Sailor spoke of a mysterious island to the west.

I want to make it:

  The sailor spoke of a mysterious island to the west.


Oh, another thing Ive been trying to figure out:

How do you call a SE from the database?  I was able to put in the sound when I cancel the menu by pressing F5
 (using Sound.play_cancel in def update)

 However I'm having problems making the sound effect I want (A custom one from my database) play when the menu pops up.

  I tried making a new class
Code: [Select]

class Game_System

q_log_se = ["Decision2", 100, 100]

And then I put this in update (probably wrong)

Code: [Select]

if @@q_log => 1
 RPG::SE.new (*$game_system.q_log_se).play



Heh, that didn't work.
« Last Edit: July 08, 2011, 05:58:40 AM by thanatos2k1 »

*
Rep:
Level 82
GIAW 14: 1st Place (Easy Mode)2013 Project of the Year2013 Best RPG Maker User (Programming)2013 Most Promising ProjectParticipant - GIAW 11Bronze - GIAW 10
If you open up the RPG Maker VX help file and search for 'Input', it will list the keys that are available for use (DOWN LEFT RIGHT UP, A B C X Y Z L R, SHIFT CTRL ALT, F5 F6 F7 F8 F9). You can use combinations of these keys, as well :

Code: [Select]
Input.press?(Input::SHIFT) && Input.press?(Input::F5)

If you want more keys than what is listed, you'll have to use a third party key input module. I personally like using Glitchkey's script when I need extra keys. However, I do not believe that you can use the F1 key as it has been designated by the RPG Maker system menu.

To get the quest window to open up anywhere by pressing a key is fairly simple. Within the Scene_Map code, under the 'update' method, you would just add in an 'if' statement to check to see if the key has been pressed and then check to see if the Quest Log window is open.


Code: [Select]
#   You can call this window anywhere by using the following in a script input box : Quest_Log.new
#   To make sure that the player doesn't open multiple quest windows before closing the first,
# you can call the script like so : Quest_Log.new unless $QUEST_LOG_WND != nil


#   Sets a Global Variable; this will keep track of if the window is currently
# open or not.
$QUEST_LOG_WND = nil



#   To catch keyboard strokes, we need a reliable way of calling the update
# method within our Quest_Log window. Scene_Map is updated every frame, so
# we'll use that to make sure our window is both updated and terminated
# properly since our window can't update itself without causing a fatal
# loop.
class Scene_Map
 
  #   We'll make an alias of Scene_Map's terminate and update so we don't
  # over-write the methods, thus increasing compatability with other scripts.
  alias quest_log_terminate terminate unless $@

  def terminate
    # We'll call our alias first.
    quest_log_terminate

    # Dispose of the Quest_Log window unless it isn't open.
    $QUEST_LOG_WND.dispose unless $QUEST_LOG_WND == nil
  end



  alias quest_log_update update unless $@

  def update
    # We'll call our alias first.
    quest_log_update

    # Update the Quest_Log window unless it isn't open.
    $QUEST_LOG_WND.update unless $QUEST_LOG_WND == nil
   
    # Using Glitchkey's Key Input Module to catch the '1' key to open the
    # quest window.
    # .trigger? is better in this case than .press? because if the player
    # holds down the button, the Quest Log window will flash quickly because
    # it is being updated every frame.
    if Keys.trigger?(Keys::N1)
      # When the '1' key is pressed and the Quest Log window isn't open ...
     
      if $QUEST_LOG_WND == nil
        # Play a sound.
        RPG::SE.new('Decision2.ogg', 100, 100).play
       
        # Open a new Quest Log window.
        Quest_Log.new
       
      else # When the '1' key is pressed and the Quest Log window is open ...
        # Play a sound.
        Sound.play_cancel
       
        # Close the Quest Log window.
        $QUEST_LOG_WND.dispose
      end
    end

  end
 
end # Scene_Map




class Quest_Log < Window_Selectable

  def initialize
    super(0,270,545,146)

    #   We'll set the Global Variable to the current window. Now it will update
    # and terminate properly.
    $QUEST_LOG_WND = self

    @@quest_log = $game_variables[1]

    #   We'll call the refresh method to display the text. Keep in mind that
    # currently, the player can run around with this window open and might
    # complete quests while showing the old data.
    refresh
  end

  def refresh
    # Clear the current contents
    self.contents.clear

    case @@quest_log
      when 1
        self.contents = Bitmap.new(width-32, height-32)
        self.contents.font.name = "Arial"
        self.contents.font.size = 22
        text = "The Sailor spoke of a mysterious island to the west."
        self.contents.draw_text(0, 0, 600, 32, text)
      when 2
        # etc ...
    end
  end
 
  def dispose
    # Make sure the Global Variable is set to nil when closing the window.
    $QUEST_LOG_WND = nil
   
    # Dispose of the window.
    self.contents.dispose
    super
  end

  def update
    refresh
  end

end # Quest_Log


EDIT: You were getting close on your last attempt to play a sound. There's a few ways to do it, but you can just use this and it will work :

Code: [Select]
# Insert the name of the file with extension. Volume is a number from 0 to 100. Pitch is a number from 0 to 150; default speed is 100.
Audio.se_play("Audio/SE/<file-name>", volume, pitch)

# This also works ...
RPG::BGM.new("<file-name>", volume, pitch).play

Also, putting a sound effect in the update method is a bad idea. Remember, the update is being called around 60 times every second. That means your sound effect is trying to play itself that many times. Instead, call it in the initialize and it will only be played when the window is created.

Alternatively, if you just wanted to use the sound of a menu being opened, you could use the system default sound :

Code: [Select]
Sound.play_decision
« Last Edit: July 08, 2011, 05:45:43 PM by Exhydra »

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

*
Rep:
Level 82
Quote
WHat do you mean by battle systems and custom menus?

MA means have you ever made your own battle system using only events, as opposed to using the default battle system provided by VX? Similarly, custom menus are menus that work very much like the Item/Equip/Status menu except you've made your own using events, again as opposed to the default menu VX uses.

The best example I can think of from the top of my head can be seen in the various Resident Evil fan games made on RM software. Battle systems take place on the field map with combination of buttons being sued to shoot your enemies, and the menu systems make use of coordinate checks, pictures, variables that produce some pretty good replicas of the actual menus from the official games. These types of systems require some pretty complex branch handling and variable updating/tracking to work effectively and smoothly. If you can manage to get around those, then scripting is the next step up as you already have good knowledge of how events and scenarios are set up and used by VX.

One thing you should also consider, that I've mentioned to people before, is whether or not you need to go out of your way to script something when you know how you can achieve the same result using events. If you enjoy programming/scripting and you want to learn RGSS(2) then go for it - the satisfaction is well worth the time it can take to get a script working. If you just want to write a script because you aren't sure how to event it, then it'll probably end up frustrating to do and not worth the time - not to mention the trouble of fault finding to fix the errors and bugs you'll likely have to sift out.
(Why do I always feel like it's the end of the world and I'm the last man standing?)

***
Rep:
Level 69
RMRK Junior
To Loggan:

  Ah, I see now.  I would have no idea where to start to make  bullets shooting, or making menus using in game events and variables..  I need to start checking that stuff out, I have some really good ideas that I would like to bring to life.  I'll check out some tuts, hopefully I can find one that helps.  If you have any ideas, I'd be very appreciative.

As for the new code that I tried implementing..

The Sound is playing fine, and everything..  however.  I loaded Glitchkey's script, and edited my code..  however.  The input triggers are not working.  I attempted to make it the Num 1 key, and left it alone as well for the ~ key, it doesn't work..  here's the code, possibly see what Im doing wrong..
Code: [Select]
#   You can call this window anywhere by using the following in a script input box : Quest_Log.new
#   To make sure that the player doesn't open multiple quest windows before closing the first,
# you can call the script like so : Quest_Log.new unless $QUEST_LOG_WND != nil

#   Sets a Global Variable; this will keep track of if the window is currently
# open or not.
$QUEST_LOG_WND = nil

#   To catch keyboard strokes, we need a reliable way of calling the update
# method within our Quest_Log window. Scene_Map is updated every frame, so
# we'll use that to make sure our window is both updated and terminated
# properly since our window can't update itself without causing a fatal
# loop.

class Scene_Map
 
  #   We'll make an alias of Scene_Map's terminate and update so we don't   
  # over-write the methods, thus increasing compatability with other scripts.
 
  alias quest_log_terminate terminate unless $@
 
  def terminate
    # We'll call our alias first.
    quest_log_terminate
   
    # Using Glitchkey's Key Input Module to catch the '~' key to open the
    # quest window.
    # .trigger? is better in this case than .press? because if the player
    # holds down the button, the Quest Log window will flash quickly because
    # it is being updated every frame.
    if Keys.trigger?(Keys::N1)
      # When the Number 1' key is pressed and the Quest Log window isn't open ...
      if $QUEST_LOG_WND == nil
        # Open a new Quest Log window.
        Quest_Log.new
      else
        # When the 'Number 1' key is pressed and the Quest Log window is open ...
        # Close the Quest Log window.
        $QUEST_LOG_WND.dispose
      end
    end
  end
end # Scene_Map

class Quest_Log < Window_Selectable

def initialize
  super(0,270,545,146)
 
  # Play the sound for opening the window.
    RPG::SE.new('Decision2.ogg', 100, 100).play
 
  #   We'll set the Global Variable to the current window. Now it will update
  # and terminate properly.
 
  $QUEST_LOG_WND = self
  @@quest_log = $game_variables[1]
 
  #   We'll call the refresh method to display the text. Keep in mind that
  # currently, the player can run around with this window open and might
  # complete quests while showing the old data.
  refresh
end

def refresh
  # Clear the current contents
  self.contents.clear
  case @@quest_log
  when 1
      self.contents = Bitmap.new(width-32, height-32)
      self.contents.font.name = "Arial"
      self.contents.font.size = 22
      text = "After vanquishing the evil at the island to the west, you figure"
      text1 = "it's about time to go back to town, the Queen will undoubtedly"
      text2 = "wish to hear about all that has transpired.. Even though you"
      text3 = "may not want to, you owe her at least an explanation."
      self.contents.draw_text(0, 0, 600, 32, text)
      self.contents.draw_text(0, 28, 600, 32, text1)
      self.contents.draw_text(0, 56, 600, 32, text2)
      self.contents.draw_text(0, 84, 600, 32, text3)
    when 2
      # etc ...   
    end 
  end
  def dispose
    # Make sure the Global Variable is set to nil when closing the window.
    $QUEST_LOG_WND = nil
    # Dispose of the window.
    self.contents.dispose
    super
  end
  def update
    refresh
     if Keys.trigger?(Keys::N1)
        # Get rid of the window
        Sound.play_cancel
        $QUEST_LOG_WND = nil
        self.dispose
  end
end
end
# Quest_Log


I've been looking at various codes as well, and can't seem to find any script that Im currently usingthat changes the color of only PART of the text.. >.<

*
Rep:
Level 82
GIAW 14: 1st Place (Easy Mode)2013 Project of the Year2013 Best RPG Maker User (Programming)2013 Most Promising ProjectParticipant - GIAW 11Bronze - GIAW 10
Remember to check over where you're putting your script, as right now the code that should be under Scene_Map > 'update' is under Scene_Map > 'terminate', which will not allow for catching key strokes like you were wanting. I updated the code in my last post as to how it should look like with your new additions. To make it easier, we'll just play the sound effects within the 'update' method after the key stroke has been confirmed.

There's no need to try and catch keys with the Quest Log > 'update' method, as the Scene_Map > 'update' will do it.
« Last Edit: July 08, 2011, 05:47:30 PM by Exhydra »

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

***
Rep:
Level 69
RMRK Junior
Thank you so much!! It works perfectly!! :D

And by doing this, you really helped me understand quite a bit of where things are supposed to go.  Absolutely wonderful!

The only thing left for me to do is change font color in certain parts of the text.  How would we do that?

I know how I CAN do it..  by using

self.contents.font.color = "6"

But then it would make the entire text string that color, how would I make it so it only affects certain areas like this:




  How do I change the color of word or phrase within a string?

 Such as:

  The Sailor spoke of a mysterious island to the west.

I want to make it:

  The sailor spoke of a mysterious island to the west.