- Joined
- Jul 17, 2015
- Messages
- 40
- Reaction score
- 18
- First Language
- Portuguese
- Primarily Uses
Hello.
I am trying to make a simple menu which will display all the game's classes. When the player selects a class, I'll show it's description.
Seems simple enough. But I cannot get it working.
Below are the three scripts that I am using. Anexed is a print of the results
(Anything that begins with "VGM" is simply me isolating the classes and variables that I create from those the game or Luna create)
Thank you very much

I am trying to make a simple menu which will display all the game's classes. When the player selects a class, I'll show it's description.
Seems simple enough. But I cannot get it working.
Below are the three scripts that I am using. Anexed is a print of the results
(Anything that begins with "VGM" is simply me isolating the classes and variables that I create from those the game or Luna create)
Thank you very much
module LunaEngine module NewScene
# Create new scenes here
# Copy :default scene for configuration attributes
SCENES[:VGM_chooseClassMenu] = {
# Windows list for layout
:windows => [:VGM_chooseClassMenu_list,
:VGM_chooseClassMenu_description],
# Default active window
# Which window will be activated when enter scene
:active => :VGM_chooseClassMenu_list,
} # End :encyclopedia
end #end NewScene
end #end Module
# Create new scenes here
# Copy :default scene for configuration attributes
SCENES[:VGM_chooseClassMenu] = {
# Windows list for layout
:windows => [:VGM_chooseClassMenu_list,
:VGM_chooseClassMenu_description],
# Default active window
# Which window will be activated when enter scene
:active => :VGM_chooseClassMenu_list,
} # End :encyclopedia
end #end NewScene
end #end Module
module LunaEngine
module NewScene
WINDOWS[:VGM_chooseClassMenu_list] = {
:type => :selectable,
:content => nil,
:item_content => :VGM_chooseClassMenu_list_items,
:data => :VGM_chooseClassMenu_list_data,
:enable_item => :default_command_enable,
:x => 0,
:y => 0,
:z => 300,
:width => 200,
:height => 480,
:item_height => 24,
adding => 12,
:cursor => true,
:arrow => true,
:align => 0,
:item_rect=> {
:custom => false, # Enable custom item_rect or not? True/False
},
:back_type => 0,
:background_variable => 1,
:type_0 => {
:skin => "Window", # Name of the Windowskin
pacity => 255, # Change the transparency of the window.
}
}
HANDLERS[:VGM_debugMenu_region_list] = {
:cancel => :VGM_chooseClassMenu_list_onCancel,
n_change => :VGM_chooseClassMenu_list_onChange,
k => :VGM_chooseClassMenu_list_onOk
} # End :VGM_debugMenu_region_command
module Data
def VGM_chooseClassMenu_list_data
resp = $data_classes.select{ |a| !a.nil?}
resp = resp.select{ |a| a.element!="N/A"}
resp
end
end #end Data
module Lunatic
def VGM_chooseClassMenu_list_items(index)
#preparing results
result = []
#item from data
item = data[index]
#get the rectangle (YES, rect STANDS FOR RECTANGLE)
rect = item_rect(index)
rect.width -= 4
if item
icon = nil
name = [
# text
"#{item.name}",
# [offset x, offset y]
[rect.x, rect.y],
# [text width, align]
[rect.width, 0],
# [Red, Green, Blue, Alpha]
[255, 255, 255, 255],
# [Font name, Font size, Bold, Italic]
[Font.default_name, Font.default_size, Font.default_bold, Font.default_italic]
]
result.push(icon, name)
end #end if
result
end #end VGM_debugMenu_region_list_content
end #end Lunatic
module Handlers
# -----------------------------------------------------------------
# Cancel Handler for :VGM_debugMenu_region_list
# -----------------------------------------------------------------
def VGM_chooseClassMenu_list_onCancel
#~ $VGM_system.player.class = 7
#~ return_scene
end
# -----------------------------------------------------------------
# On Change Handler for :VGM_debugMenu_region_command
# -----------------------------------------------------------------
def VGM_chooseClassMenu_list_onChange
# get response windows
window
VGM_chooseClassMenu_description).refresh
end
def VGM_chooseClassMenu_list_onOk
#~ $VGM_system.player.class = get_item
VGM_chooseClassMenu_list).id
#~ return_scene
end
end # End Handlers
end #end NewScene
end #end Module
module NewScene
WINDOWS[:VGM_chooseClassMenu_list] = {
:type => :selectable,
:content => nil,
:item_content => :VGM_chooseClassMenu_list_items,
:data => :VGM_chooseClassMenu_list_data,
:enable_item => :default_command_enable,
:x => 0,
:y => 0,
:z => 300,
:width => 200,
:height => 480,
:item_height => 24,
:cursor => true,
:arrow => true,
:align => 0,
:item_rect=> {
:custom => false, # Enable custom item_rect or not? True/False
},
:back_type => 0,
:background_variable => 1,
:type_0 => {
:skin => "Window", # Name of the Windowskin
}
}
HANDLERS[:VGM_debugMenu_region_list] = {
:cancel => :VGM_chooseClassMenu_list_onCancel,
} # End :VGM_debugMenu_region_command
module Data
def VGM_chooseClassMenu_list_data
resp = $data_classes.select{ |a| !a.nil?}
resp = resp.select{ |a| a.element!="N/A"}
resp
end
end #end Data
module Lunatic
def VGM_chooseClassMenu_list_items(index)
#preparing results
result = []
#item from data
item = data[index]
#get the rectangle (YES, rect STANDS FOR RECTANGLE)
rect = item_rect(index)
rect.width -= 4
if item
icon = nil
name = [
# text
"#{item.name}",
# [offset x, offset y]
[rect.x, rect.y],
# [text width, align]
[rect.width, 0],
# [Red, Green, Blue, Alpha]
[255, 255, 255, 255],
# [Font name, Font size, Bold, Italic]
[Font.default_name, Font.default_size, Font.default_bold, Font.default_italic]
]
result.push(icon, name)
end #end if
result
end #end VGM_debugMenu_region_list_content
end #end Lunatic
module Handlers
# -----------------------------------------------------------------
# Cancel Handler for :VGM_debugMenu_region_list
# -----------------------------------------------------------------
def VGM_chooseClassMenu_list_onCancel
#~ $VGM_system.player.class = 7
#~ return_scene
end
# -----------------------------------------------------------------
# On Change Handler for :VGM_debugMenu_region_command
# -----------------------------------------------------------------
def VGM_chooseClassMenu_list_onChange
# get response windows
window
end
def VGM_chooseClassMenu_list_onOk
#~ $VGM_system.player.class = get_item
#~ return_scene
end
end # End Handlers
end #end NewScene
end #end Module
module LunaEngine
module NewScene
WINDOWS[:VGM_chooseClassMenu_description] = {
:type => :base,
:content => :VGM_chooseClassMenu_description_contents,
:x => 200,
:y => 0,
:z => 400,
:width => 460,
:height => 480,
:item_height => 24,
adding => 12,
:cursor => true,
:arrow => true,
:align => 0,
:item_rect=> {
:custom => false, # Enable custom item_rect or not? True/False
:width => 64, # Width of the item rect.
:height => 64, # Height of the item rect.
:spacing_ver => 8, # Spacing of each item vertically.
:spacing_hor => 8, # Spacing of each item horizontally.
},
:back_type => 0,
:background_variable => 1,
:type_0 => {
:skin => "Window", # Name of the Windowskin
pacity => 255, # Change the transparency of the window.
},
:type_1 => {
:color1 => [0, 0, 0, 128],
:color2 => [0, 0, 0, 128],
:vertical => false,
},
:type_2 => {
icture => "commandpane", # Graphics/System
pacity => 255,
ffset_x => 0,
ffset_y => 0,
}
}
module Lunatic
def VGM_chooseClassMenu_description_contents
result = []
puts "i was called! I am awaited!"
item = get_item
VGM_chooseClassMenu_list)
if item
#name
result.push([
"#{item.name}", # text
[12, 0], # [offset x, offset y]
[contents.width, 0], # [text width, align]
[255, 255, 255, 255], # [Red, Green, Blue, Alpha]
[Font.default_name, Font.default_size, true, Font.default_italic] # [Font name, Font size, Bold, Italic]
])
#description Three lines
#~ description_display = $VGM_system.helper.breakLinestoArray(item.description,66)
result.push([
"#{item.description}", # text
[12, 36], # [offset x, offset y]
[contents.width, 0], # [text width, align]
[255, 255, 255, 255], # [Red, Green, Blue, Alpha]
[Font.default_name, 16, Font.default_bold, Font.default_italic] # [Font name, Font size, Bold, Italic]
])
else
result.push([
"I am error", # text
[12, 0], # [offset x, offset y]
[contents.width, 0], # [text width, align]
[255, 255, 255, 255], # [Red, Green, Blue, Alpha]
[Font.default_name, Font.default_size, true, Font.default_italic] # [Font name, Font size, Bold, Italic]
])
result.push([
"Indeed I am", # text
[12, 36], # [offset x, offset y]
[contents.width, 0], # [text width, align]
[255, 255, 255, 255], # [Red, Green, Blue, Alpha]
[Font.default_name, 16, Font.default_bold, Font.default_italic] # [Font name, Font size, Bold, Italic]
])
end #end if
result
end #end VGM_debugMenu_region_display_contents
end #end Lunatic
end #end NewScene
end #end Module
module NewScene
WINDOWS[:VGM_chooseClassMenu_description] = {
:type => :base,
:content => :VGM_chooseClassMenu_description_contents,
:x => 200,
:y => 0,
:z => 400,
:width => 460,
:height => 480,
:item_height => 24,
:cursor => true,
:arrow => true,
:align => 0,
:item_rect=> {
:custom => false, # Enable custom item_rect or not? True/False
:width => 64, # Width of the item rect.
:height => 64, # Height of the item rect.
:spacing_ver => 8, # Spacing of each item vertically.
:spacing_hor => 8, # Spacing of each item horizontally.
},
:back_type => 0,
:background_variable => 1,
:type_0 => {
:skin => "Window", # Name of the Windowskin
},
:type_1 => {
:color1 => [0, 0, 0, 128],
:color2 => [0, 0, 0, 128],
:vertical => false,
},
:type_2 => {
}
}
module Lunatic
def VGM_chooseClassMenu_description_contents
result = []
puts "i was called! I am awaited!"
item = get_item
if item
#name
result.push([
"#{item.name}", # text
[12, 0], # [offset x, offset y]
[contents.width, 0], # [text width, align]
[255, 255, 255, 255], # [Red, Green, Blue, Alpha]
[Font.default_name, Font.default_size, true, Font.default_italic] # [Font name, Font size, Bold, Italic]
])
#description Three lines
#~ description_display = $VGM_system.helper.breakLinestoArray(item.description,66)
result.push([
"#{item.description}", # text
[12, 36], # [offset x, offset y]
[contents.width, 0], # [text width, align]
[255, 255, 255, 255], # [Red, Green, Blue, Alpha]
[Font.default_name, 16, Font.default_bold, Font.default_italic] # [Font name, Font size, Bold, Italic]
])
else
result.push([
"I am error", # text
[12, 0], # [offset x, offset y]
[contents.width, 0], # [text width, align]
[255, 255, 255, 255], # [Red, Green, Blue, Alpha]
[Font.default_name, Font.default_size, true, Font.default_italic] # [Font name, Font size, Bold, Italic]
])
result.push([
"Indeed I am", # text
[12, 36], # [offset x, offset y]
[contents.width, 0], # [text width, align]
[255, 255, 255, 255], # [Red, Green, Blue, Alpha]
[Font.default_name, 16, Font.default_bold, Font.default_italic] # [Font name, Font size, Bold, Italic]
])
end #end if
result
end #end VGM_debugMenu_region_display_contents
end #end Lunatic
end #end NewScene
end #end Module


