Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Extended Window_Message, New functions for the "Massage" event.
-dah0rst-
post Feb 14 2011, 04:13 AM
Post #1


Level 11
Group Icon

Group: Revolutionary
Posts: 174
Type: Scripter
RM Skill: Advanced




I wanted to rework the original message window from RPG Maker VX, adding new functions like the existing \v[xx] for showing variables.

~New functions are: (with example pictures)~

\i[X] displays item with ID "X"
\w[X] displays weapon with ID "X"
\a[X] displays armor with ID "X"
\s[X] displays skill with ID "X"

Display Item


\h[text] displays header with "text" (like the speaking person's name

Display header


\sym[X] displays symbol with ID "X"
\spc[X] adds an X-pixel whide white space

Display icon and whitespace



Infos on using the header ( \h[] )
This header is mainly to display a persons name on top of the text. You can combine it with \n to display (also \v is possible), for example to display the name of Charakter 3 (that would be: \h[\n[3]:])


~Please read:~

This script isn't fully tested. If you find bugs, post here. If you have requests on new functions also write here (for example displaying a characters class name).
Also I haven't put much time into the adjusting of windows and text, so if you want to have it rearranged or constants to set the header window position, write here.

~Script:

Script by dah0rst
#=======================================================================
==
=====
# ** Extended_Window_Message by dah0rst
#------------------------------------------------------------------------------
# New functions:
# \i[X] displays item with ID "X"
# \w[X] displays weapon with ID "X"
# \a[X] displays armor with ID "X"
# \s[X] displays skill with ID "X"
#
# \h[text] displays header with "text" (like the speaking person's name
# \sym[X] displays symbol with ID "X"
# \spc[X] adds an X-pixel whide white space
#==============================================================================

class Window_Message < Window_Selectable

alias convert_special_characters2 convert_special_characters
def convert_special_characters
convert_special_characters2
@text.gsub!(/\\I\[([0-9]+)\]/i) { "\x11[#{$1}]" }
@text.gsub!(/\\W\[([0-9]+)\]/i) { "\x12[#{$1}]" }
@text.gsub!(/\\A\[([0-9]+)\]/i) { "\x13[#{$1}]" }
@text.gsub!(/\\S\[([0-9]+)\]/i) { "\x14[#{$1}]" }
@text.gsub!(/\\SYM\[([0-9]+)\]/i) { "\x15[#{$1}]" }
@text.gsub!(/\\SPC\[([0-9]+)\]/i) { "\x16[#{$1}]" }
@text.slice!(/\\H\[([0-9A-Za-z_]+)\]/i)
if $1!=nil or $1.to_s != ""
$game_temp.header=$1.to_s
@head_window.open
p $game_temp.header
end
end

def update_message
loop do
c = @text.slice!(/./m) # Get next text character
case c
when nil # There is no text that must be drawn
finish_message # Finish update
break
when "\x00" # New line
new_line
if @line_count >= MAX_LINE # If line count is maximum
unless @text.empty? # If there is more
self.pause = true # Insert number input
break
end
end
when "\x01" # \C[n] (text character color change)
@text.sub!(/\[([0-9]+)\]/, "")
contents.font.color = text_color($1.to_i)
next
when "\x02" # \G (gold display)
@gold_window.refresh
@gold_window.open
when "\x03" # \. (wait 1/4 second)
@wait_count = 15
break
when "\x04" # \| (wait 1 second)
@wait_count = 60
break
when "\x05" # \! (Wait for input)
self.pause = true
break
when "\x06" # \> (Fast display ON)
@line_show_fast = true
when "\x07" # \< (Fast display OFF)
@line_show_fast = false
when "\x08" # \^ (No wait for input)
@pause_skip = true
when "\x11"
@text.sub!(/\[([0-9]+)\]/, "")
item = $data_items[$1.to_i]
self.draw_item_name(item, @contents_x, @contents_y)
if item.name.length*12>200
length=200
else
length = item.name.length*12
end
@contents_x += (length-4)
when "\x12"
@text.sub!(/\[([0-9]+)\]/, "")
item = $data_weapons[$1.to_i]
self.draw_item_name(item, @contents_x, @contents_y)
if item.name.length*12>200
length=200
else
length = item.name.length*12
end
@contents_x += (length-4)
when "\x13"
@text.sub!(/\[([0-9]+)\]/, "")
item = $data_armors[$1.to_i]
self.draw_item_name(item, @contents_x, @contents_y)
if item.name.length*12>200
length=200
else
length = item.name.length*12
end
@contents_x += (length-4)
when "\x14"
@text.sub!(/\[([0-9]+)\]/, "")
item = $data_skills[$1.to_i]
self.draw_item_name(item, @contents_x, @contents_y)
if item.name.length*12>200
length=200
else
length = item.name.length*12
end
@contents_x += (length-4)
when "\x15"
@text.sub!(/\[([0-9]+)\]/, "")
self.draw_icon($1.to_i, @contents_x, @contents_y)
@contents_x += 24
#~ when "\x16"
#~ @text.sub!(/\[([0-9]+)\]/, "")
#~ @head_window.refresh($1.to_s)
#~ @head_window.open
when "\x16"
@text.sub!(/\[([0-9]+)\]/, "")
@contents_x += $1.to_i
else # Normal text character
contents.draw_text(@contents_x, @contents_y, 40, WLH, c)
c_width = contents.text_size©.width
@contents_x += c_width
end
break unless @show_fast or @line_show_fast
end
end

alias create_gold_window2 create_gold_window

def create_gold_window
create_gold_window2
@head_window = Window_Head.new(8, 244)
@head_window.openness = 0
end

def dispose_head_window
@head_window.dispose
end

alias update2 update

def update
update2
@head_window.update
@head_window.refresh
end

alias terminate_message2 terminate_message

def terminate_message
@head_window.close
terminate_message2
end

end


class Window_Head < Window_Base

def initialize (x,y)
super(x, y, 200, WLH + 28)
self.z=200
refresh
end

def refresh
self.contents.clear
self.contents.draw_text (0,0,196,WLH,$game_temp.header)
end

end

class Game_Temp
attr_accessor :header

alias initialize2 initialize

def initialize
initialize2
@header=""
end

end


This post has been edited by -dah0rst-: Feb 14 2011, 05:59 AM


__________________________
You want Next Gen graphic algorithms in RPG VX? Ask the horst :P


But don't expect this in real time ;)
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 23rd May 2013 - 01:47 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker