Ruby Scripting help! menu

User Tag List

Results 1 to 1 of 1
  1. #1
    B14d3r11's Avatar Sergeant Major
    Reputation
    9
    Join Date
    Jan 2007
    Posts
    179
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Ruby Scripting help!

    I am working on a project and i got a file from a friend to implement into it and i just cant mold it to the way i want,
    Code:
    #======================================#
    # ICONNAME = "Icon name here" # name of icon to display rating
    # RARITYNAME = "Rarity name here" # word you want to call the rarity/rating
    #======================================#
    ICONNAME = "low"
    RARITYNAME = "Rating"
    
    module RPG
      class Item
        def rarity
          case id
          #======================================#
          # BEGIN CONFIG
          #======================================#
          when 1 then return 1
          when 2,3 then return 3
          when 32 then return 5
          when 8 then return 2
          #======================================#
          # END CONFIG
          #======================================#
          end
          return 1
        end
      end
      class Weapon
        def rarity
          case id
          #======================================#
          # BEGIN CONFIG
          #======================================#
          when 1 then return 1
          when 2 then return 3
          when 32 then return 5
          when 8 then return 2
          #======================================#
          # END CONFIG
          #======================================#
          end
          return 1
        end
      end
      class Armor
        def rarity
          case id
          #======================================#
          # BEGIN CONFIG
          #======================================#
          when 1 then return 1
          when 2 then return 3
          when 32 then return 5
          when 8 then return 2
          #======================================#
          # END CONFIG
          #======================================#
          end
          return 1
        end
      end
    end
    class Window_Item < Window_Selectable
      def initialize
        super(0, 64, 640, 352)
        @column_max = 1
        refresh
        self.index = 0
        if $game_temp.in_battle
          self.y = 64
          self.height = 256
          self.back_opacity = 160
        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
        if item.is_a?(RPG::Item) and
           $game_party.item_can_use?(item.id)
          self.contents.font.color = normal_color
        else
          self.contents.font.color = disabled_color
        end
        x = 4 + index % 1 * (288 + 32)
        y = index / 1 * 32
        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
        item.rarity.times do |i| 
          src_rect = Rect.new(0, 0, 24, 24)
          self.contents.blt(300 + 32 * i + 16, y + 3, RPG::Cache.icon(ICONNAME.to_s), src_rect)
        end
        self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
        self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
        self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
        self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
      end
    end
    class Window_ItemName < Window_Base
      def initialize
        super(0, 0, 320, 64)
        self.contents = Bitmap.new(width - 32, height - 32)
        refresh
      end
      def refresh
        self.contents.clear
        self.contents.font.color = system_color
        self.contents.draw_text(4, 0, 640, 32, "Item Name", 0)
      end
    end
    class Window_Rating < Window_Base
      def initialize
        super(320, 0, 320, 64)
        self.contents = Bitmap.new(width - 32, height - 32)
        refresh
      end
      def refresh
        self.contents.clear
        self.contents.font.color = system_color
        self.contents.draw_text(4, 0, 640, 32, RARITYNAME, 0)
      end
    end
    class Scene_Item
      def main
        @help_window = Window_Help.new
        @help_window.y = 416
        @xtrinfo = Window_ItemName.new
        @rare = Window_Rating.new
        @item_window = Window_Item.new
        @item_window.help_window = @help_window
        @target_window = Window_Target.new
        @target_window.visible = false
        @target_window.active = false
        Graphics.transition
        loop do
          Graphics.update
          Input.update
          update
          if $scene != self
            break
          end
        end
        Graphics.freeze
        @help_window.dispose
        @rare.dispose
        @xtrinfo.dispose
        @item_window.dispose
        @target_window.dispose
      end
    end
    This works 100% fine i just want the
    Code:
    ICONNAME
    to change its Icon depending on the rarity like 1-3 = low 4-6 = med and 7-9 = high.

    Ruby Scripting help!

Similar Threads

  1. Lua script help and general questions from beginner
    By WinKIller0 in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 02-23-2008, 04:38 AM
  2. LUA Boss Script Help
    By neurothymia in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 02-05-2008, 02:57 PM
  3. Need LUA Scripting Help ?
    By Snailz in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 02-04-2008, 12:36 PM
  4. Scripting help please will +rep need for a new server
    By runiker in forum WoW EMU Guides & Tutorials
    Replies: 0
    Last Post: 01-22-2008, 04:05 AM
  5. [Ascent] Boss Scripts help
    By n0t5ew in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 12-24-2007, 03:04 PM
All times are GMT -5. The time now is 03:55 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search