Why does this line of script return an error...
class Rime_Menu_Commands < Window_Command def initialize x = 544/2 - window_width/2 y = 416/2 - window_height/2 super(x, y) endendwhile...
class Rime_Menu_Commands < Window_Command def initialize x = 544/2 - window_width/2 y = 100 super(x, y) endend..this doesn't?
The error that arises comes from not being able to find the size method from Line 41 of Window_Command. Though the script works fine is you substitute y with a flat number instead of using window_height. Does this occur because the @list array has no size yet because it hasn't been populated by the add_commands?
Window_Command's window_height
● ARCHIVED · READ-ONLY
-
-
@list is currently nil
Even if it's not nil, the size itself might 0 -
Is there any way to add_command to the list before the window is created?
-
You cannot add a command if the command window itself isn't yet created, you can do it inside initialize though... If you want to use the height for the y, you'd need to make the height use a different computation... Or adjust the y once the window is already created
-
Solved by populating the @list array before the window itself is created through the super method. Thank you TheoAllen and Engr. Adiktuzmiko :)
Code:class Rime_Menu_Commands < Window_Command def initialize clear_command_list make_command_list x = 544/2 - window_width/2 y = 416/2 - window_height/2 super(x, y) endend