Hey! :D
I have a quick quesiton: how about a script for Rpg maker XP (maybe it would work for other Makers too) that would allow player to choose the choice option using the keyboard button? Im talking particularly about the digits, meaning - pressing '1' button would mean choosing the first option, pressing '2' the second one, and so on. At the moment only 'Esc' is supported, the rest is about pressing arrow key and then Enter, but it means that Ruby would accept other keyboard buttons as well.
It would be nice to include the numeric keypad in it, not only the usual digit buttons above letters. Also it would be nice to consider the fact that some people are using custom Message systems which allow making more than 4 choice options, like UMS by Ccoa for example. Because of this, supporting not only four but all digits - from 1 to 9 - would be the best! :)
I made some search for it on the internet, but with no effect. :/
Since im no scripter id like to now ask someone, very kindly, to create such script and share it here. Scripters, could anyone of you help me with this? Please! :D
Basically only needs to use the Custom Game Controls script in ToA. Do you want this to only work with 'Show Choices' in the message window?
Yeah, i think so, i had no other uses for this on my mind.
And I never thought about Tons of addons, it always scared me because it has so many scripts in it. :^_^':
Requires
Custom Game Controls. This needs to be placed below it.
class Window_Message < Window_Selectable
alias update_after_num_keys update
def update
if @contents_showing and $game_temp.choice_max > 0
(49..57).each{|input|
if Input.trigger?(input) and $game_temp.choice_max > input - 49
@index = input - 49
$game_system.se_play($data_system.decision_se)
$game_temp.choice_proc.call(self.index)
terminate_message
break
end
}
numpad = [35,40,34,37,12,39,36,38,33]
numpad.each_index{|i|
input = numpad[i]
if Input.trigger?(input) and $game_temp.choice_max > i
@index = i
$game_system.se_play($data_system.decision_se)
$game_temp.choice_proc.call(self.index)
terminate_message
break
end
}
end
update_after_num_keys
end
end
The problem with making this compatible with other message systems is that they all follow their own set of rules on how to handle the message window's controls. For example, in the default scripts, the variable
$game_temp.choice_max is set to equal the number of choices the player can make. I recall seeing in a message script that this variable is set to zero before the choices were drawn. This script would not work since it now thinks that there are no choices being shown.
EDIT: I just realized that the Arrow Keys and the NumberPad's 2,4,6,8 share the same input values. It might be best to not use the NumberPad at all.
class Window_Message < Window_Selectable
alias update_after_num_keys update
def update
if @contents_showing and $game_temp.choice_max > 0
(49..57).each{|input|
if Input.trigger?(input) and $game_temp.choice_max > input - 49
@index = input - 49
$game_system.se_play($data_system.decision_se)
$game_temp.choice_proc.call(self.index)
terminate_message
break
end
}
end
update_after_num_keys
end
end
So no chances for this being compatible with Ccoa's UMS? :( :(
At the moment it shows error with "no implicit conversion from nil to integer" in Window Message's line:
self.cursor_rect.set(8, n * 32, @cursor_width, 32)
Anyway, if anyone would be kind and scriptly-skilled (is that even a word? :D) enough to inspect it, a demo with her UMS v. 1.8 can be found here:
http://www.mediafire.com/download/z3fzwx0ywyt/UMS.rar
And even if that wont happen, the current code at least works well with standard message system... so thank you KK20. :)
Yeah, pretty much. Like I said, most (if not all) custom message scripts handle things differently from the way the default RMXP scripts handle messages. There is no universal, one script fix that will work for all message systems. It's like trying to add the ability 'Steal Items' that will work for all battle systems...not gonna happen.
I can probably get this compatible with Ccoa's.
Could you? :D Great! I hope you will manage to do it. :)
#//////////////////////////////
# Ccoa UMS Fix
#//////////////////////////////
class Window_Message < Window_Selectable
alias update_after_num_keys update
def update
if @choice_window.active and @contents_showing and $game_temp.choice_max > 0 and !(@wait > 0)
(49..57).each{|input|
if Input.trigger?(input) and $game_temp.choice_max > input - 49
@choice_window.index = input - 49
$game_system.se_play($data_system.decision_se)
$game_temp.choice_proc.call(@choice_window.index)
terminate_message
@done = true
$game_system.slave_windows.each_value { |window|
window.write_all
if !window.done
@done = false
end
}
if @done
if $game_temp.choice_max > 0
$game_system.se_play($data_system.decision_se)
$game_temp.choice_proc.call(@choice_window.index)
end
terminate_message
else
@finishing_up = true
end
end
}
end
update_after_num_keys
end
end
Thank you! :up: