RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Just Looking For A Little Help

0 Members and 1 Guest are viewing this topic.

***
~Banned~
Rep:
Level 88
~Banned~
Alright right now I'm just wondering if it is possible to have a larger show choices code. Generally I mean make it infinite and have it have a scroll bar instead of streaching the window to big.

Now for a bigger project, I was wondering if someone would be willing to aid me in the revamping of the shop system. I'm looking for it to show the bonus stats, attributes, etc. as well as the description. That way it would be alot easier for a character to see the benefits as well as a good non-shortened description.
~Banned~

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
Code: [Select]
#==============================================================================
# Shop layout from Chaos Project - Nemesis' Wrath™ by Blizzard
#==============================================================================

#==============================================================================
# Window_ShopBuy
#==============================================================================

class Window_ShopBuy < Window_Selectable

  def initialize(shop_goods)
    super(320, 80, 308, 384)
    @shop_goods = shop_goods
    refresh
    self.index = 0
  end

  def item
    return @data[self.index]
  end

  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for goods_item in @shop_goods
      case goods_item[0]
      when 0
        item = $data_items[goods_item[1]]
      when 1
        item = $data_weapons[goods_item[1]]
      when 2
        item = $data_armors[goods_item[1]]
      end
      if item != nil
        @data.push(item)
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      if $fontface != nil
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsize
      elsif $defaultfonttype != nil
        self.contents.font.name = $defaultfonttype
        self.contents.font.size = $defaultfontsize
      end
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end

  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    x = 4
    y = index * 32
    if item.price <= $game_party.gold and number < 99
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    rect = Rect.new(x, y, self.width - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    if item.price <= $game_party.gold and number < 99
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 176, y, 88, 32, item.price.to_s, 2)
  end
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
 
end

#==============================================================================
# Window_ShopSell
#==============================================================================

class Window_ShopSell < Window_Selectable

  def initialize
    super(16, 80, 608, 320)
    @column_max = 2
    self.z = 4000
    refresh
    self.index = 0
  end

  def item
    return @data[self.index]
  end

  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        for x in 0...$basic_items_ids.size
          if i == $basic_items_ids[x]
            @data.push($data_items [i] )
          end
        end
      end
    end
    for i in 1...$data_weapons.size
      if $game_party.weapon_number(i) > 0
        @data.push($data_weapons[i])
      end
    end
    for i in 1...$data_armors.size
      if $game_party.armor_number(i) > 0
        @data.push($data_armors[i])
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      if $fontface != nil
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsize
      elsif $defaultfonttype != nil
        self.contents.font.name = $defaultfonttype
        self.contents.font.size = $defaultfontsize
      end
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end

  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    x = 4 + index % 2 * 304
    y = index / 2 * 32
    if item.price > 0
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    if item.price > 0
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 224, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 240, y, 24, 32, number.to_s, 2)
  end

  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
 
end

#==============================================================================
# Window_ShopNumber
#==============================================================================

class Window_ShopNumber < Window_Base

  def initialize
    super(320, 80, 308, 384)
    self.contents = Bitmap.new(width - 32, height - 32)
    if $fontface != nil
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
    end
    @item = nil
    @max = 1
    @price = 0
    @number = 1
    self.z = 5000
  end

  def set(item, max, price)
    @item = item
    @max = max
    @price = price
    @number = 1
    refresh
  end

  def number
    return @number
  end

  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 276, 32, "How many?")
    draw_item_name(@item, 4, 96)
    self.contents.font.color = normal_color
    self.contents.draw_text(208, 96, 32, 32, "×")
    self.contents.draw_text(244, 96, 24, 32, @number.to_s, 2)
    self.cursor_rect.set(240, 96, 32, 32)
    domination = $data_system.words.gold
    cx = contents.text_size(domination).width
    total_price = @price * @number
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 128, 308-cx, 32, total_price.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(268-cx, 160, cx, 32, domination, 2)
  end

  def update
    super
    if self.active
      if Input.repeat?(Input::RIGHT) and @number < @max
        $game_system.se_play($data_system.cursor_se)
        @number += 1
        refresh
      end
      if Input.repeat?(Input::LEFT) and @number > 1
        $game_system.se_play($data_system.cursor_se)
        @number -= 1
        refresh
      end
      if Input.repeat?(Input::UP) and @number < @max
        $game_system.se_play($data_system.cursor_se)
        @number = [@number + 10, @max].min
        refresh
      end
      if Input.repeat?(Input::DOWN) and @number > 1
        $game_system.se_play($data_system.cursor_se)
        @number = [@number - 10, 1].max
        refresh
      end
    end
  end
 
