Main‎ > ‎

Menu system mouse implementation for the default scripts

posted Nov 13, 2011, 3:15 AM by Zeriab NA
I cleaned up my event-driven mouse implementation in the default scripts I presented a long time ago. You can download the demo here:
This does not add any functionality to click on the map except choices in the message window.

I will not present a modular script since this is highly integrated into the default scripts. Instead I have tried a different concept where I have placed all the copy-paste code just above main. (Except my attr_sec_reader and F12 fix, the latter which must be the first section)
I have marked the default script sections I have edited with a * in front of it's name. In those sections I have tagged the code I have removed with <REMOVE> using comment blocks and I have tagged the code I have added with <ADD> and </ADD>.
I could have been more precise showing more exactly what I have added/removed with my code tags but I decided to only doing whole line add and removal as that's easier understand.
Here is an example:

   if Input.trigger?(Input::C)
=begin  <REMOVE>
      # If equipment is fixed
      if @actor.equip_fix?(@right_window.index)
        # Play buzzer SE
      # Play decision SE
      # Activate item window = false = true
      @item_window.index = 0
      ##  <ADD>
      ##  </ADD>

You can remove the code tags if you want. It is after all just comments. I do think having them makes it easier to understand both what code I have touched and why. In this case I refactored the removed code into the right_trigger method which I then can easily call with the right mouse event.

With my script you will have to custom script the mouse functionality to most interactive menu customization. That is a cost of using this script. On the bright side you get more stability and are able to distinguish between clicking left clicking and pressing enter. (A common mistake by other mouse implementations I have seen. I don't really know why though)