[RESOLVED]Special Equipment Not Equipping

Started by Shadow Eye31, October 16, 2012, 03:01:17 am

Previous topic - Next topic

Shadow Eye31

October 16, 2012, 03:01:17 am Last Edit: October 16, 2012, 04:35:26 am by Shadow Eye31
Hello, all.

I have been trying to create a script for new equipment for the better part of two days, and find myself stuck. The script will create five new equipment slots, two that will be based on weapons, three based on armors. I have added them to Game_Actor, Interpreter, and created a custom equip scene and windows to go along with it, as well as defined what items are equip-able via two id-defined elements.

So far, I have gotten the new scene running, the correct weapons/armor populating the lists, and said weapons/armor are not appearing in the regular equip scene, which is all correct. However, when I go to equip an item in this new scene, it will unequip the corresponding piece of equipment from the original equip scene without equipping the item. Let's say I try to equip the first weapon 'shard', as I call them, which is set as equip_type  5, but is the first on the list, making it index 0. It will unequip my weapon (equip_type 0, index 0 on the original screen), and will not equip the item to either slot, be it weapon or the first shard. The second weapon shard slot (equip_type 6, index 1) will do the same to the shield (type 1, index 1).

I feel like it is something simple I am missing, seeing as how everything else works fine, but I can't figure it out for the life of me. If anyone here could possibly point me in the right direction, I'd really appreciate it. You might even get a cookie!

KK20

Well, first off we locate where your main error is taking place. That would be when you press 'C' when equipping your shard.
    if Input.trigger?(Input::C)
      # Play equip SE
      $game_system.se_play($data_system.equip_se)
      # Get currently selected data on the item window
      item = @item_window.item
      # Change equipment
      @actor.equip(@right_window.index, item == nil ? 0 : item.id)
      # Activate right window
      @right_window.active = true
      @item_window.active = false
      @item_window.index = -1
      # Remake right window and item window contents
      @right_window.refresh
      @item_window.refresh
      return
    end
I threw a couple print functions in there to test @item_window.item and @right_window.index. Upon opening the scene, I press 'C' twice. I got nil and 0 respectively.

I looked at how you did @item_window.item, and noticed you did this:
  def item
    return @data[self.index + 5]
  end
Me:  :O.o:
Still trying to comprehend the script itself.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Shadow Eye31

Quote from: Ezel Berbier on October 16, 2012, 03:21:40 am
I looked at how you did @item_window.item, and noticed you did this:
  def item
    return @data[self.index + 5]
  end
Me:  :O.o:


That's the only fix I could find to fix a previous issue. It was equipping the shard to its sister index in the other screen, which I concluded was due to the fact that the base equip screen seems to equip via index rather than equip_type. By adding the 5, I figured it would push the index up by five to the new equipment, making 0 = 5 and equipping the shards appropriately. It fixes the issue of equipping to the wrong slot, but falls just short of fixing the issue entirely. There's probably a better way to do it, but I can't see it, sadly.

KK20

I was able to make the shard equip to its shard slot.
Spoiler: ShowHide
#==============================================================================
# ** Shard Equip
#------------------------------------------------------------------------------
#  Allows each character to equip two Weapon Shards and three Armor Shards.
#==============================================================================
class Window_EquipShardLeft < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor : actor
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 256, 368, 224)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_actor_name(@actor, 4, 0)
    draw_actor_class(@actor, 80, 0)
    draw_actor_level(@actor, 250, 0)
    self.contents.draw_text(4, 32, 64, 32, "ATK")
    self.contents.draw_text(170, 32, 64, 32, "PDef")
    self.contents.draw_text(4, 64, 64, 32, "MDef")
    self.contents.draw_text(170, 64, 64, 32, "EVA")
    self.contents.draw_text(4, 118, 64, 32, "STR")
    self.contents.draw_text(170, 118, 64, 32, "DEX")
    self.contents.draw_text(4, 150, 64, 32, "AGI")
    self.contents.draw_text(170, 150, 64, 32, "INT")
    self.contents.draw_text(60, 32, 36, 32, @actor.atk.to_s, 2)
    self.contents.draw_text(226, 32, 36, 32, @actor.pdef.to_s, 2)
    self.contents.draw_text(60, 64, 36, 32, @actor.mdef.to_s, 2)
    self.contents.draw_text(226, 64, 36, 32, @actor.eva.to_s, 2)
    self.contents.draw_text(60, 118, 36, 32, @actor.str.to_s, 2)
    self.contents.draw_text(226, 118, 36, 32, @actor.dex.to_s, 2)
    self.contents.draw_text(60, 150, 36, 32, @actor.agi.to_s, 2)
    self.contents.draw_text(226, 150, 36, 32, @actor.int.to_s, 2)
    if @new_atk != nil
      self.contents.font.color = system_color
      if @new_atk == @actor.atk
        self.contents.draw_text(110, 32, 20, 32, "=")
        self.contents.font.color = normal_color
      elsif @new_atk > @actor.atk
        self.contents.draw_text(110, 32, 20, 32, "↑")
        self.contents.font.color = text_color(3)
      elsif @new_atk < @actor.atk
        self.contents.draw_text(110, 32, 20, 32, "↓")
        self.contents.font.color = text_color(2)
      end
      self.contents.draw_text(126, 32, 36, 32, @new_atk.to_s, 2)
    end
    if @new_pdef != nil
      self.contents.font.color = system_color
      if @new_pdef == @actor.pdef
        self.contents.draw_text(276, 32, 20, 32, "=")
        self.contents.font.color = normal_color
      elsif @new_pdef > @actor.pdef
        self.contents.draw_text(276, 32, 20, 32, "↑")
        self.contents.font.color = text_color(3)
      elsif @new_pdef < @actor.pdef
        self.contents.draw_text(276, 32, 20, 32, "↓")
        self.contents.font.color = text_color(2)
      end
      self.contents.draw_text(292, 32, 36, 32, @new_pdef.to_s, 2)
    end
    if @new_mdef != nil
      self.contents.font.color = system_color
      if @new_mdef == @actor.mdef
        self.contents.draw_text(110, 64, 20, 32, "=")
        self.contents.font.color = normal_color
      elsif @new_mdef > @actor.mdef
        self.contents.draw_text(110, 64, 20, 32, "↑")
        self.contents.font.color = text_color(3)
      elsif @new_mdef < @actor.mdef
        self.contents.draw_text(110, 64, 20, 32, "↓")
        self.contents.font.color = text_color(2)
      end
      self.contents.draw_text(126, 64, 36, 32, @new_mdef.to_s, 2)
    end
    if @new_eva != nil
      self.contents.font.color = system_color
      if @new_eva == @actor.eva
        self.contents.draw_text(276, 64, 20, 32, "=")
        self.contents.font.color = normal_color
      elsif @new_eva > @actor.eva
        self.contents.draw_text(276, 64, 20, 32, "↑")
        self.contents.font.color = text_color(3)
      elsif @new_eva < @actor.eva
        self.contents.draw_text(276, 64, 20, 32, "↓")
        self.contents.font.color = text_color(2)
      end
      self.contents.draw_text(292, 64, 36, 32, @new_eva.to_s, 2)
    end
    if @new_str != nil
      self.contents.font.color = system_color
      if @new_str == @actor.str
        self.contents.draw_text(110, 118, 20, 32, "=")
        self.contents.font.color = normal_color
      elsif @new_str > @actor.str
        self.contents.draw_text(110, 118, 20, 32, "↑")
        self.contents.font.color = text_color(3)
      elsif @new_str < @actor.str
        self.contents.draw_text(110, 118, 20, 32, "↓")
        self.contents.font.color = text_color(2)
      end
      self.contents.draw_text(126, 118, 36, 32, @new_str.to_s, 2)
    end
    if @new_dex != nil
      self.contents.font.color = system_color
      if @new_dex == @actor.dex
        self.contents.draw_text(276, 118, 20, 32, "=")
        self.contents.font.color = normal_color
      elsif @new_dex > @actor.dex
        self.contents.draw_text(276, 118, 20, 32, "↑")
        self.contents.font.color = text_color(3)
      elsif @new_dex < @actor.dex
        self.contents.draw_text(276, 118, 20, 32, "↓")
        self.contents.font.color = text_color(2)
      end
      self.contents.draw_text(292, 118, 36, 32, @new_dex.to_s, 2)
    end
    if @new_agi != nil
      self.contents.font.color = system_color
      if @new_agi == @actor.agi
        self.contents.draw_text(110, 150, 20, 32, "=")
        self.contents.font.color = normal_color
      elsif @new_agi > @actor.agi
        self.contents.draw_text(110, 150, 20, 32, "↑")
        self.contents.font.color = text_color(3)
      elsif @new_agi < @actor.agi
        self.contents.draw_text(110, 150, 20, 32, "↓")
        self.contents.font.color = text_color(2)
      end
      self.contents.draw_text(126, 150, 36, 32, @new_agi.to_s, 2)
    end
    if @new_int != nil
      self.contents.font.color = system_color
      if @new_int == @actor.int
        self.contents.draw_text(276, 150, 20, 32, "=")
        self.contents.font.color = normal_color
      elsif @new_int > @actor.int
        self.contents.draw_text(276, 150, 20, 32, "↑")
        self.contents.font.color = text_color(3)
      elsif @new_int < @actor.int
        self.contents.draw_text(276, 150, 20, 32, "↓")
        self.contents.font.color = text_color(2)
      end
      self.contents.draw_text(292, 150, 36, 32, @new_int.to_s, 2)
    end
  end
  #--------------------------------------------------------------------------
  # * Set parameters after changing equipment
  #     new_atk  : attack power after changing equipment
  #     new_pdef : physical defense after changing equipment
  #     new_mdef : magic defense after changing equipment
  #--------------------------------------------------------------------------
  def set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
    if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or @new_eva != new_eva or @new_str != new_str or @new_dex != new_dex or @new_agi != new_agi or @new_int != new_int
      @new_atk = new_atk
      @new_pdef = new_pdef
      @new_mdef = new_mdef
      @new_eva = new_eva
      @new_str = new_str
      @new_dex = new_dex
      @new_agi = new_agi
      @new_int = new_int
      refresh
    end
  end
