[RESOLVED]game_guy script modification request

Started by jyumai, February 05, 2011, 03:41:24 pm

Previous topic - Next topic

jyumai

February 05, 2011, 03:41:24 pm Last Edit: February 05, 2011, 04:33:04 pm by jyumai
Can someone modify game_guy's coordinate displayer script so that it doesn't only work in debug mode?

Here's th script:
Spoiler: ShowHide
#==============================================================================#
#                     Game Guy's Coordinate Displayer                          #
#==============================================================================#
=begin
This will show a window on the map displaying X and Y coordinates.

Customization
module
 Location = "Upper Right Corner" "Lower Left Corner" "Upper Left Corner" or "Lower Right Corner"
 Transparent = "Non Transparent" "Semi-Transparent" "Transparent"
 UsePicture = true or false if set to true and transparent = "Non Transparent" it will automatically set it to "Transparent"
 PictureName = "picture name here" must be in quotes
end
=end
LOCATION  = "Upper Right Corner"
TRANSPARENT = "Semi-Transparent"
USEPICTURE = false  #NOT WORKING YET SO GO AHEAD AND SET IT TO TRUE BUT STILL WONT WORK
PICTURENAME = "picture name here"
class Window_Coordinate < Window_Base
 
 def initialize
   super(0, 0, 160, 96)
   self.contents = Bitmap.new(width - 32, height - 32)
   refresh
 end
 
 def refresh
   self.contents.clear
   self.contents.font.color = normal_color
   self.contents.draw_text(4, 0, 120, 32, "X:     " + $playerx.to_s)
   self.contents.font.color = normal_color
   self.contents.draw_text(4, 32, 120, 32, "Y:     " + $playery.to_s)
 end
 
 def update
   super
   $playerx = $game_player.x * 32
   $playery = $game_player.y * 32
   refresh
 end
 
end

class Scene_Map

 alias add_coordinate_window_later main
 def main
   if $DEBUG
     @coordinate = Window_Coordinate.new
     if LOCATION == "Upper Right Corner"
       @coordinate.x = 480
     elsif LOCATION == "Upper Left Corner"
       @coordinate.x = 0
     elsif LOCATION == "Lower Right Corner"
       @coordinate.x = 480
       @coordinate.y = 374
     else
       @coordinate.y = 374
     end
     if USEPICTURE == true
       if TRANSPARENT == "Non Transparent"
         @coordinate.opacity = 0
         @coordinate.back_opacity = 0
       end
     end
     if TRANSPARENT == "Transparent"
       @coordinate.opacity = 0
       @coordinate.back_opacity = 0
     elsif TRANSPARENT == "Semi-Transparent"
       @coordinate.opacity = 155
       @coordinate.back_opacity = 155
     else
       @coordinate.opacity = 255
       @coordinate.back_opacity = 255
     end
   end
   @spriteset = Spriteset_Map.new
   @message_window = Window_Message.new
   Graphics.transition
   loop do
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   end
   Graphics.freeze
   @spriteset.dispose
   @coordinate.dispose
   @message_window.dispose
   if $scene.is_a?(Scene_Title)
     Graphics.transition
     Graphics.freeze
   end
   Graphics.freeze
 end

 alias update_coordinate_window_later update
 def update
   if $DEBUG
     if @coordinate.active
       update_coordinate
     end
   end
   update_coordinate_window_later
 end
 
 def update_coordinate
   if $DEBUG
     if Input.trigger?(Input::A)
       if @coordinate.visible
         @coordinate.visible = false
       else
         @coordinate.visible = true
       end
     end
     @coordinate.update if @coordinate.visible && @coordinate.active
   end
 end
end



Tell me who to give credits to for the modification  :P

Kagutsuchi

This should do the trick
Spoiler: ShowHide
#==============================================================================#
#                     Game Guy's Coordinate Displayer                          #
#==============================================================================#
=begin
This will show a window on the map displaying X and Y coordinates.

Customization
module
  Location = "Upper Right Corner" "Lower Left Corner" "Upper Left Corner" or "Lower Right Corner"
  Transparent = "Non Transparent" "Semi-Transparent" "Transparent"
  UsePicture = true or false if set to true and transparent = "Non Transparent" it will automatically set it to "Transparent"
  PictureName = "picture name here" must be in quotes
end
=end
LOCATION  = "Upper Right Corner"
TRANSPARENT = "Semi-Transparent"
USEPICTURE = false  #NOT WORKING YET SO GO AHEAD AND SET IT TO TRUE BUT STILL WONT WORK
PICTURENAME = "picture name here"
class Window_Coordinate < Window_Base
 
  def initialize
    super(0, 0, 160, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 120, 32, "X:     " + $playerx.to_s)
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 32, 120, 32, "Y:     " + $playery.to_s)
  end
 
  def update
    super
    $playerx = $game_player.x * 32
    $playery = $game_player.y * 32
    refresh
  end
 
