[RESOLVED] Help,Help (again)

Started by dark-archangel, March 22, 2008, 02:52:47 pm

Previous topic - Next topic

dark-archangel

Juan tried to help me....

Spoiler: ShowHide
#============================================================================
# ** Location Display
#----------------------------------------------------------------------------
# Nitt
# Based on the Map Location Popup script by Yeyinde
# 1.0.0
# 10:th of January 2008
# SDK Version : (2.2) - Parts: I, III
#============================================================================

#-----------------------------------------------------------------------------
# SDK Auto-installer
#-----------------------------------------------------------------------------
unless Object.const_defined?(:SDK)
  begin
    require 'SDK'
  rescue LoadError
    print 'This script (Location Display) requires the SDK to run.'
    exit 1
  end
end

#-----------------------------------------------------------------------------
# SDK Log
#-----------------------------------------------------------------------------
SDK.log('Location Display', 'Nitt', '1.00', '01/10/08')

#-----------------------------------------------------------------------------
# SDK Check Requirements
#-----------------------------------------------------------------------------
SDK.check_requirements(2.2, [1, 3])

#-----------------------------------------------------------------------------
# SDK Enabled Check
#-----------------------------------------------------------------------------
if SDK.enabled?('Location Display')

#==============================================================================
# ** Location_Text
#------------------------------------------------------------------------------
#  Customization module
#==============================================================================

module Location_Popup
  # Transition Duration (Fade-in time in frames)
  TRANSITION_TIME = 10
  # Don't show for (Syntax: [map_id1, mapid2, etc.] EX. [1, 5, 6])
  NO_POPUP_MAPS = []
  Font_Size = 14
end

#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
#  This class handles temporary data that is not included with save data.
#  Refer to "$game_temp" for the instance of this class.
#==============================================================================

class Game_Temp
  #---------------------------------------------------------------------------
  # * Aliasing
  #---------------------------------------------------------------------------
  alias_method :map_name_popup_int, :initialize
  #---------------------------------------------------------------------------
  # * Public Instance Variables
  #---------------------------------------------------------------------------
  attr_accessor :new_location_name
  attr_accessor :location_popup_show
  #---------------------------------------------------------------------------
  # * Object Initialization
  #---------------------------------------------------------------------------
  def initialize
    # Call aliased method
    map_name_popup_int
    # Crate new variables
    @new_location_name = ''
    @location_popup_show = false
  end
end

#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This class handles the map. It includes scrolling and passable determining
#  functions. Refer to "$game_map" for the instance of this class.
#==============================================================================

class Game_Map
  #---------------------------------------------------------------------------
  # * Aliasing
  #---------------------------------------------------------------------------
  alias_method :map_name_popup_setup, :setup
  #--------------------------------------------------------------------------
  # * Setup
  #     map_id : map ID
  #--------------------------------------------------------------------------
  def setup(map_id)
    # Call aliased method
    map_name_popup_setup(map_id)
    # Set temporary variable
    location_text = $data_mapinfos[@map_id].name
    $game_temp.new_location_name = location_text
    $game_temp.location_popup_show = true
  end
end

#==============================================================================
# ** Sprite_LocationPopup
#------------------------------------------------------------------------------
#  This sprite is used to display the current location when it is entered.  It
#  observes $game_temp.new_location_name to know when to refresh
#==============================================================================

