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
This script does not support changing scenes such as opening the party
menu or save menu.
The demo shows a very simple use of on-cursor-move event handlers. It simply displays what your current selection is.
Place this script below Materials and above Main.
To assign an event handler, use the script call
choice_move_handler(choice_num, method_name, arg1, arg2, ... )
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.
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.