end

class Scene_Map

  alias add_coordinate_window_later main
  def main

      @coordinate = Window_Coordinate.new
      if LOCATION == "Upper Right Corner"
        @coordinate.x = 480
      elsif LOCATION == "Upper Left Corner"
        @coordinate.x = 0
      elsif LOCATION == "Lower Right Corner"
        @coordinate.x = 480
        @coordinate.y = 374
      else
        @coordinate.y = 374
      end
      if USEPICTURE == true
        if TRANSPARENT == "Non Transparent"
          @coordinate.opacity = 0
          @coordinate.back_opacity = 0
        end
      end
      if TRANSPARENT == "Transparent"
        @coordinate.opacity = 0
        @coordinate.back_opacity = 0
      elsif TRANSPARENT == "Semi-Transparent"
        @coordinate.opacity = 155
        @coordinate.back_opacity = 155
      else
        @coordinate.opacity = 255
        @coordinate.back_opacity = 255
      end

    @spriteset = Spriteset_Map.new
    @message_window = Window_Message.new
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @spriteset.dispose
    @coordinate.dispose
    @message_window.dispose
    if $scene.is_a?(Scene_Title)
      Graphics.transition
      Graphics.freeze
    end
    Graphics.freeze
  end

  alias update_coordinate_window_later update
  def update

      if @coordinate.active
        update_coordinate
      end

    update_coordinate_window_later
  end
 
  def update_coordinate

      if Input.trigger?(Input::A)
        if @coordinate.visible
          @coordinate.visible = false
        else
          @coordinate.visible = true
        end
      end
      @coordinate.update if @coordinate.visible && @coordinate.active

  end
end


jyumai

Quote from: Kagutsuchi on February 05, 2011, 04:19:21 pm
This should do the trick
Spoiler: ShowHide
#==============================================================================#
#                     Game Guy's Coordinate Displayer                          #
#==============================================================================#
=begin
This will show a window on the map displaying X and Y coordinates.

Customization
module
  Location = "Upper Right Corner" "Lower Left Corner" "Upper Left Corner" or "Lower Right Corner"
  Transparent = "Non Transparent" "Semi-Transparent" "Transparent"
  UsePicture = true or false if set to true and transparent = "Non Transparent" it will automatically set it to "Transparent"
  PictureName = "picture name here" must be in quotes
end
=end
LOCATION  = "Upper Right Corner"
TRANSPARENT = "Semi-Transparent"
USEPICTURE = false  #NOT WORKING YET SO GO AHEAD AND SET IT TO TRUE BUT STILL WONT WORK
PICTURENAME = "picture name here"
class Window_Coordinate < Window_Base
 
  def initialize
    super(0, 0, 160, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 120, 32, "X:     " + $playerx.to_s)
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 32, 120, 32, "Y:     " + $playery.to_s)
  end
 
  def update
    super
    $playerx = $game_player.x * 32
    $playery = $game_player.y * 32
    refresh
  end
 
end

class Scene_Map

  alias add_coordinate_window_later main
  def main

      @coordinate = Window_Coordinate.new
      if LOCATION == "Upper Right Corner"
        @coordinate.x = 480
      elsif LOCATION == "Upper Left Corner"
        @coordinate.x = 0
      elsif LOCATION == "Lower Right Corner"
        @coordinate.x = 480
        @coordinate.y = 374
      else
        @coordinate.y = 374
      end
      if USEPICTURE == true
        if TRANSPARENT == "Non Transparent"
          @coordinate.opacity = 0
          @coordinate.back_opacity = 0
        end
      end
      if TRANSPARENT == "Transparent"
        @coordinate.opacity = 0
        @coordinate.back_opacity = 0
      elsif TRANSPARENT == "Semi-Transparent"
        @coordinate.opacity = 155
        @coordinate.back_opacity = 155
      else
        @coordinate.opacity = 255
        @coordinate.back_opacity = 255
      end

    @spriteset = Spriteset_Map.new
    @message_window = Window_Message.new
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @spriteset.dispose
    @coordinate.dispose
    @message_window.dispose
    if $scene.is_a?(Scene_Title)
      Graphics.transition
      Graphics.freeze
    end
    Graphics.freeze
  end

  alias update_coordinate_window_later update
  def update

      if @coordinate.active
        update_coordinate
      end

    update_coordinate_window_later
  end
 
  def update_coordinate

      if Input.trigger?(Input::A)
        if @coordinate.visible
          @coordinate.visible = false
        else
          @coordinate.visible = true
        end
      end
      @coordinate.update if @coordinate.visible && @coordinate.active

  end
end




Thank you!!!!!!! *levels up*