end

class Window_EquipShardRight < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor : actor
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 64, 368, 192)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Item Acquisition
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @data = []
    @data.push($data_weapons[@actor.weapon_shard1_id])
    @data.push($data_weapons[@actor.weapon_shard2_id])
    @data.push($data_armors[@actor.armor_shard1_id])
    @data.push($data_armors[@actor.armor_shard2_id])
    @data.push($data_armors[@actor.armor_shard3_id])
    @item_max = @data.size
    self.contents.font.color = system_color
    self.contents.draw_text(4, 32 * 0, 92, 32, "Weapon Shard")
    self.contents.draw_text(4, 32 * 1, 92, 32, "Weapon Shard")
    self.contents.draw_text(4, 32 * 2, 92, 32, "Armor Shard")
    self.contents.draw_text(4, 32 * 3, 92, 32, "Armor Shard")
    self.contents.draw_text(4, 32 * 4, 92, 32, "Armor Shard")
    if @data[5] != nil
      draw_item_name(@data[5], 92, 32 * 0)
    else
      self.contents.font.color = text_color(7)
      self.contents.draw_text(100, 32 * 0, 120, 32, "No Equipment")
    end
    if @data[6] != nil
      draw_item_name(@data[6], 92, 32 * 1)
    else
      self.contents.font.color = text_color(7)
      self.contents.draw_text(100, 32 * 1, 120, 32, "No Equipment")
    end
    if @data[7] != nil
      draw_item_name(@data[7], 92, 32 * 2)
    else
      self.contents.font.color = text_color(7)
      self.contents.draw_text(100, 32 * 2, 120, 32, "No Equipment")
    end
    if @data[8] != nil
      draw_item_name(@data[8], 92, 32 * 3)
    else
      self.contents.font.color = text_color(7)
      self.contents.draw_text(100, 32 * 3, 120, 32, "No Equipment")
    end
    if @data[9] != nil
      draw_item_name(@data[9], 92, 32 * 4)
    else
      self.contents.font.color = text_color(7)
      self.contents.draw_text(100, 32 * 4, 120, 32, "No Equipment")
    end
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end

