How do you create and use multidimensional arrays in RGSS?
Multidimensional Array
Learning Ruby and RGSSxCreation, hmm... I create them just like any array... sometimes I simply save another array of values inside each array index, so it's still like doing a multidimensional array...
for usage, something like Array[ ][ ]
for usage, something like Array[ ][ ]
Ruby has no notion of multi-dimensional arrays, but you can certainly create jagged arrays, i.e., arrays which contain variable sized arrays as its elements.
Code:
chess_board = [ ['a1', 'b1', 'c1', 'd1', 'e1', 'f1', 'g1', 'h1'] ['a2', 'b2', 'c2', 'd2', 'e2', 'f2', 'g2', 'h2'] # ... etc]
@BigEd781 - how many array levels can these jagging go?
Let me put it this way; if you find out, you're doing something horribly wrong. It's simply a matter of memory. Arrays are objects like any other.
RGSS has a Table class which is a 3-D array-like thing.
I've tried to do this:
results = [] #empty array with no dimensions
results[0] = nil #first array no contents
results[1] = [1,2,3,4,5,6,7,8,9,10]
...
results[10] = [1,2,3,4,5,6,7,8,9,10]
And when I wanted to draw the contents of the array:
draw_text_ex(0, 0, 50, 50, results[0][0])
An error occurs about a method (I forgot the exact error XD)
I also came across the Table class, but the declaration is a little bit unclear for me.
results = [] #empty array with no dimensions
results[0] = nil #first array no contents
results[1] = [1,2,3,4,5,6,7,8,9,10]
...
results[10] = [1,2,3,4,5,6,7,8,9,10]
And when I wanted to draw the contents of the array:
draw_text_ex(0, 0, 50, 50, results[0][0])
An error occurs about a method (I forgot the exact error XD)
I also came across the Table class, but the declaration is a little bit unclear for me.
there is no [0][0] because the contents of [0] is nil (not an array) hence you would get an error...
The contents should be an array if you want to do [0][0]
results[0] = [1]
This should work with [0][0], since there is now an array value
this next one wouldn't work with your [0][0] either because its non array
results[0] = 1
The contents should be an array if you want to do [0][0]
results[0] = [1]
This should work with [0][0], since there is now an array value
this next one wouldn't work with your [0][0] either because its non array
results[0] = 1
You explicitly set the element at index 0 to nil. Not an empty array, nil, i.e., the *absence* of a value. NilClass defines no operator [], so you get an exception. if you want valid data there... then you need to put it there. If the existence of a valid element is not an invariant then you need to check for nil (or an empty array) first.
Table.new(2) - 1D array with size of 2
Table.new(2, 3) - 2D array with size of 2 by 3
Table.new(2, 3, 4) - 3D array with size of 2 by 3 by 4
Okay, so I declared a new table...
@resultClass = Table.new(10,10)
and I initialized its values...
for i in 0..10
eval("@resultClass[#{i}] = [rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10)]") end
and then I tried to draw the value... (index is a integer)
draw_text_ex(rect.x + 350, rect.y, @resultClass[1][index])
It gave me an error about arguments (2 of 1).
@resultClass = Table.new(10,10)
and I initialized its values...
for i in 0..10
eval("@resultClass[#{i}] = [rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10)]") end
and then I tried to draw the value... (index is a integer)
draw_text_ex(rect.x + 350, rect.y, @resultClass[1][index])
It gave me an error about arguments (2 of 1).
Try `your_table[1,index]`
Not sure if it makes a difference though
Are you sure draw_text_ex call is correct?
Not sure if it makes a difference though
Are you sure draw_text_ex call is correct?
I'm pretty sure it's correct. Still gives the same error, through.
why do you even need to use eval for the settings?
try just doing
@resultClass = [rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10)]
also, since you used table, I think it should be
@resultClass[i,j] = rand(10)
i = index of first dimension
j = index of second dimension
try just doing
@resultClass = [rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10)]
also, since you used table, I think it should be
@resultClass[i,j] = rand(10)
i = index of first dimension
j = index of second dimension
Now it's "Can't convert array to integer"...
I'm going to recap things...
@resultClass = Table.new(10,10)
for i in 0..10
eval("@resultClass[#{i}] = [rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10)]")
end
draw_text_ex(rect.x + 350, rect.y, @resultClass[1,index])
I'm going to recap things...
@resultClass = Table.new(10,10)
for i in 0..10
eval("@resultClass[#{i}] = [rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10), rand(10)]")
end
draw_text_ex(rect.x + 350, rect.y, @resultClass[1,index])
have you tried the suggestion of not using eval?
this one actually,
this one actually,
something like
Code:
@resultClass = Table.new(10,10)for i in 0..10 for j in 0..10 @resultClass[i,j] = rand(10) endend draw_text_ex(rect.x + 350, rect.y, @resultClass[1,index])
For some reasons, the draw_text_ex function is displaying 0.
draw_text_ex(rect.x + 350, rect.y, @resultClass[1,index]) is on a separate method.
Edit: Nevermind, I got it working. I just placed the declaration and initialization somewhere else 🙂
Edit 2: So... how do I get the corresponding class with this ID? So the " @resultClass[1,index]" is supposed to return an integer, but the grand end is supposed to get the class that corresponds to the id number computed by that table.
For example, @resultClass[1,index] returns "3", I need to display the name of the class that corresponds to the number "3" (For example, priest), then get a random actor from the database that has that class.
draw_text_ex(rect.x + 350, rect.y, @resultClass[1,index]) is on a separate method.
Edit: Nevermind, I got it working. I just placed the declaration and initialization somewhere else 🙂
Edit 2: So... how do I get the corresponding class with this ID? So the " @resultClass[1,index]" is supposed to return an integer, but the grand end is supposed to get the class that corresponds to the id number computed by that table.
For example, @resultClass[1,index] returns "3", I need to display the name of the class that corresponds to the number "3" (For example, priest), then get a random actor from the database that has that class.
$data_classes[3] perhaps?
To help you figure out how to use tables you can look at my table pretty printer: www.mediafire.com/view/yqmotjmnnit/table_to_string.txt
Remember that tables can only store 2 signed bytes as its values. I.e. the range is from -2^15 = -32768 to 2^15 - 1 = 32767.
When retrieving the RPG::Class object from the $data_classes array checking whether you actually got a value (== nil or .nil?) is a good idea.
According to the help file you can see RPG::Class inherits from RPG::BaseItem which means that it must implement the .name method. So try using that.
Going one step back, try to tell us the whole problem, What are you trying to achieve.
*hugs*
Remember that tables can only store 2 signed bytes as its values. I.e. the range is from -2^15 = -32768 to 2^15 - 1 = 32767.
When retrieving the RPG::Class object from the $data_classes array checking whether you actually got a value (== nil or .nil?) is a good idea.
According to the help file you can see RPG::Class inherits from RPG::BaseItem which means that it must implement the .name method. So try using that.
Going one step back, try to tell us the whole problem, What are you trying to achieve.
*hugs*
Thanks for the support. The grand plan is to create an actor fusion script, but the first step that I'm trying to accomplish is the display part, and not the actual fusion yet. At this point in time, I'm trying to accomplish the second screen displaying the resulting class (which is random at the moment, but I will change that to a predetermined one, hence the table).
The other thing I'm trying to accomplish at the moment is to display the selected item from the first screen (Window_PartyList) to display on to the next screen (Header2)...
If you're interested, here's the entire code:
I'm now able to display the selected item, but it displays the selected item on the next iteration (so the first time, it displays 'nil', then after closing and opening the window, it displays the item selected on the previous try).
1st iteration: selects option 1, displays 'nil'
2nd iteration: selects option 3, displays option 1
3rd iteration: selects option 4, displays option 3
4th iteration: selects option 2, displays option 4
and so fort.
Any ideas what is wrong?
The other thing I'm trying to accomplish at the moment is to display the selected item from the first screen (Window_PartyList) to display on to the next screen (Header2)...
If you're interested, here's the entire code:
#==============================================================================# Class Scene_Fusion < Scene_MenuBase# This class is for displaying the Fusion screen. All options should# open the next screen, Scene_Fusion2#==============================================================================class Scene_Fusion < Scene_MenuBase def start super # Fusion 1 @header1 = Window_Header.new(0, 0, Graphics.width, 132) @list1 = Window_PartyList.new(0, 132, Graphics.width) @list1.set_handler🙂ok, method🙂continue)) @list1.set_handler🙂cancel, method🙂return_scene)) # Fusion 2 @header2 = Window_Header2.new(0, 0, Graphics.width, 132) @list2 = Window_PartyList2.new(0, 132, Graphics.width) @list2.set_handler🙂ok, method🙂continue)) @list2.set_handler🙂cancel, method🙂return_scene)) # Setup Fusion 1 as the start point @list1.activate # Activate the first list. @list2.deactivate # Deactivate the second list. @list2.hide @header2.hide # Hide the second list and header. end def continue @list1.deactivate @list1.hide @header1.hide $selected = @list1.selected @list2.show @header2.show @list2.activate endend#==============================================================================# Class Window_Header < Window_Base# This class displays the options at the top.#==============================================================================class Window_Header < Window_Base def initialize(x, y, width, height) super self.opacity = 0 draw_headers @opening = @closing = false end #def initialize def dispose contents.dispose unless disposed? super end #def dispose def draw_headers line_height = 16 change_color(system_color) draw_text(30, 0, 250, line_height, "Select First Demon") draw_text(30, 40, 85, line_height, "Race") draw_text(120, 40, 85, line_height, "Name") draw_text(265, 40, 85, line_height, "LV") for i in 1..10 eval("draw_text(300+(30*#{i-1}), 0, 30, 10, #{i})") end # for change_color(normal_color) end #def draw_headersend #class Window_Header#==============================================================================# Class Window_Header2 < Window_Base# This class displays the options at the top.#==============================================================================class Window_Header2 < Window_Base def initialize(x, y, width, height) super self.opacity = 0 #$selected = Window_PartyList.selected draw_headers @opening = @closing = false end #def initialize def dispose contents.dispose unless disposed? super end #def dispose def draw_headers line_height = 16 change_color(system_color) draw_text(30, 0, 250, line_height, "Select Second Demon") draw_text(400, 0, 300, line_height, $selected.class.name)# draw_text(450, 0, 300, line_height, $selected.level) draw_text(30, 40, 85, line_height, "Race") draw_text(120, 40, 85, line_height, "Name") draw_text(265, 40, 85, line_height, "LV") draw_text(420, 40, 85, line_height, "Result") change_color(normal_color) end #def draw_headersend #class Window_Header2#==============================================================================# Class Window_PartyList < Window_Selectable# This class displays the list of party members. Should not include the# main actor. #==============================================================================class Window_PartyList < Window_Selectable def initialize(x, y, width) super(x, y, width, Graphics.height - y) self.opacity = 0 data = [] self.index = 0 #Do not include the main actor! activate refresh end #def initialize def item_max @data ? @data.size : 1 end #def item_max def make_item_list @data = $game_party.members.compact @data.delete_at(0) #Ensures that the first party member isn't bothered. end #def make_item_list def draw_item(index) line_height = 16 item = @data[index] if item rect = item_rect_for_text(index) #draw_text(rect, item.id) draw_text_ex(0, rect.y, item.id) #draw_text_ex(rect.x + 15, rect.y, item.class.name) draw_text_ex(30, rect.y, item.class.name) #draw_text_ex(rect.x + 100, rect.y, item.name) draw_text_ex(120, rect.y, item.name) #draw_text_ex(rect.x + 180, rect.y, item.level) draw_text_ex(265, rect.y, item.level) for i in 1..10 if index==i-1 #If same actor, cannot be fused eval("draw_text(300+(30*#{i-1}), rect.y, 30, line_height, '-')") elsif item.class == @data[i-1].class #else if same class, cannot be fused eval("draw_text(300+(30*#{i-1}), rect.y, 30, line_height, 'No')") else #else, can be fused eval("draw_text(300+(30*#{i-1}), rect.y, 30, line_height, 'Yes')") #@data[i-1].set_handler🙂ok, SceneManager.call(Scene_Fusion2)) end #end if else end #end for end #end if end #def draw_item #def selected(value) # @selected = value #end def refresh contents.clear make_item_list create_contents draw_all_items end #def refresh def selected #return @data[self.index] if @data[self.index] == nil $selected = @data[1] else $selected = @data[self.index] end end #def selected end #class Window_PartyList#==============================================================================# Class Window_PartyList2 < Window_Selectable# This class displays the list of party members. Should not include the# main actor. #==============================================================================class Window_PartyList2 < Window_Selectable def initialize(x, y, width) super(x, y, width, Graphics.height - y) self.opacity = 0 data = [] #$resultClass = Table.new(37,37) $resultClass = [] self.index = 0 #Do not include the main actor! initializeTable activate refresh end #def initialize def initializeTable$resultClass[0] = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] # Avatar$resultClass[1] = [37, 6, 6, 22, 20, 24, 16, 14, 24, 30, 15, 32, 14, 19, 29, 29, 14, 5, 24, 9, 22, 5, 14, 29, 19, 34, 34, 5, 5, 22, 10, 31, 5, 20, 6]# Avian$resultClass[2] = [6, 37, 15, 22, 11, 29, 11, 5, 29, 24, 6, 24, 3, 22, 6, 3, 25, 6, 23, 1, 22, 5, 7, 6, 11, 22, 24, 24, 32, 3, 1, 20, 22, 29, 25]# Beast$resultClass[3] = [6, 15, 37, 11, 2, 1, 20, 19, 11, 11, 9, 29, 34, 1, 20, 34, 34, 29, 1, 30, 35, 2, 29, 15, 9, 1, 34, 14, 1, 9, 7, 7, 19, 16, 10]# Brute$resultClass[4] = [22, 22, 11, 37, 22, 35, 25, 14, 25, 21, 3, 22, 34, 23, 6, 30, 13, 22, 11, 7, 11, 29, 14, 11, 22, 22, 14, 31, 3, 22, 17, 17, 30, 14, 11]# Deity$resultClass[5] = [20, 11, 2, 22, 37, 24, 32, 24, 29, 22, 7, 31, 31, 22, 34, 9, 10, 22, 24, 31, 4, 9, 24, 22, 32, 31, 31, 26, 26, 22, 32, 31, 22, 30, 24]# Divine$resultClass[6] = [24, 29, 1, 35, 24, 37, 10, 24, 1, 31, 24, 32, 14, 5, 7, 2, 29, 24, 9, 22, 22, 11, 24, 1, 29, 5, 13, 24, 24, 3, 5, 2, 19, 1, 29]# Dragon$resultClass[7] = [16, 11, 20, 25, 32, 10, 37, 23, 10, 3, 16, 29, 29, 15, 10, 34, 29, 6, 9, 2, 22, 15, 14, 20, 11, 30, 14, 19, 34, 34, 16, 31, 23, 15, 1]# Entity$resultClass[8] = [14, 5, 19, 14, 24, 24, 23, 37, 24, 22, 23, 5, 4, 23, 14, 5, 4, 31, 22, 31, 14, 14, 14, 5, 4, 1, 32, 5, 14, 26, 26, 31, 14, 4, 24]# Fairy$resultClass[9] = [24, 29, 11, 25, 29, 1, 10, 24, 37, 6, 10, 11, 17, 4, 3, 20, 25, 15, 24, 16, 35, 32, 35, 34, 29, 16, 17, 19, 3, 3, 34, 30, 23, 2, 19]# Fallen$resultClass[10] = [30, 24, 11, 21, 22, 31, 3, 22, 6, 37, 7, 15, 32, 32, 31, 9, 25, 31, 3, 3, 4, 20, 14, 11, 17, 32, 13, 23, 24, 2, 26, 2, 23, 7, 21]# Femme$resultClass[11] = [15, 6, 9, 3, 7, 24, 16, 23, 10, 7, 37, 24, 34, 23, 30, 9, 13, 24, 23, 3, 34, 15, 22, 6, 21, 24, 13, 24, 10, 9, 34, 31, 22, 1, 4]# Fiend$resultClass[12] = [32, 24, 29, 22, 31, 32, 29, 5, 11, 15, 24, 37, 32, 5, 5, 9, 32, 16, 24, 15, 7, 32, 24, 32, 29, 24, 31, 26, 24, 22, 26, 22, 22, 7, 32]# Foul$resultClass[13] = [14, 3, 34, 34, 31, 14, 29, 4, 17, 32, 34, 32, 37, 30, 25, 34, 4, 32, 10, 16, 11, 34, 32, 32, 4, 31, 32, 10, 10, 34, 17, 17, 30, 3, 29]# Fury$resultClass[14] = [19, 22, 1, 23, 22, 5, 15, 23, 4, 32, 23, 5, 30, 37, 23, 15, 30, 15, 22, 34, 11, 23, 32, 5, 23, 5, 22, 32, 22, 15, 5, 31, 5, 30, 19]# Genma$resultClass[15] = [29, 6, 20, 6, 34, 7, 10, 14, 3, 31, 30, 5, 25, 23, 37, 6, 25, 5, 35, 2, 9, 29, 11, 3, 19, 24, 23, 24, 5, 1, 32, 22, 19, 32, 14]# Ghost$resultClass[16] = [29, 3, 34, 30, 9, 2, 34, 5, 20, 9, 9, 9, 34, 15, 6, 37, 3, 11, 6, 10, 30, 32, 11, 32, 10, 30, 10, 5, 7, 15, 11, 5, 5, 30, 2]# Haunt$resultClass[17] = [14, 25, 34, 13, 10, 29, 29, 4, 25, 25, 13, 32, 4, 30, 25, 3, 37, 29, 10, 16, 32, 34, 32, 11, 35, 31, 32, 4, 4, 34, 13, 10, 30, 21, 21]# Hero$resultClass[18] = [5, 6, 29, 22, 22, 24, 6, 31, 15, 31, 24, 16, 32, 15, 5, 11, 29, 37, 5, 15, 22, 26, 24, 31, 31, 24, 31, 26, 5, 22, 29, 26, 6, 1, 29]# Holy$resultClass[19] = [24, 23, 1, 11, 24, 9, 9, 22, 24, 3, 23, 24, 10, 22, 35, 6, 10, 5, 37, 1, 3, 23, 1, 6, 9, 28, 34, 6, 22, 9, 1, 10, 22, 9, 6]# Jaki$resultClass[20] = [9, 1, 30, 7, 31, 22, 2, 31, 16, 3, 3, 15, 16, 34, 2, 10, 16, 15, 1, 37, 15, 15, 11, 11, 34, 22, 31, 31, 6, 34, 11, 15, 22, 7, 15]# Jirae$resultClass[21] = [22, 22, 35, 11, 4, 22, 22, 14, 35, 4, 34, 7, 11, 11, 9, 30, 32, 22, 3, 15, 37, 29, 3, 23, 13, 22, 13, 5, 10, 9, 34, 17, 22, 32, 3]# Kishin$resultClass[22] = [5, 5, 2, 29, 9, 11, 15, 14, 32, 20, 15, 32, 34, 23, 29, 32, 34, 26, 23, 15, 29, 37, 14, 30, 11, 24, 31, 6, 6, 26, 10, 20, 14, 16, 11]# Lady$resultClass[23] = [14, 7, 29, 14, 24, 24, 14, 14, 35, 14, 22, 24, 32, 32, 11, 11, 32, 24, 1, 11, 3, 14, 37, 14, 22, 24, 22, 5, 11, 11, 24, 11, 22, 17, 25]# Megami$resultClass[24] = [29, 6, 15, 11, 22, 1, 20, 5, 34, 11, 6, 32, 32, 5, 3, 32, 11, 31, 6, 11, 23, 30, 14, 37, 10, 32, 31, 5, 9, 2, 0, 26, 5, 9, 22]# Night$resultClass[25] = [19, 11, 9, 22, 32, 29, 11, 4, 29, 17, 21, 29, 4, 23, 19, 10, 35, 31, 9, 34, 13, 11, 22, 10, 37, 32, 32, 10, 10, 34, 25, 23, 14, 35, 6]# Omega$resultClass[26] = [34, 22, 1, 22, 31, 5, 30, 1, 16, 32, 24, 24, 31, 5, 24, 30, 31, 24, 28, 22, 22, 24, 24, 32, 32, 37, 32, 1, 22, 11, 5, 7, 22, 10, 10]# Raptor$resultClass[27] = [34, 24, 34, 14, 31, 13, 14, 32, 17, 13, 13, 31, 32, 22, 23, 10, 32, 31, 34, 31, 13, 31, 22, 31, 32, 32, 37, 31, 13, 29, 14, 14, 5, 32, 17]# Seraph$resultClass[28] = [5, 24, 14, 31, 26, 24, 19, 5, 19, 23, 24, 26, 10, 32, 24, 5, 4, 26, 6, 31, 5, 6, 5, 5, 10, 1, 31, 37, 0, 2, 10, 6, 22, 6, 24]# Snake$resultClass[29] = [5, 32, 1, 3, 26, 24, 34, 14, 3, 24, 10, 24, 10, 22, 5, 7, 4, 5, 22, 6, 10, 6, 11, 9, 10, 22, 13, 0, 37, 22, 7, 5, 22, 30, 25]# Touki$resultClass[30] = [22, 3, 9, 22, 22, 3, 34, 26, 3, 2, 9, 22, 34, 15, 1, 15, 34, 22, 9, 34, 9, 26, 11, 2, 34, 11, 29, 2, 22, 37, 29, 15, 26, 29, 3]# Tyrant$resultClass[31] = [10, 1, 7, 17, 32, 5, 16, 26, 34, 26, 34, 26, 17, 5, 32, 11, 13, 29, 1, 11, 34, 10, 24, 0, 25, 5, 14, 10, 7, 29, 37, 5, 14, 20, 25]# Vile$resultClass[32] = [31, 20, 7, 17, 31, 2, 31, 31, 30, 2, 31, 22, 17, 31, 22, 5, 10, 26, 10, 15, 17, 20, 11, 26, 23, 7, 14, 6, 5, 15, 5, 37, 22, 10, 21]# Wargod$resultClass[33] = [5, 22, 19, 30, 22, 19, 23, 14, 23, 23, 22, 22, 30, 5, 19, 5, 30, 6, 22, 22, 22, 14, 22, 5, 14, 22, 5, 22, 22, 26, 14, 22, 37, 14, 14]# Wilder$resultClass[34] = [20, 29, 16, 14, 30, 1, 15, 4, 2, 7, 1, 7, 3, 30, 32, 30, 21, 1, 9, 7, 32, 16, 17, 9, 35, 10, 32, 6, 30, 29, 20, 10, 14, 37, 3]# Yoma$resultClass[35] = [6, 25, 10, 11, 24, 29, 1, 24, 19, 21, 4, 32, 29, 19, 14, 2, 21, 29, 6, 15, 3, 11, 25, 22, 6, 10, 17, 24, 25, 3, 25, 21, 14, 3, 37]# Elements$resultClass[36] = [6, 25, 10, 11, 24, 29, 1, 24, 19, 21, 4, 32, 29, 19, 14, 2, 21, 29, 6, 15, 3, 11, 25, 22, 6, 10, 17, 24, 25, 3, 25, 21, 14, 3, 37] end def item_max @data ? @data.size : 1 end #def item_max def make_item_list @data = $game_party.members.compact @data.delete_at(0) #Ensures that the first party member isn't bothered. end #def make_item_list def draw_item(index) item = @data[index] if item rect = item_rect_for_text(index) draw_text(rect, item.id) draw_text_ex(rect.x + 15, rect.y, item.class.name) draw_text_ex(rect.x + 100, rect.y, item.name) draw_text_ex(rect.x + 180, rect.y, item.level) #Compute the resulting demon #draw_text_ex(rect.x + 350, rect.y, show_result(item.id, index))# @classid = $resultClass[$selected.class-1][item.class_id-1]# draw_text_ex(rect.x + 350, rect.y, $data_classes[@classid].name) end #end if end #def draw_item #should print out the resulting demon. #def show_result(item, index) # return $resultClass[item][index] #end #show_result def refresh contents.clear make_item_list create_contents draw_all_items end #def refresh #set handler for showing the next screenend #class Window_PartyList2
1st iteration: selects option 1, displays 'nil'
2nd iteration: selects option 3, displays option 1
3rd iteration: selects option 4, displays option 3
4th iteration: selects option 2, displays option 4
and so fort.
Any ideas what is wrong?
Original thread: https://forums.rpgmakerweb.com/threads/multidimensional-array.15168/