Choice-Move Handlers
This script provides a custom event (as in, event-driven programming) or choice windows called an “on cursor move” event. This event is triggered whenever the choice
window cursor changes to a different option.
You can attach handlers to this event that will be fired whenever the event
is triggered. Each handler holds a method and a set of arguments, and when
the handler is called, it will pass the arguents to the method and call the
method.
This script does not support changing scenes such as opening the party
menu or save menu.
Download
The demo shows a very simple use of on-cursor-move event handlers. It simply displays what your current selection is.
Installation
Place this script below Materials and above Main.
Usage
To assign an event handler, use the script call
choice_move_handler(choice_num, method_name, arg1, arg2, ... )
Where
choice_num
is the number of the choice you want to assign this handler
to. 1 is the first choice.
method_name
is the name of the method that will be called when this
handler is called.
arg1, arg2, ...
are the arguments that will be passed to your method
when the handler is called.
You should have methods defined in Game_Interpreter for user convenience.
Example
Suppose we have the following method:
def show_gab(text) gab("Your selected choice is: %s" %text, 0) end
It takes some text and displays it in a gab window.
We have a list of choices:
One Two Three
Let’s have each option display the option you have selected in a gab window
choice_move_handler(1, :show_gab, "One") choice_move_handler(2, :show_gab, "Two") choice_move_handler(3, :show_gab, "Three")
When you run the event and scroll through the choices, you will see the numbers
printed to console as expected.
I love the idea of this script, but unlike Larger Choices and Choice Options, I can only seem to get this to work when the script call is immediately above the choices in the window. If I wanted to attach the choice windows to a message, I have to put the script call in between them, spliting the message and the choices, where as with the other choice scripts they can precede the message and still take effect. I know this is a long shot, but any hints on a work around? You do amazing work!