Add Command or Drawing Commands

Before I draw out my problem, I have to point out that this was taken from my past request:

http://forums.rpgmakerweb.com/index.php?/topic/24543-confused-about-modules/

which was solved by Engr. Shana. The thing I am wondering now that i can access the modules was if there is a way to draw them via a command easily rather than doing this way:

#-------------------------------------------------------------------------- # * Add Main Commands to List #-------------------------------------------------------------------------- def add_main_commands add_command(Vocab::item, :item, main_commands_enabled) add_command(Vocab::skill, :skill, main_commands_enabled) add_command(Vocab::equip, :equip, main_commands_enabled) add_command(Vocab::status, :status, main_commands_enabled) endI duplicated the whole Menu Command for this by the way. I made some new commands of my own that I wanted to use. However, it seems to take a lot of time adding commands this way (I feel it that way though).

So I came across:

module Heartfire MENU_NAMES= ["Pride","Sloth","Envy"]endto start with in my module. I created a new window:

class Window_Sins< Window_Base def initialize super(0,0,Graphics.width,Graphics.height) refresh endendrespectively. Now, supposing I want to create a window that would display the commands 

  • Pride
  • Sloth
  • Envy
or everything that has to do with the names array (and probably a hash of their methods)

Menu_Methods = {1 => 😛ride,2 => :sloth,3 => :envy}is there a way to draw them easier rather than doing add_command?

Someone told me to use draw method but I am clueless how to do so.
First and foremost, are they commands? coz if they are then you really need to use the same way the other commands are made... if they're just simple texts, just use any of the draw_text method variations...
I was wanting to make them as commands. For example, I have an array of the names of the commands:

menu_names = ["Pride", "Sloth", "Envy", "Gluttony", "Greed", "Lust", "Wrath"]and I have commands with them in hash style.

So, when I want to have them in the window, i wanted to draw them as commands as well (just taking out the name and command through hash values).

However, I want it where all these commands (rather than using add_command method), all of these commands are drawn in the window.
Well, you can draw them using the draw_text, but if you want them to function as commands, you'd really need to register them to the window as commands so you'd most probably be better off just using add_command...

take note though that Window_Base doesn't use commands, commands are from Window_Command

you can always just loop the command name array so that anything you add inside will automatically be added to the commands

also arrays start at 0

Code:
HeartFire.MENU_NAMES.each_index {|key| com=HeartFire.MENU_NAMES[key];add_command(com,   com.to_sym,   HeartFire.Menu_Methods[key+1])}
Oh, that's neat. That means I can draw everything I added as a command on the module, am I right?
yes since you're looping the whole array... but right now I'm not sure if the last parameter will work (the one for the method to be fired when the command is used)
I'll try it out first.

Edit, how about the set_handler? How can i loop it?

the ones you gave me worked.
just do it like this one, but use set_handler instead of add_command this time, I think...


PS: ah wait, the last parameter for add_command is for checking if the command is enabled or not, you should change it to true... XD
oh okay I will, yeah I did follow it and it works 😀

Original thread: https://forums.rpgmakerweb.com/threads/add-command-or-drawing-commands.24564/