Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[VX] Tag translation? (I don't know what I type to tag exactly)

ikos

Member

Alright, I have an equipment script, that lets you add new equipment, and you have to tag equipment in the notes section.

Here's the script:
Code:
#==============================================================================
# ** Multi-Elot Equipment VX
#------------------------------------------------------------------------------
#    Section 1:  Modules
#==============================================================================

module MS_MOD
  
#==============================================================================
# ***    C  O  N  F  I  G  U  R  A  T  I  O  N     S  E  C  T  I  O  N    *** #
#==============================================================================

  ARMOR_KINDS           = [0, 3, 3, 5]
  EXTRA_SLOT_NAMES      = ["Gauntlet", "Boots", "Amulet"] 
  
  CURSED_WEAPONS        = []
  CURSED_ARMOR          = []
  CURSED_COLOR          = 30

  SWITCH_EQUIP_WEAPONS  = []
  SWITCH_EQUIP_ARMORS   = []
  
end



#==============================================================================
# ** TAG CONSTANT
#------------------------------------------------------------------------------
#  Constant value(s) used to gain data from the 'note' section.
#==============================================================================

# Used for 'note-tagged' Multi-Slot Equipment
SLOT_KIND = /(?:SLOT_KIND|Multi-Slot:)\s*(.+)/i

#==============================================================================
# ** RPG
#------------------------------------------------------------------------------
#  A module containing RPGVX Data Structures.
#==============================================================================

module RPG
  #============================================================================
  # ** Armor
  #----------------------------------------------------------------------------
  #  Data class for armor.
  #============================================================================
  
  class Armor < RPG::BaseItem
    #------------------------------------------------------------------------
    # * Alias Listings
    #------------------------------------------------------------------------
    alias ms_module_kind kind
    #------------------------------------------------------------------------
    # * Set New Item Types
    #------------------------------------------------------------------------
    def set_new_item_types
      @__type = -1
      self.note.split(/[\r\n]+/).each { |line|
                if line =~ SLOT_KIND
                  line_index = MS_MOD::EXTRA_SLOT_NAMES.index($1)
                  next if line_index == nil
                  @__type = line_index + 4
                end   }
    end
    #------------------------------------------------------------------------
    # * Set Advanced 'Slot' Type
    #------------------------------------------------------------------------
    def type
      set_new_item_types if @__type == nil
      return (@__type == -1 ? ms_module_kind : @__type)
    end
  end
end

The thing, I don't understand what "/(?:SLOT_KIND|Multi-Slot:)\s*(.+)/i" even means. ._.
Any help on what characters I need to type? ^^;

~Ikos out
 
That is a regexp string it's usually used to compare 2 strings, I'm not a master of regexp so I don't know exactly what that line does, well anyway
if you compare 2 strings like this it will return true
Code:
"my name is S.S Muu, nice!" == "my name is S.S Muu, nice!"
then if you do it like this
Code:
"my name is S.S Muu, nice!" == /my name is (.*), nice!/
it would still return true
basically that would look for "my name is something, nice!" where something could be really anything.
like I said I'm not an regexp expert so I don't know what your line does.
well, hope it helps  :thumb:
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top