end

#==============================================================================
# Window_ShopStatus
#==============================================================================

class Window_ShopStatus < Window_Base

  def initialize
    super(16, 80, 304, 320)
    self.contents = Bitmap.new(width - 32, height - 32)
    if $fontface != nil
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
    end
    @item = nil
    self.z = 4000
    refresh
  end

  def refresh
    self.contents.clear
    if @item == nil
      return
    end
    case @item
    when RPG::Item
      number = $game_party.item_number(@item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(@item.id)
    when RPG::Armor
      number = $game_party.armor_number(@item.id)
    end
    self.contents.font.color = system_color
    self.contents.draw_text(44, 0, 200, 32, "possesed")
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 32, 32, number.to_s, 2)
    if @item.is_a?(RPG::Item)
      return
    end
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.equippable?(@item)
        self.contents.font.color = normal_color
      else
        self.contents.font.color = disabled_color
      end
      self.contents.draw_text(4, 32 + 64 * i, 120, 32, actor.name)
      if @item.is_a?(RPG::Weapon)
        item1 = $data_weapons[actor.weapon_id]
      elsif @item.kind == 0
        item1 = $data_armors[actor.armor1_id]
      elsif @item.kind == 1
        item1 = $data_armors[actor.armor2_id]
      elsif @item.kind == 2
        item1 = $data_armors[actor.armor3_id]
      else
        item1 = $data_armors[actor.armor4_id]
      end
      if actor.equippable?(@item)
        if @item.is_a?(RPG::Weapon)
          atk1 = item1 != nil ? item1.atk : 0
          atk2 = @item != nil ? @item.atk : 0
          change1 = atk2 - atk1
        end
        if @item.is_a?(RPG::Armor)
          pdef1 = item1 != nil ? item1.pdef : 0
          mdef1 = item1 != nil ? item1.mdef : 0
          pdef2 = @item != nil ? @item.pdef : 0
          mdef2 = @item != nil ? @item.mdef : 0
          change1 = pdef2 - pdef1
          change2 = mdef2 - mdef1
        end
        if change2 != nil
          if actor.equippable?(@item)
            self.contents.font.color = normal_color
          else
            self.contents.font.color = disabled_color
          end
          self.contents.draw_text(156, 32 + 64 * i, 56, 32,
            sprintf("%+d", change1), 2)
          if actor.equippable?(@item)
            self.contents.font.color = normal_color
          else
            self.contents.font.color = disabled_color
          end
          self.contents.draw_text(212, 32 + 64 * i, 56, 32,
            sprintf("%+d", change2), 2)
        elsif change1 != nil
          if actor.equippable?(@item)
            self.contents.font.color = normal_color
          else
            self.contents.font.color = disabled_color
          end
          self.contents.draw_text(156, 32 + 64 * i, 112, 32,
            sprintf("%+d", change1), 2)
        end
      end
      if item1 != nil
        x = 4
        y = 64 + 64 * i
        bitmap = RPG::Cache.icon(item1.icon_name)
        opacity = self.contents.font.color == normal_color ? 255 : 128
        self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
        if actor.equippable?(@item)
          self.contents.font.color = normal_color
        else
          self.contents.font.color = disabled_color
        end
        self.contents.draw_text(x + 28, y, 212, 32, item1.name)
      end
    end
    if change2 != nil
      self.contents.font.color = normal_color
      self.contents.draw_text(156, 0, 56, 32, "PDef", 2)
      self.contents.draw_text(212, 0, 56, 32, "MDef", 2)
    elsif change1 != nil
      self.contents.font.color = normal_color
      self.contents.draw_text(212, 0, 56, 32, "Atk", 2)
    end
  end

  def item=(item)
    if @item != item
      @item = item
      refresh
    end
  end
 
end

#==============================================================================
# Scene_Shop
#==============================================================================

