ReKordChoices VX
ReKordChoices VXby Kyonides
Introduction
This scriptlet allows you to auto-select 2 game variables that will store the choices list ID for the selected event page and the number of times you have selected a given option.
The value of that game variable will get updated automatically every time you pick any of the available choices.
The Script
Code:
# * ReKordChoices VX + ACE * #
# Scripter : Kyonides Arkanthes
# 2024-10-08
# This scriptlet allows you to auto-select 2 game variables that will store
# the choices list ID for the selected event page and the number of times you
# have selected a given option.
# The value of that game variable will get updated automatically every time
# you pick any of the available choices.
# * Script Calls * #
# Use them to create a new choices list storage or to retrieve its data.
# List of Arguments:
# - ListID stands for Any "String" or Number
# - ChoiceIndex is a Number, 1 through 4
# - EventPage is a Number, 1 through 99 (Maximum Number of Pages)
# get_choice(ListID, ChoiceIndex)
# get_choice(ListID, ChoiceIndex, EventPage)
# get_choice(ListID, ChoiceIndex, EventPage, EventID)
# get_choice(ListID, ChoiceIndex, EventPage, EventID, MapID)
module ReKord
CHOICES_LIST_VAR_ID = 5
CHOICES_TIMES_VAR_ID = 6
class GameChoices
def initialize
@data = {}
@data.default = 0
end
def [](key)
@data
end
def increase(key)
@data += 1
end
attr_reader :data
end
end
class Game_Variables
alias :kyon_rekord_choices_gm_var_init :initialize
def initialize
kyon_rekord_choices_gm_var_init
@choice_data = {}
end
def find_choice_set(map_id, event_id, page_index, list_index)
@choice_data ||= {}
key =
@choice_data ||= ReKord::GameChoices.new
end
def set_choice_vars(choice_index, total)
@data = choice_index
@data = total
end
def choice(map_id, event_id, page, list_index, choice_index, go_up)
choices = find_choice_set(map_id, event_id, page, list_index)
choices.increase(choice_index) if go_up
set_choice_vars(choice_index, choices)
end
end
class Game_Event
def page_index
@event.pages.index(@page)
end
end
class Game_Interpreter
alias :kyon_rekord_choices_int_cmd_402 :command_402
def command_402
if @branch[@indent] == @params
map_id = $game_map.map_id
page = $game_map.events[@event_id].page_index
list = $game_variables
choice = @params + 1
$game_variables.choice(map_id, @event_id, page, list, choice, true)
end
kyon_rekord_choices_int_cmd_402
end
def get_choice(list, choice_index, page=nil, ev_id=nil, map_id=nil)
map_id ||= $game_map.map_id
ev_id ||= @event_id
page = page ? page - 1 : $game_map.events.page_index
$game_variables.choice(map_id, ev_id, page, list, choice_index, nil)
end
end
DOWNLOAD DEMOS
Terms & Conditions
Free for use in ANY game.
Due credit is mandatory!
Mention this forum in your game credits.
That's it!
data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/rekordchoices-vx.172484/
页:
[1]