Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Floating Window
#1
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
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Display a gold window on the map Chronic_NG 0 2,790 12-04-2006, 01:00 PM
Last Post: Chronic_NG
  Description Window Caldaron 0 2,571 10-09-2006, 01:00 PM
Last Post: Caldaron
  Coordinate Window on the map Slanter 0 2,330 08-29-2006, 01:00 PM
Last Post: Slanter
  Location Window Eccid 0 2,119 09-11-2005, 01:00 PM
Last Post: Eccid
  Different Gold Window Sheol 0 2,219 09-01-2005, 01:00 PM
Last Post: Sheol
  New Command Window SephirothSpawn 0 1,956 07-15-2005, 01:00 PM
Last Post: SephirothSpawn
  Custom message window dragonslayer 0 2,162 03-25-2005, 01:00 PM
Last Post: dragonslayer



Users browsing this thread: