#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # Bbcode messages v 0.6 Rgss2 # par berka www.rpgmakervx-fr.com #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # permet l'utilisation de certaines balises bbcode dans les messages de rmvx # # [b]...[/b] gras == [strong]...[/strong] # [i]...[/i] italique # [o]...[/o] non ombré # [size=i]...[/size] taille des caractères # [color=#FFFFFF]...[/color] couleur hexadecimale # [color=black]...[/color] couleur nominale html # [list][*]...[*]...[/list] liste à puce # [list=1][*]...[*]...[/list] liste à chiffres # [list=a][*]...[*]...[/list] liste à lettre # [u]...[/u] souligné # [s]...[/s] barré == [strike]...[/strike] # [font=arial]...[/font] police # [sup]...[/sup] exposant # [shadow=#FFFFFF]...[/shadow] ombre portée # [shadow=black]...[/shadow] ombre portée # [blur]...[/blur] flou # [img]nom de l'image sans extention[/img] insertion image (placée dans Graphics/system) # d'autres fonctions viendront;^) #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= $KCODE="UTF8" module Berka module Bbcode Puce="— " #ˆ† Surligneur="#0000CD" #html Blur_Opacite=125 #opacité [blur] Ombre_Portee=[6,6] #[x,y] nbr de pixels de décalage #couleurs html <> hexadecimales HTML={:aliceblue=>"#F0F8FF",:aqua=>"#00FFFF",:aquamarine=>"#7FFFD4",:azure=>"#F0FFFF",:beige=>"#F5F5DC",:bisque=>"#FFE4C4", :black=>"#000000",:blanchedalmond=>"#FFEBCD",:blue=>"#0000FF",:blueviolet=>"#8A2BE2",:brown=>"#A52A2A",:burlywood=>"#DEB887", :cadetblue=>"#5F9EA0",:chartreuse=>"#7FFF00",:chocolate=>"#D2691E",:coral=>"#FF7F50",:cornflowerblue=>"#6495ED",:cornsilk=>"#FFF8DC", :crimson=>"#DC143C",:cyan=>"#00FFFF",:darkblue=>"#00008B",:darkcyan=>"#008B8B",:darkgoldenrod=>"#B8860B",:darkgray=>"#A9A9A9", :darkgreen=>"#006400",:darkkhaki=>"#BDB76B",:darkmagenta=>"#8B008B",:darkolivegreen=>"#556B2F",:darkorange=>"#FF8C00", :darkorchid=>"#9932CC",:darkred=>"#8B0000",:darksalmon=>"#E9967A",:darkseagreen=>"#8FBC8F",:darkslateblue=>"#483D8B", :darkslategray=>"#2F4F4F",:darkturquoise=>"#00CED1",:darkviolet=>"#9400D3",:deeppink=>"#FF1493",:deepskyblue=>"#00BFFF", :dimgray=>"#696969",:dodgerblue=>"#1E90FF",:firebrick=>"#B22222",:floralwhite=>"#FFFAF0",:forestgreen=>"#228B22",:fuchsia=>"#FF00FF", :gainsboro=>"#DCDCDC",:ghostwhite=>"#F8F8FF",:gold=>"#FFD700",:goldenrod=>"#DAA520",:gray=>"#808080",:green=>"#008000", :greenyellow=>"#ADFF2F",:honeydew=>"#F0FFF0",:hotpink=>"#FF69B4",:indianred=>"#CD5C5C",:indigo=>"#4B0082",:ivory=>"#FFFFF0", :khaki=>"#F0E68C",:lavender=>"#E6E6FA",:lavenderblush=>"#FFF0F5",:lawngreen=>"#7CFC00",:lemonchiffon=>"#FFFACD",:lightblue=>"#ADD8E6", :lightcoral=>"#F08080",:lightcyan=>"#E0FFFF",:lightgoldenrodyellow=>"#FAFAD2",:lightgreen=>"#90EE90",:lightgrey=>"#D3D3D3", :lightpink=>"#FFB6C1",:lightsalmon=>"#FFA07A",:lightseagreen=>"#20B2AA",:lightskyblue=>"#87CEFA",:lightslategray=>"#778899", :lightsteelblue =>"#B0C4DE",:lightyellow=>"#FFFFE0",:lime=>"#00FF00",:limegreen=>"#32CD32",:linen=>"#FAF0E6",:magenta=>"#FF00FF", :maroon=>"#800000",:mediumaquamarine=>"#66CDAA",:mediumblue=>"#0000CD",:mediumorchid=>"#BA55D3",:mediumpurple=>"#9370DB", :mediumseagreen=>"#3CB371",:mediumslateblue=>"#7B68EE",:mediumspringgreen=>"#00FA9A",:mediumturquoise=>"#48D1CC", :mediumvioletred=>"#C71585",:midnightblue=>"#191970",:mintcream=>"#F5FFFA",:mistyrose=>"#FFE4E1",:moccasin=>"#FFE4B5", :navajowhite=>"#FFDEAD",:navy=>"#000080",:oldlace=>"#FDF5E6",:olive=>"#808000",:olivedrab=>"#6B8E23",:orange=>"#FFA500", :orangered=>"#FF4500",:orchid=>"#DA70D6",:palegoldenrod=>"#EEE8AA",:palegreen=>"#98FB98",:paleturquoise=>"#AFEEEE", :palevioletred=>"#DB7093",:papayawhip=>"#FFEFD5",:peachpuff=>"#FFDAB9",:peru=>"#CD853F",:pink=>"#FFC0CB",:plum=>"#DDA0DD", :powderblue=>"#B0E0E6",:purple=>"#800080",:red=>"#FF0000",:rosybrown=>"#BC8F8F",:royalblue=>"#4169E1",:saddlebrown=>"#8B4513", :salmon=>"#FA8072",:sandybrown=>"#F4A460",:seagreen=>"#2E8B57",:seashell=>"#FFF5EE",:sienna=>"#A0522D",:silver=>"#C0C0C0", :skyblue=>"#87CEEB",:slateblue=>"#6A5ACD",:slategray=>"#708090",:snow=>"#FFFAFA",:springgreen=>"#00FF7F",:steelblue=>"#4682B4", :tan=>"#D2B48C",:teal=>"#008080",:thistle=>"#D8BFD8",:tomato=>"#FF6347",:turquoise=>"#40E0D0",:violet=>"#EE82EE",:wheat=>"#F5DEB3", :white=>"#FFFFFF",:whitesmoke=>"#F5F5F5",:yellow=>"#FFFF00",:yellowgreen=>"#9ACD32"} Alpha="abcdefghijklmnopqrstuvwxyz".scan(/./) end end include Berka::Bbcode class Window_Message < Window_Selectable alias berka_bbcode_convert convert_special_characters def start_message @text="" for i in 0...$game_message.texts.size @text+=" " if i >= $game_message.choice_start @text+=$game_message.texts[i].clone+"\x00" end @item_max=$game_message.choice_max convert_special_characters reset_window new_page end def convert_special_characters berka_bbcode_convert @a=0 @text.gsub!('[b]') {"\xA1"} @text.gsub!('[strong]') {"\xA1"} @text.gsub!('[/b]') {"\xA2"} @text.gsub!('[/strong]') {"\xA2"} @text.gsub!('[i]') {"\xA3"} @text.gsub!('[/i]') {"\xA4"} @text.gsub!('[o]') {"\xA5"} @text.gsub!('[/o]') {"\xA6"} @text.gsub!(/\[size\=(\d+)\]/) {"\xA7[#{$1}]"} @text.gsub!('[/size]') {"\xA8"} @text.gsub!(/\[color\=\#([0-9A-Za-z]+?)\]/x){"\xA9\[#{$1}\]"} @text.gsub!(/\[color\=([0-9A-Za-z]+?)\]/x){"\xA9\[#{$1}\]"} @text.gsub!('[/color]') {"\xAA"} @text.gsub!('[list]') { @a=nil;@t=nil;''} @text.gsub!(/\[list\=(\d+)\]/) { @a=0;@t=0;'' } @text.gsub!(/\[list\=([A-Za-z]+)\]/){ @a=0;@t=nil;'' } @text.gsub!('[*]') {(@t.nil? ? (@a+=1;"\x00 #{Alpha[@a-1]}-"):(@a+=1;"\x00 #{@a+=1}-"))rescue "\x00 "+Puce } @text.gsub!('[/list]') { @a=nil;@t=nil;""} @text.gsub!('[u]') {"\xAB"} @text.gsub!('[/u]') {"\xAV"} @text.gsub!('[s]') {"\xAD"} @text.gsub!('[strike]') {"\xAD"} @text.gsub!('[/s]') {"\xAE"} @text.gsub!('[/strike]') {"\xAE"} @text.gsub!(/\[font\=([A-Za-z]+)\]/){ "\xAF[#{$1}]"} @text.gsub!('[/font]') {"\xB0"} @text.gsub!('[sup]') {"\xB1"} @text.gsub!('[/sup]') {"\xB2"} @text.gsub!('[fluo]') {"\xB3"} @text.gsub!('[/fluo]') {"\xB4"} @text.gsub!('[blur]') {"\xB5"} @text.gsub!('[/blur]') {"\xB6"} @text.gsub!(/\[shadow\=\#([0-9A-Za-z]+?)\]/x){"\xB7\[#{$1}\]"} @text.gsub!(/\[shadow\=([0-9A-Za-z]+?)\]/x){"\xB7\[#{$1}\]"} @text.gsub!('[/shadow]') {"\xB8"} @text.gsub!('[img]') {"\xB9"} @text.gsub!('[/img]') {"\xBA"} end def update_message loop { c=@text.slice!(/./m) case c when nil finish_message break when "\x00" new_line if @line_count >= MAX_LINE unless @text.empty? self.pause=true break end end when "\x01";@text.sub!(/\[([0-9]+)\]/,"");contents.font.color=text_color($1.to_i);next when "\x02";@gold_window.refresh;@gold_window.open when "\x03";@wait_count=15;break when "\x04";@wait_count=60;break when "\x05";self.pause=true;break when "\x06";@line_show_fast=true when "\x07";@line_show_fast=false when "\x08";@pause_skip=true when "\xA1";self.contents.font.bold=true when "\xA2";self.contents.font.bold=Font.default_bold when "\xA3";self.contents.font.italic=true when "\xA4";self.contents.font.italic=Font.default_italic when "\xA5";self.contents.font.shadow=false when "\xA6";self.contents.font.shadow=Font.default_shadow when "\xA7";@text.sub!(/\[(\d+)\]/,'');self.contents.font.size=$1.to_i;next when "\xA8";self.contents.font.size=Font.default_size when "\xA9";@text.sub!(/\[([0-9A-Za-z]+)\]/ix,'');@bbcouleur=self.contents.font.color=hexa($1);next when "\xAA";self.contents.font.color=Font.default_color when "\xAB";@soul=true when "\xAC";@soul=false when "\xAD";@str=true when "\xAE";@str=false when "\xAF";@text.sub!(/\[([A-Za-z]+)\]/,"");self.contents.font.name=$1 if Font.exist?($1) when "\xB0";self.contents.font.name=Font.default_name when "\xB1";self.contents.font.size*=0.5 when "\xB2";self.contents.font.size=Font.default_size when "\xB3";@fluo=true when "\xB4";@fluo=false when "\xB5";@flou=true when "\xB6";@flou=false when "\xB7";@text.sub!(/\[([0-9A-Za-z]+)\]/,'');@ombre=$1 when "\xB8";@ombre=nil when "\xB9";@text.sub!(/([0-9A-Za-z]+)/,'');@img=Cache.system($1) when "\xBA"; else c_width=contents.text_size(c).width (contents.blt(@contents_x,@contents_y,@img,@img.rect);@contents_x+=@img.width)if !@img.nil? contents.fill_rect(@contents_x,@contents_y,c_width,self.contents.font.size,hexa(Surligneur)) if @fluo contents.ombre_portee(c,@contents_x,@contents_y,[6,6],@ombre)if !@ombre.nil? contents.draw_text(@contents_x,@contents_y,40,self.contents.font.size,c) contents.flou([@contents_x,@contents_y,c_width,self.contents.font.size])if @flou contents.draw_text(@contents_x,@contents_y+1,c_width,self.contents.font.size,"___") if @soul contents.draw_text(@contents_x,@contents_y-self.contents.font.size/3,c_width,self.contents.font.size,"___") if @str @contents_x+=c_width @img=nil end break unless @show_fast||@line_show_fast} end def hexa(hex) hex=HTML[hex.to_sym] if HTML.has_key?(hex.to_sym) hex=hex.scan(/./) (rgb=[hex[0]+hex[1],hex[2]+hex[3],hex[4]+hex[5]]) rescue (return normal_color) return Color.new(rgb[0].to_i(16),rgb[1].to_i(16),rgb[2].to_i(16)) end end class Bitmap def ombre_portee(string,x,y,d,col) a,b,m,n=false,false,d[0],d[1] loop do self.font.color=Color.new(hexa(col)[0],hexa(col)[1],hexa(col)[2],255-255*m/d[0]) draw_text(Rect.new(x-m,y+n,text_size(string).width,self.font.size),string) m>0 ? m-=1 :a=true;n>0 ? n-=1 :b=true break if a&&b end end def flou(rect,of=2,opacite=Blur_Opacite,spac=1) x,y,w,h=rect[0],rect[1],rect[2],rect[3] dummy = self.dup of.times{|i| src_rects=[] src_rects<<Rect.new(x+i*spac,y+i*spac,w,h) src_rects<<Rect.new(x-i*spac,y+i*spac,w,h) src_rects<<Rect.new(x+i*spac,y-i*spac,w,h) src_rects<<Rect.new(x-i*spac,y-i*spac,w,h) o=Integer(opacite*(of-i)/of) src_rects.each{|src_rect|blt(x,y,dummy,src_rect,o)}} end def hexa(hex) hex=HTML[hex.to_sym] if HTML.has_key?(hex.to_sym) rescue return hex=hex.scan(/./) (rgb=[hex[0]+hex[1],hex[2]+hex[3],hex[4]+hex[5]]) rescue (return normal_color) return rgb[0].to_i(16),rgb[1].to_i(16),rgb[2].to_i(16) end end
Screenshot
e.g then
Installation
place it above main
Terms and Conditions
Free, but Credits are needed
Credits
Zeriab (regexp) MACL scripts RMVX manual
et voila
This post has been edited by berka: Dec 30 2008, 01:15 AM
Group: +Gold Member
Posts: 1,199
Type: Scripter
RM Skill: Undisclosed
while this can come super handy, the only problem w/ bbcode is that the excess characters used for the [ ] and whatnot else take up text space other than that, nice script!
__________________________
Got 30 minutes? Then you've enough time to play this awesome game: - potentially promising project page - thanks holder
Group: Member
Posts: 26
Type: Scripter
RM Skill: Masterful
great work, i trying to make a script like "npc script" that using script for npc, example:
1_npc_script.txt for event named npc_script in map id 1
CODE
<msg>hello, this is a text</msg> # comment like rgss <choice>this is a choice, choice 1/task1, choice 2/task2</choice> <task1> <msg>you choose 1</msg> </task1> <task2> <msg>you choose 2</msg> </task2>
<if>$name == "ngoa ho", <msg>you are ngoa ho</msg>, <msg>you are not ngoa ho</msg> </if>
<script> p "this is a rgss script" </script>
more active than rpg maker xp event editor. your script teach me very much.. thank you.
p/s: if you like this, join with me, ngoaho91@gmail.com