Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[RESOLVED] Window-in-Window / Window Overlapping

So I'm teaching myself how to use RGSS by messing around with my project's menu system. I've successfully switched around some of the options (status is now the first choice) after much trial and error, and resisted posting a thread after telling myself I could figure it out. I persisted and got it.

So then I had the idea to make it so I could get to the equipment screen by pressing the C button from the status screen. I got that to work after some trial and error (learned that classes must be case sensitive!). Well, instead of that I would like a tiny sub-menu to pop up when pressing C, that gives you two or more choices (like equipment and skills).

I'm having trouble figuring out how to make a new window in this manner, though. Can it even be done? Please don't post the code for me, I'd like to be able to figure this out on my own. A simple 'yes' or 'no' would do, as well as maybe a link to a good tutorial (the CMS tutorial in the archive doesn't really explain windows in this way). Thanks for your time!

edit: also, would it be easier or possible at all to do this with SDK 2.4? i should have mentioned that i'm currently not using any scripts other than what i'm modifying.

UPDATE 11/14/08 7:30PM EST: I'm able to get a window to pop up over another window, but now I'm having trouble with the opacity of it. Here is a picture of what I've got right now.

http://farm4.static.flickr.com/3151/3030180963_692aeec577_o.jpg[/img]

I've recently discovered these properties of the Window class:

opacity
The window's opacity (0-255). Values out of range are automatically corrected.

back_opacity
The window background's opacity (0-255). Values out of range are automatically corrected.

contents_opacity
The opacity of the window's contents (0-255). Values out of range are automatically corrected.


I'm pretty sure one, some, or all of these is what I'm looking for. I just don't know where to put them or how to really use them. I've tried many different placements but I just can't get the text from the window underneath to stop bleeding through..

RESOLVED on 11/15/08: In addition to x and y coordinate, windows/bitmaps/etc have a zcoordinate. The higher the z coordinate, the closer that item will move towards you (meaning it will be on top of other windows), the lower the z coordinate, the further away that item will move from you (meaning it will be UNDER other windows/bitmaps/etc).

From the help file for the class Window:

Propertieswindowskin
Refers to the bitmap (Bitmap) used as a windowskin.

contents
Refers to the bitmap (Bitmap) used for the window's contents.

stretch
The wallpaper display method. If TRUE, stretches the wallpaper graphic; if FALSE, tiles it. The default value is TRUE.

cursor_rect
The cursor box (Rect). Sets the window's upper left corner using relative coordinates (-16, -16).

active
Cursor blink status. If TRUE, the cursor is blinking.

visible
The window's visibility. If TRUE, the window is visible.

pause
The pause graphic's visibility. This is a symbol that appears in the message window when waiting for the player to press a button. If TRUE, the graphic is visible.

x
The window's X-coordinate.

y
The window's Y-coordinate.

width
The window's width.

height
The window's height.

z
The window's Z-coordinate. The larger this value, the closer to the player the window will be displayed. If multiple objects share the same Z-coordinate, the more recently created object will be displayed closest to the player. The Z-coordinate of the window's contents equals the window background's Z-coordinate plus 2.


ox
The X-coordinate of the starting point of the window's contents. Change this value to scroll the window's contents.

oy
The Y-coordinate of the starting point of the window's contents. Change this value to scroll the window's contents.

opacity
The window's opacity (0-255). Values out of range are automatically corrected.

back_opacity
The window background's opacity (0-255). Values out of range are automatically corrected.

contents_opacity
The opacity of the window's contents (0-255). Values out of range are automatically corrected.


Thanks for the help, Arbiter!
 
Thanks for the reassuring reply!

2. You need to call the new command window to the class/scene in question (ie. if from main menu call from Scene_Menu @window = Window.new)
It'll be happening while at the status screen, not the menu screen (from what i can remember, what i want done was also done in FFVII, and also in EarthBound to view a character's PSI abilities from the status menu), but I think I get what you're saying.

3. You need to make it so the window you want popping up isn't visible and isn't active until you press C on the command in question (eg. equipment).
THAT'S the part I'm having the most trouble with. As of right now I have no idea how to do this, and I couldn't find any already existing examples of a window that is hidden but then pops up on top of the current menu. Which menu has something like this? If you can point me in that direction I feel confident that I can make this work.

4. When you have selected the command you need to make the sub-menu visible and active
See my reply to #3 again

I know it may be hard to give me help without posting code, but I do not want anything done for me as I feel I'll never learn anything that way. I want to get better and more serious with this. I'm sure you understand. :)


And about the SDK, I'm basically asking this: Are there certain types of scripts/actions that are easier to make or better implemented when using the SDK? If so, would I still be better off NOT using it since I am new to Ruby?

Thanks again for the help.
 
got it! i now have a sub menu that pops up but as always, there is a new problem that i've been trying to figure out. i can't seem to, though. maybe i'm just being impatient.

okay, so the window is completely translucent! the text behind it (equipment names) appears in the window and gets all garbled with the sub menu's text. how do i make this window opaque? i'll post the code for the sub-menu.

Code:
class Window_StatusSub < Window_Base
  
#----------------------------------------------------------------------
# * Object Initialization
#----------------------------------------------------------------------
  
def initialize
  super (100, 100, 400, 200)
   self.contents = Bitmap.new(width - 32, height - 32)
  refresh # Calls the refresh function in this class
  end
def refresh
 self.contents.clear
 self.contents.font.color = normal_color
 self.contents.font.size = 20
 cx=contents.text_size("TEST TEST TEST").width
 self.contents.draw_text(50, 50, cx, 32, "TEST TEST TEST")
  # cx =  contents.text_size("TEST TEST TEST").width
 end
end

is it maybe because the status window and the sub-menu window are using the same bitmap? i wish i could figure this out on my own.
 
HAHAHAH i was JUST on my way back to change the thread's title to "RESOLVED".

I just figured out that windows have a Z coordinate. That was my problem, you're 100% correct. It works fine now. Thank you for the help, I'm actually glad it took you a little while to reply. Gave me time to figure it out on my own.

:)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top