Also teaches how to make a custom menu.
I'll explain how to make a CMS in details. I will explain what each thing does. In this turtorial you will learn;
- What is Window_Base and how to use it
- How to add animated and non-animated graphics to your window.
- What is Window_Selectable and how to use it
- What is Window_Command and how to use it
- How to make a CMS
Enjoy.
RGSS Needed Knowledge Level: Beginner + 1 ;p
Making a Window
Lesson 1
Making the window...
Windows_Base is just what it sounds like. It is a base to all windows. It contains codes and funtions that you can call and use for your custom windows.
How can you use Window_Base to make a window?
Like so;
You should already know what class is but I will explain non the less.
Next we will learn how to give the window its characteristics;
The settings were; super(100, 100, 200, 200)
How can you use Window_Base to make a window?
Like so;
Code:
[COLOR=Blue]class[/COLOR] MyCustomWindow [COLOR=RoyalBlue]<[/COLOR] Window_Base
[COLOR=Blue]
end[/COLOR]
You should already know what class is but I will explain non the less.
- class is used to start scripts. Imagine it as a container(folder). It contains data like, functions and variables, thats used to make a script.
- When naming a class it must start with a capital letter. The following will give you an error;
Code:
myCustomClass
- < is used so that you can access information from a different class without referring it. In this case, MyCustomWindow can now use all the functions and variables that are in Window_Base.
- Every class must end with an end
Next we will learn how to give the window its characteristics;
Code:
[COLOR=Blue]class[/COLOR] MyCustomWindow [COLOR=RoyalBlue]<[/COLOR] Window_Base
[COLOR=Green] #----------------------------------------------------------------------
# * Object Initialization
#----------------------------------------------------------------------[/COLOR]
[COLOR=Blue]def[/COLOR] initialize
[COLOR=Blue]super[/COLOR](x, y, width, height)
[COLOR=Blue]self[/COLOR].contents = Bitmap.new(width - [COLOR=Sienna]32[/COLOR], height - [COLOR=Sienna]32[/COLOR])[COLOR=Blue]
end[/COLOR]
[COLOR=Blue]
end[/COLOR]
- When a script starts it first looks for "def initialize", if it can't find it, it will look for "def main", if it can't find that it will probably give an error.
- super is used to call the same function in the parent class. The "parent" class in this script is Window_Base. Here super is used to call "def initialize(x, y, width, height)" in Window_Base. With it you can define the window's size and location.
- x = the horizantel location of the window.
- y = the vertical location of the window.
- width = the width of the window. Its not reccomanded to past 640 because it will be missing some parts.
- height = the height of the window. Its not reccomanded to past 480 or it will be missing some parts.
- self is used to access either the parent class or the class its used in. It is sometimes not needed, but in this case it is.
- self.contents = Bitmap.new(width - 32, height - 32) is used to create a bitmap in the window so you can;
- Show text in it
- Show images in it.
Congratulations, you know have a window.
The settings were; super(100, 100, 200, 200)
Hmm.. The window looks a little dull tho. It doesn't have anything in it.
Lesson 2
Adding Text to your window...[/CENTER]
Code:
[COLOR=Blue]class[/COLOR] MyCustomWindow [COLOR=RoyalBlue]<[/COLOR] Window_Base
[COLOR=Green] #----------------------------------------------------------------------
# * Object Initialization
#----------------------------------------------------------------------[/COLOR]
[COLOR=Blue]def[/COLOR] initialize
[COLOR=Blue]super[/COLOR](x, y, width, height)
[COLOR=Blue]self[/COLOR].contents = Bitmap.new(width - [COLOR=Sienna]32[/COLOR], height - [COLOR=Sienna]32[/COLOR])
refresh[COLOR=Blue] [COLOR=Green]# Calls the refresh function in this class[/COLOR]
end[/COLOR]
[COLOR=Blue]def[/COLOR] refresh
[COLOR=Blue]self[/COLOR].contents.clear
[COLOR=Blue]self[/COLOR].contents.font.color = normal_color
[COLOR=Blue]self[/COLOR].contents.font.size = 20
[COLOR=Blue]self[/COLOR].contents.draw_text(x, y, width, height, text)[COLOR=Blue]
end[/COLOR]
[COLOR=Blue]
end[/COLOR]
- self.contents.clear is used to clear the contents of the window. This is so that when the window is refreshed each time, its contents doesn't over lap their selfs each time.
- self.contents.font.color = normal_color sets the font color of the window. It only affects the text(s) that comes after it. This means you can have different colors of texts in your window.
- self.contents.font.size = 20 sets the font size of the text(s) that comes after it. This mean you can have different sized texts in your window.
- self.contents.draw_text(x, y, width, height, text) this draws the given text on the window.
x = X position in the window, not the screen.
y = y position in the window, not the screen.
width = This should equalt to the width of the text. Its hard to guess sometimes.
height = This is the height of your text, it is usually 32.
text = This is the text you want to show. "I am TEXT. Obey ME!!"
Congratulation, now you have a window and have stuff in it;
The new settings for the window is; super(0, 0, 640, 480)
The settigns for the text is; self.contents.draw_text(50, 50, cx, 32, "I am TEXT. Obey ME!!")
Whats "cx"?
cx = contents.text_size("I am TEXT. Obey ME!!").width
It gets the width of the text given. In this case "I am TEXT. Obey ME!!"
Showing your window...
Lesson 1
Making the scene...
To show a window, you need a scene. Scenes are what makes your game run. There can be only 1 scene running at a time.
$scene holds the current scene. If there is no scene the game will close.
$scene = nil will close the game.
Now on to the scripting;
$scene holds the current scene. If there is no scene the game will close.
$scene = nil will close the game.
Now on to the scripting;
Code:
[COLOR=Green]#==============================================================================
# * Scene_ShowWindow
#==============================================================================
[/COLOR]
[COLOR=Blue]class[/COLOR] Scene_ShowWindow
[COLOR=Green]#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------[/color]
[COLOR=Blue]def[/COLOR] main
[COLOR=Green]#call the window[/COLOR]
@window = MyCustomWindow.new
[COLOR=Green]# Execute transition[/COLOR]
Graphics.transition
[COLOR=Green]# Main loop[/COLOR]
loop [COLOR=Blue]do[/COLOR]
[COLOR=Green]# Update game screen[/COLOR]
Graphics.update
[COLOR=Green]# Update input information[/COLOR]
Input.update
[COLOR=Green]# Frame update[/COLOR]
update
[COLOR=Green]# Abort loop if screen is changed[/COLOR]
[COLOR=Blue] if[/COLOR] $scene != [COLOR=Blue]self[/COLOR]
[COLOR=Blue]break
end
end[/COLOR]
[COLOR=Green]# Prepare for transition[/COLOR]
Graphics.freeze
[COLOR=Green]# Dispose of windows[/COLOR]
@window.dispose
[COLOR=Blue] end[/COLOR]
[COLOR=Green]#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------[/COLOR]
[COLOR=Blue]def[/COLOR] update
[COLOR=Green]# Update windows[/COLOR]
@window.update
[COLOR=Blue] end
end[/COLOR]
- Earlier I said, when a script starts it first calls initialize and then main, if its there. If initialize isn't there it will call main, if thats not there, it will crash.
You have one or the other and you can also have both.
- @window = MyCustomWindow.new calls our window. The window will now show on the screen when this code is read.
- if $scene != self
break
end
That exits the "main loop" which keeps the scene functioning. If there is no loop the script will just end.
- @window.dispose closes our window. When the scene ends, you want close all the windows or it will interfere with the next scene. The script will only read that if the "main loop" breaks.
- @window.update updates the window. Wait, we don't have "def update" in our window but no worries, because Window_Base has it.
Calling your Scene...
I know what you are thinking. "How am I suppose to use that to show my window using this script?" Easy, just call it from a different Scene, in this case we will use "Scene_Menu" because most people are familiar with it.
go to line 128 on Scene_Menu, it should look like this;
and change it with
Thats all. Now Test Play and pess ESC and then choose the first option in your menu, which should be "Item" and your window should now appear on screen.
go to line 128 on Scene_Menu, it should look like this;
Code:
$scene = Scene_Item.new
and change it with
Code:
$scene = Scene_ShowWindow.new
Thats all. Now Test Play and pess ESC and then choose the first option in your menu, which should be "Item" and your window should now appear on screen.
Adding Controls to your Scene...
Oh, no, you can't go back to the MENU!!! What WILL WE DO?!?!
Easy, lets just add some controls to your scene, so you can exit it.
Replace you "def update" with the one I will provide below.
Now test play and go to your scene like we did before. Now if you press ESC you will go back to the menu.
Easy, lets just add some controls to your scene, so you can exit it.
Replace you "def update" with the one I will provide below.
Code:
[COLOR=Blue]def [/COLOR]update
[COLOR=Green] # Update windows[/COLOR]
@window.update
[COLOR=Green]# If B button was pressed[/COLOR]
[COLOR=Blue]if [/COLOR]Input.trigger?(Input::B)
[COLOR=Green]# Play cancel SE[/COLOR]
$game_system.se_play($data_system.cancel_se)
[COLOR=Green] # Switch to Menu screen[/COLOR]
$scene = Scene_Menu.new
[COLOR=Blue] return
end[/COLOR]
[COLOR=Blue] end[/COLOR]
- Its best to update windows first.
- if Input.trigger?(Input::B) checks if the key B or ESC has been pressed. RMXP has a weird Input class...
- $scene = Scene_Menu.new calls the menu scene. Now your scene will close because if you remember what we learned earlier;
Code:
[COLOR=Blue]if[/COLOR] $scene != [COLOR=Blue]self[/COLOR]
[COLOR=Blue]break
end
end[/COLOR]
- The variable $scene no longer holds your scene, there for it does not equal "self".
Side Note: != means Not Equals.
Now test play and go to your scene like we did before. Now if you press ESC you will go back to the menu.
Adding more to your window.
Lesson 1
Adding Images to your window
For this chapter you will need this battler;
http://img57.imageshack.us/img57/5812/heroareadyxi4.png
Credit to Ccoa if you plan to use them in your game.
Don't worry about how it will look. I chose that because we will be using it for the next lesson. Put it in your Battlers folder.
Now, replace your window code with this.
Not much changed except "def refresh". Now that will display a picture on your window.
http://img57.imageshack.us/img57/5812/heroareadyxi4.png
Credit to Ccoa if you plan to use them in your game.
Don't worry about how it will look. I chose that because we will be using it for the next lesson. Put it in your Battlers folder.
Now, replace your window code with this.
Code:
[COLOR=Green]
#==============================================================================
# **MyCustomWindow
#==============================================================================[/COLOR]
[COLOR=Blue]class[/COLOR] MyCustomWindow < Window_Base
[COLOR=Green]
#----------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------- [/COLOR]
[COLOR=Blue]def[/COLOR] initialize
[COLOR=Blue]super[/COLOR](0, 0, 640, 480)
[COLOR=Blue]self[/COLOR].contents = Bitmap.new(width - 32, height - 32)
refresh
[COLOR=Blue]end[/COLOR] [COLOR=Green]
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------[/COLOR]
[COLOR=Blue]def[/COLOR] refresh
[COLOR=Blue]self[/COLOR].contents.clear
[COLOR=Blue]self[/COLOR].contents.font.color = normal_color
[COLOR=Blue]self[/COLOR].contents.font.size = 20
cx = contents.text_size("I am TEXT. Obey ME!!").width
[COLOR=Blue]self[/COLOR].contents.draw_text(width/3, height/3+100, cx, 32, "I am TEXT. Obey ME!!")
[COLOR=Green]
#Shows the picture on the window
#Stores the picture into the battler[/COLOR]
@bitmap = RPG::Cache.battler("HeroA_ready.png", 0)
[COLOR=Blue]self[/COLOR].contents.blt(width/3, height/3, @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height), 160)
[COLOR=Blue]end[/COLOR]
[COLOR=Blue]end[/COLOR]
Not much changed except "def refresh". Now that will display a picture on your window.
- @bitmap = RPG::Cache.battler("HeroA_ready.png", 0) saves the bitmap to the variable so we can use it esier. I will explain each part.
RPG::Cache lets you access your graphics folder esier. To access a folder in the graphics folder just do;
RPG::Cache.folderName, but remember that this only goes for the default folders in the Graphics folder. If you want to call other foders, you need to edit RPG::Cache class. You can see how it looks like in the help file, just search for it, using search.
In this case we are trying to access the battlers folder;
RPG::Cache.battler, simple. Now to access an actual battler;
RPG::Cache.battler("HeroA_ready.png", 0), 0 is the Hue. You can change it and the color of the image will change.
Now your picture is called and turned into a bitmap.
- self.contents.blt(width/3, height/3, @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height), 160), displays the picture on the screen. I'll rewrite the code so you can understand better.
Code:
[COLOR=Blue]self.[/COLOR]contents.blt(x, y, bitmap, Rect.new(xr, yr, bitmap_width, bitmap_height), opacity)
- x = x postion of the picture. In this case; we want to place it in the middle so we divide the window's width by 3. width/3.
- y = y postion of the picture. In this case; we want to place it in the middle so we divide the window's height by 3. height/3.
- bitmap = the picture. In this case @bitmap. Remember the picture is saved in the @bitmap variable.
- Rect.new() creates a rectangle around or in the picture. With it you can show part of the picture or the whole picture by changing the variables in it.
- xr = The x position of the rectangle.
- yr = The y position of the rectangle.
- bitmap_width = width of the rectangle. In this case the width of the picture. @bitmap.width.
- bitmap_height = height of the rectangle. In this case the height of the picture. @bitmap.height.
We will use the rect.new again in the next lesson to animate the picture.
Now take a test play. I changed text position too.
Adding animated images to your window...
Note:
The following uses the battler from the last lesson.
I referenced ccoa's animation engine from her CBS for this. I edited to make it work for use.
Replace your window code, again, with the following code;
The animation engine can easily be edited. I was first going to use RMXP's animation engine but I prefer more frames over directions. I'll make Lesson for using RMXP's animation engine too. Anyways, lets get to explaining;
• Remember what I said about @frame_count? We are using it here;
[*]As you can see that checks if the 10 frames(1 sec) passed and if it did passed;
• As you can see, we save the current frame again so we can check the difference again.
• We also create the rect.new in a variable(rect) instead of the command;
This is because it would be too messy to do so in that command.
• The size and the position of the rectangle on the picture changes as the variables in it change.
• Like I said earlier the rectangle class can show the image as a whole or part of it.
• @frame += 1 increases the current frame.
•if @frame == @frames, checks if the current frame equals the picture's frames.
• if it is it resets the current frame by making it 0
• the following happes if 10 frames didn't past from the last animation;
I hope you learned something. I know this was a little advanced but I hope you understood something.':|
The following uses the battler from the last lesson.
I referenced ccoa's animation engine from her CBS for this. I edited to make it work for use.
Replace your window code, again, with the following code;
Code:
[COLOR=Green]
#==============================================================================
# **MyCustomWindow
#==============================================================================[/COLOR]
[COLOR=Blue]class[/COLOR] MyCustomWindow < Window_Base
[COLOR=Green]
#----------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------- [/COLOR]
[COLOR=Blue]def[/COLOR] initialize
[COLOR=Blue]super[/COLOR](0, 0, 640, 480)
[COLOR=Blue]self[/COLOR].contents = Bitmap.new(width - 32, height - 32)
[COLOR=Green]#Create the needed variables[/COLOR]
@frame = 0
@frames = 0
@frame_count = Graphics.frame_count
@frame_width = 0
@frame_height = 0
[COLOR=Green]#Stores the picture into the battler[/COLOR]
@bitmap = RPG::Cache.battler("HeroA_ready.png", 0)
[COLOR=Green]#Gets the bitmap frames and settings[/COLOR]
get_settings
[COLOR=Green]#update[/COLOR]
update
[COLOR=Blue]end[/COLOR] [COLOR=Green]
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------[/COLOR]
[COLOR=Blue]def[/COLOR] update
[COLOR=Blue]self[/COLOR].contents.clear
[COLOR=Blue]self[/COLOR].contents.font.color = normal_color
[COLOR=Blue]self[/COLOR].contents.font.size = 20
cx = contents.text_size("I am TEXT. Obey ME!!").width
[COLOR=Blue]self[/COLOR].contents.draw_text(width/3, height/3+100, cx, 32, "I am TEXT. Obey ME!!")
[COLOR=Green]#Gets the current time difference[/COLOR]
time = Graphics.frame_count - @frame_count
[COLOR=Blue]if[/COLOR] time >= 10
[COLOR=Green] #Save the current frame count[/COLOR]
@frame_count = Graphics.frame_count
[COLOR=Green]#Get the next frame[/COLOR]
rect = Rect.new(@frame * @frame_width, 0, @frame_width, @frame_height)
[COLOR=Green]#Displays the image[/COLOR]
[COLOR=Blue]self[/COLOR].contents.blt(width/3, height/3, @bitmap, rect, 160)
[COLOR=Green]#Increase the current frame[/COLOR]
@frame += 1
[COLOR=Green]# if its the end of the frame[/COLOR]
[COLOR=Blue]if[/COLOR] @frame == @frames
@frame = 0
[COLOR=Blue]end[/COLOR]
[COLOR=Blue] else[/COLOR] [COLOR=Green]#if its the same frame;[/COLOR]
[COLOR=Green]#Get the next frame[/COLOR]
rect = Rect.new(@frame * @frame_width, 0, @frame_width, @frame_height)
[COLOR=Green]#Displays the image[/COLOR]
[COLOR=Blue]self[/COLOR].contents.blt(width/3, height/3, @bitmap, rect, 160)
[COLOR=Blue]end[/COLOR]
[COLOR=Blue]end[/COLOR]
[COLOR=Green] #--------------------------------------------------------------------------
# * Get Settings
#--------------------------------------------------------------------------
[/COLOR] [COLOR=Blue]def[/COLOR] get_settings
[COLOR=Green]#Gets the number of frames from the image[/COLOR]
@frames = @bitmap.width / @bitmap.height
[COLOR=Green]#Get's the frame height[/COLOR]
@frame_height = @bitmap.height
[COLOR=Green]#Get's the frame width;[/COLOR]
@frame_width = @bitmap.width / @frames
[COLOR=Blue]end[/COLOR]
[COLOR=Blue]end[/COLOR]
The animation engine can easily be edited. I was first going to use RMXP's animation engine but I prefer more frames over directions. I'll make Lesson for using RMXP's animation engine too. Anyways, lets get to explaining;
- As you can see we added some new variables to "def initialize". Its best to define your varialbes so that you know what variables we will see in the script.
- We also moved @bitmap to "def initialize". I did this to avoid errors.
- One particular variable stands out tho;
@frame_count = Graphics.frame_count
We did that to save the current frame count. 10 frames = 1 second, do the math. We use it to check the difference between the current frame count and the laset saved frame count. - We are also calling a new function "def get_settings" using "get_settings" in "def initialize".
- get_settings just gets the;
- @frames = how many frames are there in the picture.
- @frame_height = The height of the frame, in this case the picture.
- @frame_width = This is the width of all the frames, seperate not togather.
- get_settings just gets the;
- Now you can also see, we changed the refresh function to update function because we want it to be updated everframe. If you remember our previous lessons, I said that our window class didn't have a update function but it wouldn't matter because the parent class has it. We changed refresh to update for this reason, its just esier.
- The update function now has more code. Lets see what it is;
Code:
[COLOR=Green]#Gets the current time difference[/COLOR]
time = Graphics.frame_count - @frame_count
[COLOR=Blue]if[/COLOR] time >= 10
[COLOR=Green] #Save the current frame count[/COLOR]
@frame_count = Graphics.frame_count
[COLOR=Green]#Get the next frame[/COLOR]
rect = Rect.new(@frame * @frame_width, 0, @frame_width, @frame_height)
[COLOR=Green]#Displays the image[/COLOR]
[COLOR=Blue]self[/COLOR].contents.blt(width/3, height/3, @bitmap, rect, 160)
[COLOR=Green]#Increase the current frame[/COLOR]
@frame += 1
[COLOR=Green]# if its the end of the frame[/COLOR]
[COLOR=Blue]if[/COLOR] @frame == @frames
@frame = 0
[COLOR=Blue]end[/COLOR]
[COLOR=Blue] else[/COLOR] [COLOR=Green]#if its the same frame;[/COLOR]
[COLOR=Green]#Get the current frame[/COLOR]
rect = Rect.new(@frame * @frame_width, 0, @frame_width, @frame_height)
[COLOR=Green]#Displays the image[/COLOR]
[COLOR=Blue]self[/COLOR].contents.blt(width/3, height/3, @bitmap, rect, 160)
[COLOR=Blue]end[/COLOR]
Code:
[COLOR=Green]#Gets the current time difference[/COLOR]
time = Graphics.frame_count - @frame_count
- That takes the current frame difference. We want it to be 10 or more because;
Code:
[COLOR=Blue]if[/COLOR] time >= 10
Code:
[COLOR=Green] #Save the current frame count[/COLOR]
@frame_count = Graphics.frame_count
[COLOR=Green]#Get the next frame[/COLOR]
rect = Rect.new(@frame * @frame_width, 0, @frame_width, @frame_height)
[COLOR=Green]#Displays the image[/COLOR]
[COLOR=Blue]self[/COLOR].contents.blt(width/3, height/3, @bitmap, rect, 160)
[COLOR=Green]#Increase the current frame[/COLOR]
@frame += 1
[COLOR=Green]# if its the end of the frame[/COLOR]
[COLOR=Blue]if[/COLOR] @frame == @frames
@frame = 0
[COLOR=Blue]end[/COLOR]
• We also create the rect.new in a variable(rect) instead of the command;
Code:
[COLOR=Blue]self[/COLOR].contents.blt(width/3, height/3, @bitmap, rect, 160)
• The size and the position of the rectangle on the picture changes as the variables in it change.
• Like I said earlier the rectangle class can show the image as a whole or part of it.
• @frame += 1 increases the current frame.
•if @frame == @frames, checks if the current frame equals the picture's frames.
• if it is it resets the current frame by making it 0
• the following happes if 10 frames didn't past from the last animation;
Code:
[COLOR=Blue] else[/COLOR] [COLOR=Green]#if its the same frame;[/COLOR]
[COLOR=Green]#Get the next frame[/COLOR]
rect = Rect.new(@frame * @frame_width, 0, @frame_width, @frame_height)
[COLOR=Green]#Displays the image[/COLOR]
[COLOR=Blue]self[/COLOR].contents.blt(width/3, height/3, @bitmap, rect, 160)
[COLOR=Blue]end[/COLOR]
- This is so the animation doesn't flicker. It just displays the last frame and thats.
I hope you learned something. I know this was a little advanced but I hope you understood something.':|
Chapter 4
Making a Custom Menu...
Lesson 1
Understanding Window_Command...
To make a menu, you usually need Window_Command. I wouldn't really call it Window_Command, I would call it Window_Menu but hey, i didn't make RMXP.
Window_Command is really easy to use, the following is in Scene_Menu;
I know you are confused, but i will explain;
@command_window.update
and disposed;
@command_window.dispose
You should know where to place those . I've explained it in Chapter 2, Lesson 1.
I will finish this tutorial slowly. 1 lesson at a time. So thats it for now.
Window_Command is really easy to use, the following is in Scene_Menu;
Code:
s1 [COLOR=LightBlue]=[/COLOR] $data_system.words.item
s2 [COLOR=LightBlue]=[/COLOR] $data_system.words.skill
s3 [COLOR=LightBlue]=[/COLOR] $data_system.words.equip
s4 [COLOR=LightBlue]=[/COLOR] [COLOR=DarkOrchid]"Status"[/COLOR]
s5 [COLOR=LightBlue]=[/COLOR] [COLOR=DarkOrchid]"Save"[/COLOR]
s6 [COLOR=LightBlue]=[/COLOR] [COLOR=DarkOrchid]"End Game"[/COLOR]
@command_window [COLOR=LightBlue]=[/COLOR] Window_Command[COLOR=LightBlue].[/COLOR]new([COLOR=Red]160[/COLOR], [s1, s2, s3, s4, s5, s6])
- s1 = $data_system.words.item
- s1 is just a variable, its nothing special. Its for convinience and cleaner code.
- $data_system.words is also a variable but it is special.It has a list of commands, like you see above "$data_system.words.item". For a full list, go to RMXP's help file and using search look for RPG::System::Words.
- The s1, s2, s3, ect. varaible are just for cleaner code, which is good. They are used to store the commands, so they can be used later.
- @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
- In the previous lessons we called our window with; @window = MyCustomWindow.new ; this is nothing different, we call the Window_Command the same way except with a little extra.
- (160, [s1, s2, s3, s4, s5, s6])
- 160 is just the width of your window. The height is determined by the number commands * 32.
- [s1, s2, s3, s4, s5, s6] is an array of variables(commands). If you want more commands, you just add it there. ,s7 and so on.
@command_window.update
and disposed;
@command_window.dispose
You should know where to place those . I've explained it in Chapter 2, Lesson 1.
I will finish this tutorial slowly. 1 lesson at a time. So thats it for now.
Lesson 2
Using Window_Command...
Chapter 5
Using Window_Selectable...
Lesson 1
Understanding Window_Selectable...
coming soon...
Lesson 2
Using Window_Selectable in your CMS...
coming soon...
Chapter 6
Extending your menu with a status window with what we learned and extending the usage of rectangle class...
coming soon...
[/CENTER]