Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> Can Someone Help Me With This?, Editing Some Scripts By A Newbie
SleepingSirenx
post Nov 1 2011, 08:08 AM
Post #1


The SMT Maniac
Group Icon

Group: Revolutionary
Posts: 125
Type: Developer
RM Skill: Undisclosed




I want to create a window inside the menu where when a certain command is confirmed, it will show a window saying "Quicksave Successful!"
Here is the script i've been experimenting
CODE
#============================================================================
# Confirmation Window
#============================================================================
  class Window_Confirmation < Window_Base
  def initialize
    super(0, 0, 640, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Lucida Sans Unicode"
    self.contents.font.size = 18
    refresh
  end
#------------------------
# Confirmation Text
#------------------------
def refresh
  self.contents.clear
  self.contents.font.name = "Lucida Sans Unicode"
  self.contents.font.size = 18
  self.contents.draw.text = "Quicksave Successful!"
  self.contents.draw.text = "Returning to Title Screen"
end
end


But I always get an error saying syntax error occured on the "class Window_Confirmation < Window_Base" line. Anyone can help me with this? thank you.


__________________________

My First Game .... Yeah .... ~♥
I'm In Need Of A Team To Help Me WIth The Development Of My Game PM Me. :)
- DEMO's On Progress!

I Support This Projects!



Please Teach Me How To Script. :(
I'm Learning How To Script. But Still Teach Me How To Script :)
Damn THERMODYNAMICS! Makes My Head Spin!
Go to the top of the page
 
+Quote Post
   
 
Start new topic
Replies
maximusmaxy
post Nov 2 2011, 05:00 AM
Post #2


PZE whore
Group Icon

Group: Revolutionary
Posts: 131
Type: Scripter
RM Skill: Skilled




There's a couple things you need to do to get the effect you desire.
The first thing you need to do is create your window object in your menu scene.

Find the main method in your menu scene, it looks like this:

CODE
def main
    
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "Memory"
    s6 = "Quicksave"
    s7 = "Quit"

#ect.

Anywhere under the word main you need to create the window like so.
Also you should set window visibility to false so you can't see it when you open the menu.
CODE
@confirmation_window = Window_Confirmation.new
@confirmation_window.visible = false

The main method should look something like this:

CODE
def main
    #create the confirmation window
    @confirmation_window = Window_Confirmation.new
    @confirmation_window.visible = false

    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "Memory"
    s6 = "Quicksave"
    s7 = "Quit"

#ect.


Then you need to find where you want to activate the window which I'm guessing is here:

CODE
when 5
      #Play Decision SE
      $game_system.se_play($data_system.decision_se)
      # Quicksave Game
      $game_system.map_quicksave
      delay(0.5)
      #Return to Title Screen
      $scene = Scene_Title.new


Instead of sending you back to scene title straight away we are going to show the window so it should look something like this

CODE
when 5
      #Play Decision SE
      $game_system.se_play($data_system.decision_se)
      # Quicksave Game
      $game_system.map_quicksave
      #show the confirmation window
      @confirmation_window.visible = true


After this we want it to check for your button input to send you back to the title, but we only want it to check for this said input when the window is showing. To do this we find the update section:

CODE
def update
@command_window.update
@status_window.update
@map.update
#ect.


and we're going to put in the check for your button input to exit to the title screen when the window is visible.

CODE
def update
#if the confirmation window is visible
if @confirmation_window.visible
  #if the input key is either C or X
  if Input.trigger?(Input::C) || if Input.trigger?(Input::B)
    #Play Decision SE
    $game_system.se_play($data_system.decision_se)
    #hide the confirmation window
    @confirmation_window.visible = false
    #exit to title scene
    $scene = Scene_Title.new
  end
  #cancel the rest of the update method
  return
end
@command_window.update
@status_window.update
@map.update
#ect.


Ok and finally we need to dispose the confirmation window to free it from the memory. Even though its not visible, it doesn't mean its not there. We dispose windows at the end of the main method. Find this section:

CODE
Graphics.freeze
@command_window.dispose
@game_stats_window.dispose
@status_window.dispose
@map.dispose
end


Now we are going to add the confirmation window to the list of other disposed windows.

CODE
Graphics.freeze
@command_window.dispose
@game_stats_window.dispose
@status_window.dispose
@map.dispose
#dispose the confirmation window aswell
@confirmation_window.dispose
end


And that should be it. I did this all from memory and haven't tested it at all because it's late and I'm tired wink.gif I may have forgotten something or I may have made a stupid spelling mistake so if it doesn't work or you can't figure it out I'll fix it tomorrow.


__________________________
Check out the new PZE Forums! http://zeldaengine.net/index.php
Go to the top of the page
 
+Quote Post
   



Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 20th May 2013 - 05:45 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker