Save-Point
Floating Window - 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: Floating Window (/thread-6885.html)



Floating Window - gatene - 03-22-2005

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.


Okay everyone, below is a small & simple script (without the comments that is) that will draw a small window in the upper-left hand corner of the screen, whenever you want it. This window can say anything at all that you want it to say. I use it as a location reference, something similar to Star Ocean 2. Look below the script to find directions on how to use the script.

Code:
#==============================================================================
# â–�  Place_Window
#------------------------------------------------------------------------------
#  To place a window at the top left of the screen showing your location
#   in the game by name, and an icon.
#==============================================================================

class Place_Window < Window_Base  #Uses Window_Base's variables
attr_accessor  :text            #Defines text
attr_accessor  :icon            #Defines which icon to use
def initialize(text, icon)      #Stores the text to print in the variable, "text"
#Draws a window at position 0,0  with a width of the # of chars in text
#times 14, and a height of 55
super(0, 0, text.size*12+32, 55)  
#Creates a Bitmap viewport without any arrows (removing the -32's shows arrows)
self.contents = Bitmap.new(width-32, height-32)
#Sets the font's face to Times New Roman
self.contents.font.name = "Times New Roman"  
#Sets the font's size to 20
self.contents.font.size = 20
#Sets the opacity of the background of the window to 160
self.back_opacity=160
bitmap = RPG::Cache.icon(icon)
self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24))
#Draws the text inside the variable, "text" within a viewport with the
#dimensions of the number of characters in text times 14, and the
#height of 20 pixels tall; all at locaiton 0,0
self.contents.draw_text(32, 0, text.size*12+32, 20, text)
end
end

Okay, well, if you ignore the stupid little comments I made, and probably some erroneous, I at least know what they mean lol. Well, the proper syntax is below when calling a script.

Place_Window.new("Text Goes Here", "Icon File Name Goes Here")

so if your hero entered a city called, Anaranjado, and the icon you want to use
is named, House.png (the icons must be in the Graphics\Icons directory)
then the below is what you'd put in the Call Script event thingy.

Place_Window.new("Anaranjado City", "house")

Enjoy,

Gatene