Menu fails to pull item from select menu

nerdmor

Veteran
Veteran
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

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

 
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,

:padding     => 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

:opacity  => 255,      # Change the transparency of the window.   

}

}

 

HANDLERS[:VGM_debugMenu_region_list] = {

      :cancel     =>  :VGM_chooseClassMenu_list_onCancel,

:on_change =>  :VGM_chooseClassMenu_list_onChange,

:ok => :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 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,

:padding     => 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

:opacity  => 255,      # Change the transparency of the window.   

},

:type_1     =>  {

:color1   =>  [0, 0, 0, 128],

:color2   =>  [0, 0, 0, 128],

:vertical =>  false,

},

:type_2     =>  {

:picture  =>  "commandpane", # Graphics/System

:opacity  =>  255,

:offset_x =>  0,

:offset_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

 
Untitled.png
 

nerdmor

Veteran
Veteran
Joined
Jul 17, 2015
Messages
40
Reaction score
18
First Language
Portuguese
Primarily Uses
Solved it. It was a severe case of "misspelling the names"
 

Marquise*

Veteran
Veteran
Joined
Jul 9, 2014
Messages
4,942
Reaction score
8,247
First Language
French-Canadian
No prob. Nice you could figure it out! :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,847
Messages
1,016,968
Members
137,561
Latest member
JaCrispy85
Top