I'm extending the Window_Command class to show a list of topics the player can browse through - you select a command and it pulls up a new window with detailed information on what that command does. However, I've got a few problems with it...
http://i192.photobucket.com/albums/z164 ... 2_4942.jpg[/IMG]
The text doesn't align properly, or parse newline characters the way I want it to. These two are probably related, since my strings are pretty long with newline characters every 42 characters (or less). Text should be in the top-right corner, and there should be a newline before every number. Also, note that the super-cool selection box is overlapping onto my new window.
Also,
http://i192.photobucket.com/albums/z164 ... 2_4947.jpg[/IMG]
The window doesn't go away when it should!
Here's a look at my script. It takes the command index in, and looks up the appropriate text in an array. For debugging purposes, I've just set @display to default text that showcases my problems. I'm sure that I've made a host of stupid mistakes, partially because I'm still trying to figure out scoping in Ruby and partially because all of the code I've put together is hacked from existing game code and what relevant tutorials I've found floating around these forums.
http://i192.photobucket.com/albums/z164 ... 2_4942.jpg[/IMG]
The text doesn't align properly, or parse newline characters the way I want it to. These two are probably related, since my strings are pretty long with newline characters every 42 characters (or less). Text should be in the top-right corner, and there should be a newline before every number. Also, note that the super-cool selection box is overlapping onto my new window.
Also,
http://i192.photobucket.com/albums/z164 ... 2_4947.jpg[/IMG]
The window doesn't go away when it should!
Here's a look at my script. It takes the command index in, and looks up the appropriate text in an array. For debugging purposes, I've just set @display to default text that showcases my problems. I'm sure that I've made a host of stupid mistakes, partially because I'm still trying to figure out scoping in Ruby and partially because all of the code I've put together is hacked from existing game code and what relevant tutorials I've found floating around these forums.
PHP:
class Repository_Topics < Window_Base
def initialize(i)
height = 448 #max number of lines * 32
@display = "1blah blah blah blah \n 2blah blah blah\n 3blah"
super(160,0, 42*8, 448)
self.contents = Bitmap.new(42*8 - 32, 448 - 32)
refresh
end
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = 20
self.contents.draw_text(0, 0, 42*8, 448, @display)
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
self.dispose
end
end
end