This script provides a custom event (as in, event-driven programming) for 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
Get it at
Hime Works!
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) endIt takes some text and displays it in a gab window.We have a list of choices:
Code:
Let's have each option display the option you have selected in a gab window
Code:
- 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 options, you will see the gab window showing the appropriate text depending on which choice you have highlighted.
本贴来自国际rpgmaker官方论坛作者:Tsukihime处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/choice-move-handlers.16200/