class Sprite_LocationPopup < Sprite
  #---------------------------------------------------------------------------
  # * Object Initialization
  #---------------------------------------------------------------------------
  def initialize
    # Call superclass method
    super()
    # Set co-ordinates
    self.x = 0
    self.y = 455
    self.z = 999999
    # Set some variables to save space
    @transition_time = [Location_Popup::TRANSITION_TIME, 1].max
    # Refresh
    refresh
  end
  #---------------------------------------------------------------------------
  # * Reset Variables
  #---------------------------------------------------------------------------
  def reset_variables
    @current_location = $game_temp.new_location_name
    @frames_remaining = @transition_time
  end
  #---------------------------------------------------------------------------
  # * Refresh
  #---------------------------------------------------------------------------
  def refresh
    # Clear existing bitmap
    if self.bitmap != nil
      self.bitmap.dispose
      self.bitmap = nil
    end
    # Reset variables
    reset_variables
    # Stop if the location is not to be displayed on this map
    if Location_Popup::NO_POPUP_MAPS.include?($game_map.map_id) ||
        !$game_temp.location_popup_show
      @frames_remaining = 0
      return
    end
    $game_temp.location_popup_show = false
    # Draw the text
    text = @current_location
    bitmap = Bitmap.new(1, 1)
    width = bitmap.text_size(text).width + 33
    bitmap.dispose
    self.bitmap = Bitmap.new(width, 32)
    self.bitmap.font.color = Color.new(0, 0, 0)
    self.bitmap.font.size =  Location_Popup::Font_Size
    self.bitmap.draw_text(33, 1, width, 16, text)
    self.bitmap.draw_text(32, 1, width, 16, text)
    self.bitmap.draw_text(31, 0, width, 16, text)
    self.bitmap.draw_text(31, 2, width, 16, text)
    self.bitmap.font.color = Color.new(255, 255, 255)
    self.bitmap.draw_text(31, 1, width, 15, text)
    icon = RPG::Cache.icon('038-Item07')
    src_rect = Rect.new(0, 0, 32, 32)
    self.bitmap.blt(0, 0, icon, src_rect)   
    # Reset opacity
    self.opacity = 0
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Call superclass method
    super
    # Refresh if location was changed
    refresh if @current_location != $game_temp.new_location_name
    # If there is still a frame remaining
    if @frames_remaining > 1
      self.opacity += 256 / @transition_time
      # Remove one frame
      @frames_remaining -= 1
    end
  end
end

#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
#  This class performs title screen processing.
#==============================================================================

class Scene_Title
  #---------------------------------------------------------------------------
  # * Aliasing
  #---------------------------------------------------------------------------
  alias_method :map_name_popup_database, :main_database
  #--------------------------------------------------------------------------
  # * Main Processing : Database Initialization
  #--------------------------------------------------------------------------
  def main_database
    # Call aliased method
    map_name_popup_database
    if $data_mapinfos.nil?
      $data_mapinfos = load_data('Data/MapInfos.rxdata')
    end
  end
end

#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs map screen processing.
#==============================================================================

class Scene_Map
  #---------------------------------------------------------------------------
  # * Aliasing
  #---------------------------------------------------------------------------
  alias_method :map_name_popup_sprite, :main_sprite
  #--------------------------------------------------------------------------
  # * Main Processing : Sprite Initialization
  #--------------------------------------------------------------------------
  def main_sprite
    map_name_popup_sprite
    @location_popup_sprite = Sprite_LocationPopup.new
  end
end

end
#-----------------------------------------------------------------------------
# End SDK Enabled Check
#-------------------------------------------------------------


I need help with the alignment,I mean can make the distance between the icon and text,and can lower the text?

Juan

Forgot to mention it uses the sdk.
Dropbox Who need luck when you can make your own.
3ds Friend code: ShowHide
 4468 1422  6617

Fantasist

March 23, 2008, 01:27:03 am #2 Last Edit: March 23, 2008, 01:29:44 am by Fantasist

  #---------------------------------------------------------------------------
  # * Refresh
  #---------------------------------------------------------------------------
  def refresh
    # Clear existing bitmap
    if self.bitmap != nil
      self.bitmap.dispose
      self.bitmap = nil
    end
    # Reset variables
    reset_variables
    # Stop if the location is not to be displayed on this map
    if Location_Popup::NO_POPUP_MAPS.include?($game_map.map_id) ||
        !$game_temp.location_popup_show
      @frames_remaining = 0
      return
    end
    $game_temp.location_popup_show = false
    # Draw the text
    text = @current_location
    bitmap = Bitmap.new(1, 1)
    width = bitmap.text_size(text).width + 33
    bitmap.dispose
    self.bitmap = Bitmap.new(width, 32)
    self.bitmap.font.color = Color.new(0, 0, 0)
    self.bitmap.font.size =  Location_Popup::Font_Size
    self.bitmap.draw_text(33, 1, width, 16, text)
    self.bitmap.draw_text(32, 1, width, 16, text)
    self.bitmap.draw_text(31, 0, width, 16, text)
    self.bitmap.draw_text(31, 2, width, 16, text)
    self.bitmap.font.color = Color.new(255, 255, 255)
    self.bitmap.draw_text(31, 1, width, 15, text)
    icon = RPG::Cache.icon('038-Item07')
    src_rect = Rect.new(0, 0, 32, 32)
    self.bitmap.blt(0, 0, icon, src_rect)   
    # Reset opacity
    self.opacity = 0
  end


Just mess around with the numbers in those self.bitmap lines.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




dark-archangel