-
module CHOICE
NAME = "Choices"
FONT_SIZE = 24
CHOICES1 = "Information1"
CHOICES2 = "Information2"
CHOICES3 = "Information3"
CHOICES4 = "Information4"
CHOICES5 = "Information5"
CHOICES6 = "Information6"
CHOICES7 = "Information7"
CHOICES8 = "Information8"
CHOICES9 = "Information9"
CHOICES10 = "Information10"
CHOICES11 = "Information11"
CHOICES12 = "Information12"
CHOICES13 = "Information13"
CHOICES14 = "Information14"
end
class Window_Choices < Window_Base
include CHOICE
def visible_line_number
14
end
def initialize
super(0, line_height*2, Graphics.width, Graphics.height-line_height*2)
refresh
end
def refresh
contents.clear
contents.font.size = FONT_SIZE
draw_choices(0, 0)
end
end
def draw_choices(x, y)
draw_text(x, y, contents.width, line_height, CHOICES1)
draw_text(x, y + line_height, contents.width, line_height, CHOICES2)
draw_text(x, y + line_height*2, contents.width, line_height, CHOICES3)
draw_text(x, y + line_height*3, contents.width, line_height, CHOICES4)
draw_text(x, y + line_height*4, contents.width, line_height, CHOICES5)
draw_text(x, y + line_height*5, contents.width, line_height, CHOICES6)
draw_text(x, y + line_height*6, contents.width, line_height, CHOICES7)
draw_text(x, y + line_height*7, contents.width, line_height, CHOICES8)
draw_text(x, y + line_height*8, contents.width, line_height, CHOICES9)
draw_text(x, y + line_height*9, contents.width, line_height, CHOICES10)
draw_text(x, y + line_height*10, contents.width, line_height, CHOICES11)
draw_text(x, y + line_height*11, contents.width, line_height, CHOICES12)
draw_text(x, y + line_height*12, contents.width, line_height, CHOICES13)
draw_text(x, y + line_height*13, contents.width, line_height, CHOICES14)
end
# END EDITABLE REGION
class Window_Choices_Title < Window_Base
include CHOICE
def initialize
super(0, 0, Graphics.width, line_height*2)
refresh
end
def refresh
contents.clear
draw_text(0, 0, contents.width, line_height, NAME, 1)
end
end
class Scene_Choices < Scene_Base
def start
super
create_head_window
create_info_window
end
def create_head_window
@language_title = Window_Choices_Title.new
@language_title.viewport = @viewport
end
def create_info_window
@info_window = Window_Choices.new
@info_window.viewport = @viewport
end
def update
super
if Input.trigger?(:B)
Sound.play_cancel
return_scene
end
end
end
I need this script fixed when it's called it will display a window with selectable choices there.
At the moment they can not be selected any.
And I don't know how to make them that way either.
So I am asking those with more experience than me to help out.
And from those selectable choices, let's go with the 'Information1', once it's selected it will call a new scene... like SceneManager.call(Scene_Information1)
.
-
Not really a lot on improvement on your presentation, but I think I've seen this request on various forums without much response. I could be confusing your request with someone else's though.
The reason the window is unable to be selected is because it is not a window that inherits it's methods from the "Window_Selectable" or "Window_Command".
Also the reason why you are probably not receiving a lot of help with your requests is because aside from the poor presentation, the code itself is not really commented at all. That makes it very hard to read and most scripters do not want to spend hours reading through code just to figure out what the problem is.
Here is an example of how much commenting can improve the visual appeal of your code. This is an improve version of your script with some things changed to work.
#==============================================================================
# ** Choice
#------------------------------------------------------------------------------
# This module holds choice scene information.
#==============================================================================
module Choice
# Choices Header
Name = "Choices"
# Choices Font Size
Font_Size = 24
# Choices Information Array
Choices = ["Information1", "Information2", "Information3", "Information4",
"Etc"]
end
#==============================================================================
# ** Window_Choices
#------------------------------------------------------------------------------
# This window is used to display choices in the choices scene.
#==============================================================================
class Window_Choices < Window_Command
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize ; super(0, line_height * 2) end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
def window_width ; Graphics.width end
#--------------------------------------------------------------------------
# * Get Window Height
#--------------------------------------------------------------------------
def window_height ; Graphics.height - (line_height * 2) end
#--------------------------------------------------------------------------
# * Create Command List
#--------------------------------------------------------------------------
def make_command_list
# Add Choice Commands
Choice::Choices.each_with_index {|choice| add_command(choice, :choice, true)}
end
end
#==============================================================================
# ** Centered_Window_Help
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================
class Centered_Window_Help < Window_Help
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Clear Contents
contents.clear
# Draw Text
draw_text(0, 0, contents_width, line_height, @text, 1)
end
end
#==============================================================================
# ** Scene_Choices
#------------------------------------------------------------------------------
# This class contains the choice windows and information.
#==============================================================================
class Scene_Choices < Scene_MenuBase
#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
def start
super
# Create Help Window
create_help_window
# Create Command Window
create_command_window
end
#--------------------------------------------------------------------------
# * Create Help Window
#--------------------------------------------------------------------------
def create_help_window
# Create Help Window
@help_window = Centered_Window_Help.new(1)
# Set Help Window Text
@help_window.set_text(Choice::Name)
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
# Create command window
@command_window = Window_Choices.new
@command_window.viewport = @viewport
# Set Command Window Handlers
@command_window.set_handler(:cancel, method(:return_scene))
@command_window.set_handler(:ok, method(:on_choice_ok))
end
#--------------------------------------------------------------------------
# * [OK] Choice/Command
#--------------------------------------------------------------------------
def on_choice_ok
# From here you can call whatever scene you want to.
# Get Command Window Index
index = @command_window.index
# Get Command Window Current Command name
name = @command_window.command_name(index)
# Show a message box
msgbox "Call your information command here! Current Index is #{index} - #{name}"
# Reactivating window (Not necessary for scene, just to keep testing)
@command_window.activate
end
end
I'm not sure if you're trying to learn how to script or not, but I left the last part of the script up to you just in case.
Have a nice day.
-
I'm not sure if you're trying to learn how to script or not
No, I lack the intelligence to do so at the scripting.
Here's what I did, but I seem to have done something wrong here.
It was supposed to, or at least I tried to make it where it would, that if Information1 was selected it would call Information_A.. same with 2 and B.. 3 and C... you get the idea for it now.
But it didn't do that, and I have no idea why it didn't work either.
Can you fix it where that works?
EDIT : Oops, forgot the code here. Sorry. Putting code now.
#==============================================================================
# ** Choice
# by
# TDS
#------------------------------------------------------------------------------
# This module holds choice scene information.
#==============================================================================
module Choice
# Choices Header
Name = "Choices"
# Choices Font Size
Font_Size = 24
# Choices Information Array
Choices = ["Information1", "Information2", "Information3", "Information4",
"Information5", "Information6", "Information7", "Information8",
"Information9", "Information10", "Information11", "Information12",
"Information13", "Information14"]
end
#==============================================================================
# ** Window_Choices
#------------------------------------------------------------------------------
# This window is used to display choices in the choices scene.
#==============================================================================
class Window_Choices < Window_Command
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize ; super(0, line_height * 2) end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
def window_width ; Graphics.width end
#--------------------------------------------------------------------------
# * Get Window Height
#--------------------------------------------------------------------------
def window_height ; Graphics.height - (line_height * 2) end
#--------------------------------------------------------------------------
# * Create Command List
#--------------------------------------------------------------------------
def make_command_list
# Add Choice Commands
Choice::Choices.each_with_index {|choice| add_command(choice, :choice, true)}
end
end
#==============================================================================
# ** Centered_Window_Help
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================
class Centered_Window_Help < Window_Help
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Clear Contents
contents.clear
# Draw Text
draw_text(0, 0, contents_width, line_height, @text, 1)
end
end
#==============================================================================
# ** Scene_Choices
#------------------------------------------------------------------------------
# This class contains the choice windows and information.
#==============================================================================
class Scene_Choices < Scene_MenuBase
#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
def start
super
# Create Help Window
create_help_window
# Create Command Window
create_command_window
end
#--------------------------------------------------------------------------
# * Create Help Window
#--------------------------------------------------------------------------
def create_help_window
# Create Help Window
@help_window = Centered_Window_Help.new(1)
# Set Help Window Text
@help_window.set_text(Choice::Name)
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
# Create command window
@command_window = Window_Choices.new
@command_window.viewport = @viewport
# Set Command Window Handlers
@command_window.set_handler(:cancel, method(:return_scene))
@command_window.set_handler(:ok, method(:on_choice_ok))
end
#--------------------------------------------------------------------------
# * [OK] Choice/Command
#--------------------------------------------------------------------------
def on_choice_ok
# From here you can call whatever scene you want to.
SceneManager.call(Scene_Information_A)
SceneManager.call(Scene_Information_B)
SceneManager.call(Scene_Information_C)
SceneManager.call(Scene_Information_D)
SceneManager.call(Scene_Information_E)
SceneManager.call(Scene_Information_F)
SceneManager.call(Scene_Information_G)
SceneManager.call(Scene_Information_H)
SceneManager.call(Scene_Information_I)
SceneManager.call(Scene_Information_J)
SceneManager.call(Scene_Information_K)
SceneManager.call(Scene_Information_L)
SceneManager.call(Scene_Information_M)
SceneManager.call(Scene_Information_N)
# Get Command Window Index
index = @command_window.index
# Get Command Window Current Command name
name = @command_window.command_name(index)
# Show a message box
msgbox "Call your information command here! Current Index is #{index} - #{name}"
# Reactivating window (Not necessary for scene, just to keep testing)
@command_window.activate
end
end
-
I'm not sure exactly why you would have to call a specific scene for information, since it feels like maybe an argument would do it. But since you mentioned you're not learning how to script, here is the script finished.
#============================================================================
# ** Choice
#------------------------------------------------------------------------------
# This module holds choice scene information.
#==============================================================================
module Choice
# Choices Header
Name = "Choices"
# Choices Font Size
Font_Size = 24
# Choices Information Array
Choices = ["Information1", "Information2", "Information3", "Information4",
"Etc"]
# Scenes to call for Choices
Choice_Scenes = [Scene_Item, Scene_Item, Scene_Item, Scene_Item, Scene_Debug]
end
#==============================================================================
# ** Window_Choices
#------------------------------------------------------------------------------
# This window is used to display choices in the choices scene.
#==============================================================================
class Window_Choices < Window_Command
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize ; super(0, line_height * 2) end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
def window_width ; Graphics.width end
#--------------------------------------------------------------------------
# * Get Window Height
#--------------------------------------------------------------------------
def window_height ; Graphics.height - (line_height * 2) end
#--------------------------------------------------------------------------
# * Create Command List
#--------------------------------------------------------------------------
def make_command_list
# Add Choice Commands
Choice::Choices.each_with_index {|choice| add_command(choice, :choice, true)}
end
end
#==============================================================================
# ** Centered_Window_Help
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================
class Centered_Window_Help < Window_Help
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Clear Contents
contents.clear
# Draw Text
draw_text(0, 0, contents_width, line_height, @text, 1)
end
end
#==============================================================================
# ** Scene_Choices
#------------------------------------------------------------------------------
# This class contains the choice windows and information.
#==============================================================================
class Scene_Choices < Scene_MenuBase
#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
def start
super
# Create Help Window
create_help_window
# Create Command Window
create_command_window
end
#--------------------------------------------------------------------------
# * Create Help Window
#--------------------------------------------------------------------------
def create_help_window
# Create Help Window
@help_window = Centered_Window_Help.new(1)
# Set Help Window Text
@help_window.set_text(Choice::Name)
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
# Create command window
@command_window = Window_Choices.new
@command_window.viewport = @viewport
# Set Command Window Handlers
@command_window.set_handler(:cancel, method(:return_scene))
@command_window.set_handler(:ok, method(:on_choice_ok))
end
#--------------------------------------------------------------------------
# * [OK] Choice/Command
#--------------------------------------------------------------------------
def on_choice_ok
# Call Selected Choice Scene
SceneManager.(Choice::Choice_Scenes.at(@command_window.index))
end
end
Also.
No, I lack the intelligence to do so at the scripting.
I can honestly say from my experience that intelligence has little to do with learning programming. You can type, which is 90% of what you need.
-
# Choices Information Array
Choices = ["Information1", "Information2", "Information3", "Information4",
"Information5"]
# Scenes to call for Choices
Choice_Scenes = [Scene_Information_A, Scene_Information_B, Scene_Information_C, Scene_Information_D, Scene_Information_E]
I keep getting a
'Script 'Choices' line 16: NameError occured.
unintialized constant Choice::Scene_Information_A'
error.
I just don't get it. It called up the item script when it was Scene_Item. Why won't it call my Information_A, Information_B, Information_C, Information_D, or Information_E scripts?
EDIT : Here is my Information_A script.
module INFO_A
NAME = "Information 1"
FONT_SIZE = 24
INFORMATION_A1 = "Character 1 likes to : Eat Cake"
INFORMATION_A2 = "Character 2 likes to : Go Hiking"
INFORMATION_A3 = "Character 3 likes to : Swim Naked"
INFORMATION_A4 = "Character 4 likes to : Party Hard"
INFORMATION_A5 = "Character 5 likes to : Pilot Spaceships"
INFORMATION_A6 = "Character 6 likes to : Tend Animals"
INFORMATION_A7 = "Character 7 likes to : Make Love"
INFORMATION_A8 = "Character 8 likes to : Practice Shapechanging"
INFORMATION_A9 = "Character 9 likes to : Learn Calligraphy"
INFORMATION_A10 = "Character 10 likes to : Party X-TRME"
INFORMATION_A11 = "Character 11 likes to : Fly Fast"
INFORMATION_A12 = "Character 12 likes to : Do Fashion"
INFORMATION_A13 = "Character 13 likes to : Fight Lots"
INFORMATION_A14 = "Character 14 likes to : Be Helpful"
end
class Window_Information_A < Window_Selectable
include INFO_A
def visible_line_number
14
end
def initialize
super(0, line_height*2, Graphics.width, Graphics.height-line_height*2)
refresh
end
def refresh
contents.clear
contents.font.size = FONT_SIZE
draw_information_a(0, 0)
end
end
def draw_information_a(x, y)
draw_text(x, y, contents.width, line_height, INFORMATION_A1)
draw_text(x, y + line_height, contents.width, line_height, INFORMATION_A2)
draw_text(x, y + line_height*2, contents.width, line_height, INFORMATION_A3)
draw_text(x, y + line_height*3, contents.width, line_height, INFORMATION_A4)
draw_text(x, y + line_height*4, contents.width, line_height, INFORMATION_A5)
draw_text(x, y + line_height*5, contents.width, line_height, INFORMATION_A6)
draw_text(x, y + line_height*6, contents.width, line_height, INFORMATION_A7)
draw_text(x, y + line_height*7, contents.width, line_height, INFORMATION_A8)
draw_text(x, y + line_height*8, contents.width, line_height, INFORMATION_A9)
draw_text(x, y + line_height*9, contents.width, line_height, INFORMATION_A10)
draw_text(x, y + line_height*10, contents.width, line_height, INFORMATION_A11)
draw_text(x, y + line_height*11, contents.width, line_height, INFORMATION_A12)
draw_text(x, y + line_height*12, contents.width, line_height, INFORMATION_A13)
draw_text(x, y + line_height*13, contents.width, line_height, INFORMATION_A14)
end
class Window_Information_A_Title < Window_Selectable
include INFO_A
def initialize
super(0, 0, Graphics.width, line_height*2)
refresh
end
def refresh
contents.clear
draw_text(0, 0, contents.width, line_height, NAME, 1)
end
end
class Scene_Information_A < Scene_Base
def start
super
create_head_window
create_info_window
end
def create_head_window
@inform_title = Window_Information_A_Title.new
@inform_title.viewport = @viewport
end
def create_info_window
@info_window = Window_Information_A.new
@info_window.viewport = @viewport
end
def update
super
if Input.trigger?(:B)
Sound.play_cancel
return_scene
end
end
end
Information_A has info about characters 1-14, B 15-28, C 29-42... etc.
-
Waiting...
-
Put your Choice Script below your other custom Scenes