Save-Point
Coordinate Window on the map - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Archives (https://www.save-point.org/forum-105.html)
+--- Forum: Creation Asylum Archives (https://www.save-point.org/forum-90.html)
+---- Forum: Scripts & Code Snippets (https://www.save-point.org/forum-92.html)
+----- Forum: RPG Maker XP Code (https://www.save-point.org/forum-93.html)
+----- Thread: Coordinate Window on the map (/thread-6900.html)



Coordinate Window on the map - Slanter - 08-29-2006

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


This script just makes a little box in the upper left corner showing the players current coordinates on the map. I don't know what it might be useful for, but I was bored and felt like playing around with some scripting... this was the result :icon_wink:

Code:
#==============================================================================
# ** Coordinate Display Window
#------------------------------------------------------------------------------
# Slanter
# Version 1
# 2006-08-29
#------------------------------------------------------------------------------
# * Instructions: Press F8 while on the map to toggle a box at 0,0 with the
#                 player's current coordinates.
#==============================================================================

#--------------------------------------------------------------------------
# * SDK Log Script
#--------------------------------------------------------------------------
SDK.log('CoordWindow', 'Slanter', 1, '2006-08-29')

#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.state('CoordWindow') == true
    
#==============================================================================
# ** Scene_Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Alias Command: Update
#--------------------------------------------------------------------------
  alias slanter_coordwin_scnmap_update update
#--------------------------------------------------------------------------
# * Update: Add F8 trigger
#--------------------------------------------------------------------------
  def update
    if $DEBUG and Input.trigger?(Input::F8)
      if @coord_win == true
        @coord_win = false
        @coordinate_window.dispose
      else
        @coord_win = true
        coordinate_window
      end
    end
    if @coord_win == true
      @coordinate_window.dispose
      coordinate_window
    end  
    slanter_coordwin_scnmap_update
  end
#--------------------------------------------------------------------------
# * Coordinate_Window: Create Window_Coordinate
#--------------------------------------------------------------------------
  def coordinate_window
    @coordinate_window = Window_Coordinate.new
    @coordinate_window.x=0
    @coordinate_window.y=0
    @coordinate_window.height=96
    @coordinate_window.width=100
    @coordinate_window.back_opacity=160
  end
end

#==============================================================================
# ** Window_Coordinate
#==============================================================================
class Window_Coordinate < Window_Base
  def initialize
    super(0, 0, 100,96)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Tahoma"
    self.contents.font.size = 22
    self.contents.font.color = text_color(0)
    self.contents.draw_text(0, 0, 100, 32, "X = " + $game_player.x.to_s)
    self.contents.draw_text(0, 32, 100, 32, "Y = " + $game_player.y.to_s)
  end
end

#--------------------------------------------------------------------------
# End SDK Enabled Test
#--------------------------------------------------------------------------
end

Script without SDK dependancy
Code:
#==============================================================================
# ** Coordinate Display Window
#------------------------------------------------------------------------------
# Slanter
# Version 1
# 2006-08-29
#------------------------------------------------------------------------------
# * Instructions: Press F8 while on the map to toggle a box at 0,0 with the
#                 player's current coordinates.
#==============================================================================
    
#==============================================================================
# ** Scene_Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Alias Command: Update
#--------------------------------------------------------------------------
  alias slanter_coordwin_scnmap_update update
#--------------------------------------------------------------------------
# * Update: Add F8 trigger
#--------------------------------------------------------------------------
  def update
    if $DEBUG and Input.trigger?(Input::F8)
      if @coord_win == true
        @coord_win = false
        @coordinate_window.dispose
      else
        @coord_win = true
        coordinate_window
      end
    end
    if @coord_win == true
      @coordinate_window.dispose
      coordinate_window
    end  
    slanter_coordwin_scnmap_update
  end
#--------------------------------------------------------------------------
# * Coordinate_Window: Create Window_Coordinate
#--------------------------------------------------------------------------
  def coordinate_window
    @coordinate_window = Window_Coordinate.new
    @coordinate_window.x=0
    @coordinate_window.y=0
    @coordinate_window.height=96
    @coordinate_window.width=100
    @coordinate_window.back_opacity=160
  end
end

#==============================================================================
# ** Window_Coordinate
#==============================================================================
class Window_Coordinate < Window_Base
  def initialize
    super(0, 0, 100,96)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Tahoma"
    self.contents.font.size = 22
    self.contents.font.color = text_color(0)
    self.contents.draw_text(0, 0, 100, 32, "X = " + $game_player.x.to_s)
    self.contents.draw_text(0, 32, 100, 32, "Y = " + $game_player.y.to_s)
  end
end