class Scene_Shop

  def main
    c = ["Buy", "Sell", "Cancel"]
    @help_window = Window_Help.new
    @command_window = Window_Command.new(192, c)
    @command_window.x = 16
    @command_window.y = 80
    @gold_window = Window_Gold.new
    @gold_window.x = 16
    @gold_window.y = 400
    @buy_window = Window_ShopBuy.new($game_temp.shop_goods)
    @buy_window.active = false
    @buy_window.visible = false
    @buy_window.help_window = @help_window
    @sell_window = Window_ShopSell.new
    @sell_window.active = false
    @sell_window.visible = false
    @sell_window.help_window = @help_window
    @number_window = Window_ShopNumber.new
    @number_window.active = false
    @number_window.visible = false
    @status_window = Window_ShopStatus.new
    @status_window.visible = false
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @help_window.dispose
    @command_window.dispose
    @gold_window.dispose
    @buy_window.dispose
    @sell_window.dispose
    @number_window.dispose
    @status_window.dispose
  end

  def update
    @help_window.update
    @command_window.update
    @gold_window.update
    @buy_window.update
    @sell_window.update
    @number_window.update
    @status_window.update
    if @command_window.active
      update_command
      return
    end
    if @buy_window.active
      update_buy
      return
    end
    if @sell_window.active
      update_sell
      return
    end
    if @number_window.active
      update_number
      return
    end
  end

  def update_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      case @command_window.index
      when 0
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @buy_window.active = true
        @buy_window.visible = true
        @buy_window.refresh
        @status_window.visible = true
      when 1
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @sell_window.active = true
        @sell_window.visible = true
        @sell_window.refresh
      when 2
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Map.new
      end
      return
    end
  end

  def update_buy
    @status_window.item = @buy_window.item
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @command_window.active = true
      @buy_window.active = false
      @buy_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      @help_window.set_text("")
      return
    end
    if Input.trigger?(Input::C)
      @item = @buy_window.item
      if @item == nil or @item.price > $game_party.gold
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      case @item
      when RPG::Item
        number = $game_party.item_number(@item.id)
      when RPG::Weapon
        number = $game_party.weapon_number(@item.id)
      when RPG::Armor
        number = $game_party.armor_number(@item.id)
      end
      if number == 99
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      max = @item.price == 0 ? 99 : $game_party.gold / @item.price
      max = [max, 99 - number].min
      @buy_window.active = false
      @buy_window.visible = false
      @number_window.set(@item, max, @item.price)
      @number_window.active = true
      @number_window.visible = true
    end
  end

  def update_sell
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @command_window.active = true
      @sell_window.active = false
      @sell_window.visible = false
      @status_window.item = nil
      @help_window.set_text("")
      return
    end
    if Input.trigger?(Input::C)
      @item = @sell_window.item
      @status_window.item = @item
      if @item == nil or @item.price == 0
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      case @item
      when RPG::Item
        number = $game_party.item_number(@item.id)
      when RPG::Weapon
        number = $game_party.weapon_number(@item.id)
      when RPG::Armor
        number = $game_party.armor_number(@item.id)
      end
      max = number
      @sell_window.active = false
      @sell_window.visible = false
      @number_window.set(@item, max, @item.price / 2)
      @number_window.active = true
      @number_window.visible = true
      @status_window.visible = true
    end
  end

  def update_number
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @number_window.active = false
      @number_window.visible = false
      case @command_window.index
      when 0
        @buy_window.active = true
        @buy_window.visible = true
      when 1
        @sell_window.active = true
        @sell_window.visible = true
        @status_window.visible = false
      end
      return
    end
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.shop_se)
      @number_window.active = false
      @number_window.visible = false
      case @command_window.index
      when 0
        $game_party.lose_gold(@number_window.number * @item.price)
        case @item
        when RPG::Item
          $game_party.gain_item(@item.id, @number_window.number)
        when RPG::Weapon
          $game_party.gain_weapon(@item.id, @number_window.number)
        when RPG::Armor
          $game_party.gain_armor(@item.id, @number_window.number)
        end
        @gold_window.refresh
        @buy_window.refresh
        @status_window.refresh
        @buy_window.active = true
        @buy_window.visible = true
      when 1
        $game_party.gain_gold(@number_window.number * (@item.price / 2))
        case @item
        when RPG::Item
          $game_party.lose_item(@item.id, @number_window.number)
        when RPG::Weapon
          $game_party.lose_weapon(@item.id, @number_window.number)
        when RPG::Armor
          $game_party.lose_armor(@item.id, @number_window.number)
        end
        @gold_window.refresh
        @sell_window.refresh
        @status_window.refresh
        @sell_window.active = true
        @sell_window.visible = true
        @status_window.visible = false
      end
      return
    end
  end
 
end

For the choices try www.rxmp.org/forums . I have seen such a script there once long ago (I don't go there anymore >_> ).
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!