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
> Using Bbcode in messages, Messages
berka
post Nov 28 2008, 09:18 AM
Post #1


Level 8
Group Icon

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




Bbcode Messages

Version
v 0.6

Author
Berka

Release Date
27/11/2008

Exclusive Script at RpgMakerVX-fr.com

Introduction
Here is a script to add the management of bbcode in your messages!
(sorry for my poor English


Features
CODE
[b]...[/b] bold == [strong]...[/strong]
[i]...[/i] italic
[o]...[/o] non-shaded
[size=i]...[/size] letters size
[color=#FFFFFF]...[/color] hexa color
[color=black]...[/color] named color
[list][*]...[*]...[/list] check list
[list=1][*]...[*]...[/list] numbers list
[u]...[/u] underscored
[s]...[/s] strike == [strike]...[/strike]
[font=arial]...[/font] police
[sup]...[/sup] exposant (sorry)
[shadow=#D0F054]...[/shadow]
[blur]...[/blur]
[img]img_name[/img]
[ code]...[ /code]


Script
[Show/Hide] Bbcode Message script
CODE
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#                    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 rolleyes.gif

This post has been edited by berka: Dec 30 2008, 01:15 AM


__________________________
Go to the top of the page
 
+Quote Post
   
Night5h4d3
post Nov 28 2008, 09:27 AM
Post #2


The past tense
Group Icon

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
My growing space of user-bars:

about me:







I made the following!





Go to the top of the page
 
+Quote Post
   
berka
post Nov 29 2008, 01:59 AM
Post #3


Level 8
Group Icon

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




new version !


__________________________
Go to the top of the page
 
+Quote Post
   
woratana
post Nov 29 2008, 04:02 AM
Post #4


Looking for scripter to hire? PM me *O*
Group Icon

Group: +Gold Member
Posts: 1,038
Type: Scripter
RM Skill: Undisclosed




Very Nice~^^

However, I agree with enix that BBcode tags take a lot of space in VX's small dialogue box. D:


__________________________
Check out my NEW blog!!!



MVP (Most Valuable Poster) Award 2008


Go to the top of the page
 
+Quote Post
   
berka
post Nov 29 2008, 04:40 AM
Post #5


Level 8
Group Icon

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




thanks... maybe I should create a .txt system for dialogs...

[ img] , [ code] & [ blur] added

This post has been edited by berka: Nov 29 2008, 06:07 AM


__________________________
Go to the top of the page
 
+Quote Post
   
sasofrass
post Dec 29 2008, 05:09 PM
Post #6


I can event anything.
Group Icon

Group: Revolutionary
Posts: 254
Type: Event Designer
RM Skill: Masterful




When you use bb code, all of the choices boxes become 1, ruining your stuff. :s


__________________________
Eventing Tutorials (updated Mar-5-2011)

Easy Eventing Tutorial Submissions - All done by me!
1.] Easy Money Banking System (May-16-2010)
2.] Easy Random Lightening System (Jul-31-2010)
3.] Mining System with Events (Aug-1-2010)
4.] Easy Item Looting (Aug-8-2010)
5.] Locks (Aug-8-2010)
6.] Event Movement to Location (Jan-2-2011)
7.] Evented Locations (Feb-21-2011)
8.] Slippery Floors (Mar-5-2011)
Go to the top of the page
 
+Quote Post
   
berka
post Dec 30 2008, 01:15 AM
Post #7


Level 8
Group Icon

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




thanks... bug fixed !


__________________________
Go to the top of the page
 
+Quote Post
   
ShinAlcatraz
post Jan 1 2009, 11:05 AM
Post #8


Level 8
Group Icon

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




Has this script the order
CODE
[center]text[/center]
?


__________________________
Ps: My girlfriend is a good many times in my Account, so please don't be confused when I "sound" like a girl :)



Aeternum Kafkaesk - Runen von Asgard (Runes of Asgard)

Story: 43%
Scripts: 94%
Mapping: 31%
Events: 33%
Others: 85%
Demo Status: 0.26


Add the Dark Druid Nergal to your sig, and help him liberate the world!
Go to the top of the page
 
+Quote Post
   
berka
post Jan 2 2009, 01:47 AM
Post #9


Level 8
Group Icon

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




no... 'cause the window_message analizes each word by letter to letter


__________________________
Go to the top of the page
 
+Quote Post
   
ngoaho
post Jan 8 2010, 06:48 AM
Post #10


Level 2
Group Icon

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


__________________________
Go to the top of the page
 
+Quote Post
   
Finncarls1
post Dec 30 2010, 05:45 PM
Post #11


Level 1
Group Icon

Group: Member
Posts: 6
Type: None
RM Skill: Undisclosed




whats with the french in the screenshot


__________________________
It's not who you kill its what type of cereal you eat out of there skull
Supports:



Best game ive ever played on rpgmaker:
Peekaboo
Go to the top of the page
 
+Quote Post
   
Kread-EX
post Dec 31 2010, 01:16 AM
Post #12


(=___=)/
Group Icon

Group: +Gold Member
Posts: 4,136
Type: Scripter
RM Skill: Undisclosed




Because berka is French. Don't post in old topics just to make useless comments, Finncarls1. It's a verbal warning.


__________________________
FRACTURE - a SMT inspired game (demo) made by Rhyme, Karsuman and me. Weep and ragequit.

My blog.

Click here for my e-peen


Go to the top of the page
 
+Quote Post
   
chaco
post Nov 26 2011, 05:40 AM
Post #13


Level 2
Group Icon

Group: Member
Posts: 16
Type: None
RM Skill: Undisclosed




I run a forum which uses BB Code, so this script is REALLY useful to me!! laugh.gif
Thanks!! biggrin.gif
Go to the top of the page
 
+Quote Post
   
andyvrc [$]
post Dec 18 2011, 02:19 PM
Post #14


Level 1
Group Icon

Group: Member
Posts: 14
Type: Developer
RM Skill: Beginner




what is the code to make name branch??
Go to the top of the page
 
+Quote Post
   
Kread-EX
post Dec 18 2011, 11:02 PM
Post #15


(=___=)/
Group Icon

Group: +Gold Member
Posts: 4,136
Type: Scripter
RM Skill: Undisclosed




What do you mean?


__________________________
FRACTURE - a SMT inspired game (demo) made by Rhyme, Karsuman and me. Weep and ragequit.

My blog.

Click here for my e-peen


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: 19th May 2013 - 09:23 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker