The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Tsunokiette on December 29, 2005, 04:41:37 AM

Title: Help Window
Post by: Tsunokiette on December 29, 2005, 04:41:37 AM
I have no way of explaining it further a.t.m.

Add this with the other window scripts.

Code: [Select]
# ============================== #
#         * Help Window *        #
# ------------------------------ #
#            Version 1           #
#            12.27.05            #
# ------------------------------ #
#   Tsunokiette (Give credit)    #
# ============================== #
class Help_Window < Window_Base
attr_accessor :text

def initialize(x = 0,y = 0,@text = nil)
x = x
y = y
w = 640
h = 64
super(x,y,w,h)
setup_bitmap
properties
end

def show!
self.visible = true
self.active = true
end

def hide!
self.visible = false
self.active = false
end

def text(text = '')
text = text.to_s
@old_text = @text.dup unless @text.nil?
@old_text = '' when @old_text.nil?
@text = text unless text == ''
end

def properties
self.contents.font.name = 'Times New Roman'
self.contents.font.size = 22
self.visible = false
self.active = false
end

def setup_bitmap
self.contents = Bitmap.new(width - 32, height - 32)
end

def set_text(text)
self.contents.clear
self.contents.draw_text(0,0,608,32,text,1)
end

alias update_help_window update
def update
return when self.active == false
if @text.nil? or @old_text == @text
update_help_window
return
end
set_text(@text)
update_help_window
end

end


Call like this- (window is automaticly not shown)

Code: [Select]
@help = Help_Window.new(x,y)

x and y automaticly set to 0

to show the window in the begining, under the call, place this -

Code: [Select]
@help.show!


Only 6 methods to ever use with this window-

.new = obvious

.dispose = obvious

.update = use this as you normaly would with another window, and .refresh does not exist with this window.

.show! = always use this in the place of self.active = false and self.visible = false, it does a combo of the two and if you don't use this instead, it will affect how the script runs

.hide! = does the opposite of .show!

AND LAST BUT NOT LEAST- (the main part of a help window)

BTW: you need to know how to use case statements

in order to change the text in the help window, use this method-

.text('text in single quotes')
Title: Help Window
Post by: Ramiro on December 29, 2005, 12:11:11 PM
Well, it seems nice, but you don
Title: Help Window
Post by: blueXx on December 29, 2005, 12:49:52 PM
he wrote it , he should know

i might be wrong but what i understand from it is that it's a window (like a message window) which you can place anywhere, it will not disturb the game and it will beocome visible and invisible as you wish, and you can also change whateva text you want it to be

so basicly it's like in good rpgs where you start the game or something and you get messages to guide you but they are small and ignorable and they won't get your game stuck unlike normal messages allowing you to truely ignore them

truely a very nice thinking, assuming it actually works.
Title: Help Window
Post by: Tsunokiette on December 29, 2005, 07:00:38 PM
Quote from: blueXx
he wrote it , he should know

i might be wrong but what i understand from it is that it's a window (like a message window) which you can place anywhere, it will not disturb the game and it will beocome visible and invisible as you wish, and you can also change whateva text you want it to be

so basicly it's like in good rpgs where you start the game or something and you get messages to guide you but they are small and ignorable and they won't get your game stuck unlike normal messages allowing you to truely ignore them

truely a very nice thinking, assuming it actually works.


It's intended purpose is for use in menus, you know a help window that tells you what the selected option will do, but I guess it could be used that way too lol.