class Window_EquipShard < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor      : actor
  #     equip_type : equip region (0-3)
  #--------------------------------------------------------------------------
  def initialize(actor, equip_type)
    super(368, 64, 272, 416)
    @actor = actor
    @equip_type = equip_type
    @item_max = 1
    @column_max = 1
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # * Item Acquisition
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    # Add equippable weapons
    if @equip_type == 5
      element = SEG_LEGACY::SHARD::WELEMENT
      for i in 1...$data_weapons.size
        if $game_party.weapon_number(i) > 0 and $data_weapons[i].element_set.include?(element)
          @data.push($data_weapons[i])
        end
      end
    elsif @equip_type == 6
      element = SEG_LEGACY::SHARD::WELEMENT
      for i in 1...$data_weapons.size
        if $game_party.weapon_number(i) > 0 and $data_weapons[i].element_set.include?(element)
          @data.push($data_weapons[i])
        end
      end
    elsif @equip_type != 0..6
      element = SEG_LEGACY::SHARD::AELEMENT
      for i in 1...$data_armors.size
        if $game_party.armor_number(i) > 0 and $data_armors[i].guard_element_set.include?(element)
          @data.push($data_armors[i])
        end
      end
    end
    # Add blank page
    @data.push(nil)
    # Make a bit map and draw all items
    @item_max = @data.size
    self.contents = Bitmap.new(width - 32, row_max * 32)
    for i in 0...@item_max-1
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    x = 4 + index % 1 * (288 + 32)
    y = index * 32
    case item
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    bitmap = RPG::Cache.icon(item.icon_name)
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 190, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 210, y, 24, 32, number.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end

