Accueil du SiteAccueil du Site  AccueilAccueil  Dernières imagesDernières images  RechercherRechercher  ConnexionConnexion  S'enregistrerS'enregistrer  



Le Deal du moment : -45%
WHIRLPOOL OWFC3C26X – Lave-vaisselle pose libre ...
Voir le deal
339 €

Partagez
 

 BBcode dans VX

Voir le sujet précédent Voir le sujet suivant Aller en bas 
AuteurMessage
Jin
Ancien staffeux
Ancien staffeux
Jin

Masculin
Messages postés : 8557
Date d'inscription : 08/12/2010
Jauge LPC :
BBcode dans VX 891527140069 / 10069 / 100BBcode dans VX 8915271400

G 1 petit zizi Very Happy
Nn C pa vré Sad
BBcode dans VX Membre15
BBcode dans VX Partag10
BBcode dans VX Travai10
BBcode dans VX Event-10
BBcode dans VX Altrui10
BBcode dans VX Riche_10
BBcode dans VX Couhil10
BBcode dans VX Nain_p11
BBcode dans VX Connar10


BBcode dans VX Empty
MessageSujet: BBcode dans VX   BBcode dans VX EmptyMer 11 Jan 2012 - 20:46

Voici un script vous permettant d'insérer du bbcode dans vos texte.

Auteur : Berka
A placer au dessus de main
explication dans le script

BBcode dans VX Captur10
BBcode dans VX Captur11

Code:
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#                    Bbcode messages  v 0.5              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_image sans extension[/img]
# [ code]...[ /code] pas de balises du début de message à [ /code]
# d'autres fonctions viendront;^)
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
$KCODE="UTF8"
module Berka
  module Bbcode
    Puce="● " #∆
    Surligneur="#0000CD" #html
    Blur_Opacite=125 #opacité [blur]
    Ombre_Portee=6
    #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!("[code]")          {@code=true;"\xBB"}
    @text.gsub!("[/code]")          {"\xBC"}
    if !@code
    @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
  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";next
      when "\xBB";@code=true;convert_special_characters
      when "\xBC";@code=false;convert_special_characters
      else
        draw(c)
      end
      break unless @show_fast||@line_show_fast}
    end
    def draw(c)
      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
    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=125,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
Revenir en haut Aller en bas
Elekami
Fondateur
Fondateur
Elekami

Masculin
Messages postés : 19071
Date d'inscription : 19/07/2008
Jauge LPC :
BBcode dans VX 8915271400100 / 100100 / 100BBcode dans VX 8915271400

BBcode dans VX Pater_10
BBcode dans VX Staffe10
BBcode dans VX Mythe_10
BBcode dans VX Membre11
BBcode dans VX Doyen10
BBcode dans VX Scanar10
BBcode dans VX Compos10
BBcode dans VX Testeu10
BBcode dans VX Membre15
BBcode dans VX Partag10
BBcode dans VX Projet10
BBcode dans VX Projet16
BBcode dans VX Riche_10
BBcode dans VX Travai10
BBcode dans VX Collec10
BBcode dans VX Collec11
BBcode dans VX Collec12
BBcode dans VX Collec13
BBcode dans VX Connar10


BBcode dans VX Empty
MessageSujet: Re: BBcode dans VX   BBcode dans VX EmptySam 14 Jan 2012 - 13:32

Sympa comme script, merci du partage!
Revenir en haut Aller en bas
https://www.ledijonshow.fr https://twitter.com/EleKoptes
 
BBcode dans VX
Voir le sujet précédent Voir le sujet suivant Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» mytologie dans les rpg
» RM2K dans VX
» Le roi est dans la place !
» Choix dans un ordre
» Making et priorités dans la vie

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Le Palais Créatif :: ~ PARTAGE ~ :: Scripts et plugins :: RPG Maker VX :: Autres-
Sauter vers: