here's the selectable window I made that displays actors (I chopped out the frivolous stuff for brevity)
class Window_3 < Window_Selectable
def initialize
super(0, 0, 440,380)
self.contents = Bitmap.new(width-32, height-32)
refresh
@column_max = 1
self.active = true
self.index = -1
end
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 0
y = i * 150
if i >= 2
x=250
y -= 300
end
actor = $game_party.actors[i]
#BLOCK 2.0
self.contents.font.color = text_color(6)
self.contents.draw_text(x+5, y, 200, 32, actor.name)
offset_x=contents.text_size(actor.name).width+10
self.contents.font.color = normal_color
self.contents.draw_text(5+x+offset_x, y, 200, 32, "(Level " + actor.level.to_s + ")")
draw_actor_hp(actor, x+5, y+32)
draw_actor_sp(actor, x+5, y+64)
self.contents.font.color = system_color
self.contents.draw_text(x+200, y+64, 200, 32, "Experience")
self.contents.font.color = normal_color
self.contents.draw_text(x + 285, y+64, 84, 32, actor.exp_s + " /")
xp_l = (actor.exp_s.length * 5)
self.contents.draw_text(x + 320 + xp_l, y+64, 84, 32, actor.next_exp_s)
end
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 150, self.width - 32, 96)
end
end
end #end window 3
So this window selects an actor, and executes (whatever) when I hit the spacebar. Right now, what I'm executing is this mess:
if Input.trigger?(Input::C)
if @window_3.active == true
p @window_3.index
m = @window_3.index
l = $data_system.party_members[m]
p $game_actors[l].name
end
end
Clearly I don't know what I'm doing because "Window 3 index" is only spitting out the cursor order (0,1,2,..etc) and I'm trying to directly access the actor number, which might look more like (12,5,9..etc).
While my above code (m = ... l = ..[m]) works, I have a feeling there's a more direct way of getting my actor numbers... because I suck at coding ruby and even I think my workaround looks like crap.