class Scene_EquipShard
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor_index : actor index
  #     equip_index : equipment index
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0, equip_index = 0)
    @actor_index = actor_index
    @equip_index = equip_index
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    @spriteset = Spriteset_Map.new
    # Get actor
    @actor = $game_party.actors[@actor_index]
    # Make windows
    @help_window = Window_Help.new
    @left_window = Window_EquipShardLeft.new(@actor)
    @right_window = Window_EquipShardRight.new(@actor)
    @item_window1 = Window_EquipShard.new(@actor, 5)
    @item_window2 = Window_EquipShard.new(@actor, 6)
    @item_window3 = Window_EquipShard.new(@actor, 7)
    @item_window4 = Window_EquipShard.new(@actor, 8)
    @item_window5 = Window_EquipShard.new(@actor, 9)
    # Associate help window
    @right_window.help_window = @help_window
    @item_window1.help_window = @help_window
    @item_window2.help_window = @help_window
    @item_window3.help_window = @help_window
    @item_window4.help_window = @help_window
    @item_window5.help_window = @help_window
    # Set cursor position
    @right_window.index = @equip_index
    refresh
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @spriteset.dispose
    @help_window.dispose
    @left_window.dispose
    @right_window.dispose
    @item_window1.dispose
    @item_window2.dispose
    @item_window3.dispose
    @item_window4.dispose
    @item_window5.dispose
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    # Set item window to visible
    @item_window1.visible = (@right_window.index == 0)
    @item_window2.visible = (@right_window.index == 1)
    @item_window3.visible = (@right_window.index == 2)
    @item_window4.visible = (@right_window.index == 3)
    @item_window5.visible = (@right_window.index == 4)
    # Get currently equipped item
    item1 = @right_window.item
    # Set current item window to @item_window
    case @right_window.index
    when 0
      @item_window = @item_window1
    when 1
      @item_window = @item_window2
    when 2
      @item_window = @item_window3
    when 3
      @item_window = @item_window4
    when 4
      @item_window = @item_window5
    end
    # If right window is active
    if @right_window.active
      # Erase parameters for after equipment change
      @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil)
    end
    # If item window is active
    if @item_window.active
      # Get currently selected item
      item2 = @item_window.item
      # Change equipment
      last_hp = @actor.hp
      last_sp = @actor.sp
      @actor.equip(@right_window.index+5, item2 == nil ? 0 : item2.id)
      # Get parameters for after equipment change
      new_atk = @actor.atk
      new_pdef = @actor.pdef
      new_mdef = @actor.mdef
      new_eva = @actor.eva
      new_str = @actor.str
      new_dex = @actor.dex
      new_agi = @actor.agi
      new_int = @actor.int
      # Return equipment
      @actor.equip(@right_window.index+5, item1 == nil ? 0 : item1.id)
      @actor.hp = last_hp
      @actor.sp = last_sp
      # Draw in left window
      @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @left_window.update
    @right_window.update
    @item_window.update
    refresh
    # If right window is active: call update_right
    if @right_window.active
      update_right
      return
    end
    # If item window is active: call update_item
    if @item_window.active
      update_item
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when right window is active)
  #--------------------------------------------------------------------------
  def update_right
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to menu screen
      $scene = Scene_Menu.new(1)
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # If equipment is fixed
      if @actor.equip_fix?(@right_window.index)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Activate item window
      @right_window.active = false
      @item_window.active = true
      @item_window.index = 0
      return
    end
    # If R button was pressed
    if Input.trigger?(Input::R)
      # Play cursor SE
      $game_system.se_play($data_system.cursor_se)
      # To next actor
      @actor_index += 1
      @actor_index %= $game_party.actors.size
      # Switch to different equipment screen
      $scene = Scene_Equip.new(@actor_index, @right_window.index)
      return
    end
    # If L button was pressed
    if Input.trigger?(Input::L)
      # Play cursor SE
      $game_system.se_play($data_system.cursor_se)
      # To previous actor
      @actor_index += $game_party.actors.size - 1
      @actor_index %= $game_party.actors.size
      # Switch to different equipment screen
      $scene = Scene_Equip.new(@actor_index, @right_window.index)
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when item window is active)
  #--------------------------------------------------------------------------
  def update_item
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Activate right window
      @right_window.active = true
      @item_window.active = false
      @item_window.index = -1
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Play equip SE
      $game_system.se_play($data_system.equip_se)
      # Get currently selected data on the item window
      item = @item_window.item
      # Change equipment
      @actor.equip(@right_window.index+5, item == nil ? 0 : item.id)
      # Activate right window
      @right_window.active = true
      @item_window.active = false
      @item_window.index = -1
      # Remake right window and item window contents
      @right_window.refresh
      @item_window.refresh
      return
    end
  end
end
Now it's a matter of getting the shards to give a boost, rewrite how the stats are displayed and refreshed in your scene, showing the shard as equipped, and refreshing all of your @item_window's whenever a shard is equipped.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Shadow Eye31

Okay, now I'm embarrassed... But at least now I know I was on the right track with the index, I guess?

Thanks! The setup for the equipment giving boosts to stats, states, and elements was already finished before hand, so, while I need to test it, it should work. And I just fixed the display and refresh so it acts like a normal equipment screen, save the new equip types. But again, thanks for the help!

KK20

If you noticed, I deleted that +5 I mentioned earlier while adding 5 to any instance you had the method equip. When you get @right_window.index, the only values you will receive are 0 to 4. If you call equip, these will replace your default equipment slots (Weapon, Shield, Helm, Armor, Acces.). So the @right_window.index + 5 ensures that you will be equipping to slots 5 to 9.

The whole @data[self.index + 5] thing really blew me away though. If you only have two shards available to choose from (as provided by the demo), and you select the first shard, item would get @data[5]...which doesn't have anything stored in that element and would return nil. That was the reason why you said you couldn't equip anything at all.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Shadow Eye31

I see. I noticed those changes, but its nice to know the reasoning behind it. I probably would have never figured that out... Now that I really think about it, I don't know why I was so stuck on item being the cause. It really doesn't make sense now. I shouldn't try writing/reading code when I'm tired I guess.

Thank you again!