I clearly don't "get" handlers and ChoiceList

Right... lets try this once more...

I've been trying to code a custom Character Class Change scene, based on what I see in things like Scene_Equip and Scene_Status. It's working pretty well but I simply cannot figure one thing out. I have a handler that is processed after a class is chosen, and I want to put a message box and an "are you sure?" choice in there. Character classes in my game are exclusive - characters A and B cannot both be white mages at the same time, so their classes are swapped if they try to be and the player needs to be notified.

Calling the class change screen though the menu, picking a class and changing the character's class are all working perfectly, it's the confirmation window and message window that are causing problems.

Here is the class change scene class, where I think the problem probably lies.

class Scene_Class < Scene_MenuBase  #--------------------------------------------------------------------------  # * Start Processing  #--------------------------------------------------------------------------  def start    super    create_class_window  end  #--------------------------------------------------------------------------  # * Create Class Window  #--------------------------------------------------------------------------   def create_class_window    @class_window = Window_ChangeClass.new(0,0,@actor)    @class_window.viewport = @viewport    @class_window.set_handler🙂ok,       method🙂on_changeclass))    @class_window.set_handler🙂cancel,   method🙂on_cancel))    @alert_window = Window_Message.new    @alert_window.viewport = @viewport  end   #--------------------------------------------------------------------------  # * on Change Class  #--------------------------------------------------------------------------   def on_changeclass    # occupied contains the actor id of another actor who has this class, or -1 if none    occupied = @class_window.occupied?    if (occupied >= 0)      otherone = $game_party.members[occupied]      @alert_window.activate      $game_message.add(otherone.name + " is already a using this orb. Her class will be\nchanged. Proceed?") # HERE. I WANT TO PUT A YES/NO BOX HERE. NOTHING WORKS.     else      @actor.change_class(@class_window.targclass?,true)      @class_window.activate    end  end    def on_cancel    return_scene  end 

I did see this code in another support thread, and tried it, but it crashes on the last line. I assume because it needs to go through an interpreter I can't access here?

 

Code:
params = []choices = []choices.push("Yes")choices.push("No")params.push(choices)params.push(1)setup_choices(params)
I don't anticipate it's the problem (or at least not the problem I'm thinking of) but here is a pastebin of Window_ChangeClass too. As far as I can tell this is all WAI.

I'm sure it's a lot of work deciphering my insane code, but any help or just a "forget about it" would be greatly appreciated, thanks.
So, if you already made a window where you can select a class, make another window like it that says Yes or No, activate that for the player to choose, have the message about a duplicate class, and then do it that way? It's much simpler and easier to do something a way you've already done and know works.
Huh... yeah, makes sense. I think I've got a bit hung up on trying to do it with the already existing choice window.

Thanks for the perspective, that's likely to be a lot easier than whatever the hell I was thinking of.
I wouldn't use the the default Window_ChoiceList since it was made for the interpreter.
Hint for anyone who passes though here in the future...

If you want to display a message in menus, doing it in a Window_Help and not a Window_Message is a LOT easier too.

Anyway, this is fixed. Thanks!

Original thread: https://forums.rpgmakerweb.com/threads/i-clearly-dont-get-handlers-and-choicelist.17375/