RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.
Slipknot Message System

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 90
This script is very old, use this instead: http://rmrk.net/index.php/topic,7035.0.html







New Demo
Old demo

[EDIT]You can also download the NEW DEMO from the attachment at the end of the post.[/EDIT]

Code: [Select]
#-----------------------------------------------------------------
# ? Slipknot's Advance Message System ?
#-----------------------------------------------------------------
#  Last Update: 03/12/05
#   - Added the window over event
#   - Show Picure inside the window
#   - Added the icon display
#   - Added the item, weapon, armor & skill icon display
#   - Added the hero class name
#   - Fixed some little things
#-----------------------------------------------------------------
#  - Show Picture (above) by Slipknot
#  - Auto Resize by Slipknot
#  - Different Display Text by Slipknot
#  - Bold & Italic Text by Slipknot
#  - Hero Class Name by Slipknot
#  - Icon Display by Slipknot
#  - Item, Weapon, Armor & Skill icon by Dubealex*
#  - Show Picture (in) by Dubealex*
#  - Name Box by Dubealex*
#  - Text size by Dubealex*
#  - Text font by Dubealex*
#  - Window Over Event by Dubealex*
#  - Outline Text from Alestian Story*
#  - Shadow Text from Alestian Story*
#  * edited by Slipknot
#-----------------------------------------------------------------
# Set the default text display
$default_text = 0
#-----------------------------------------------------------------
class Window_Message < Window_Selectable
#-----------------------------------------------------------------
  def initialize
    super(65,299,510,175)
    self.contents = Bitmap.new(width-32,height-32)
    self.visible = false
    self.z = 9998
    @contents_showing = @fade_in = @fade_out = false
    @cursor_width = 0
    self.active = false
    self.index = -1
    self.opacity = 0
    # Change it to change the pictures folder for the messages
    @path = "Graphics/Pictures/Message/"
    @back = Window_Base.new(self.x,self.y,self.width,self.height)
    @back.visible = false
  end
#-----------------------------------------------------------------
  def dispose
    terminate_message
    $game_temp.message_window_showing = false
    @back.dispose
    if @input_number_window != nil
      @input_number_window.dispose
    end; super
  end
#-----------------------------------------------------------------
  alias sk_terminate_message terminate_message
  def terminate_message
    sk_terminate_message
    if @name_box != nil
     @name_box.dispose
     @name_box = nil
    end
    if @name_box_text  != nil
      @name_box_text.dispose
      @name_box_text = nil
    end
    if @picture != nil
      @picture.dispose
      @picture = nil
    end
  end
#-----------------------------------------------------------------
  def refresh
    self.contents.clear
    # Setting the text options to default
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = 22
    self.contents.font.bold = false
    self.contents.font.italic = false
    case $default_text
    when 0 then disp_text
    when 1 then disp_text(false,true)
    when 2 then disp_text(true) end
    # Setting some variables to 0
    @cursor_width = color = x = y = sx = 0
    x=8 if $game_temp.choice_start == 0
    if $game_temp.message_text != nil
      text = $game_temp.message_text
      begin
        last_text = text.clone
        # Show Variables Value
        text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
      end until text == last_text
      # Show Hero Name
      text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
        $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
      end
      # Show Hero Class Name
      text.gsub!(/\\[Cc]lass\[([0-9]+)\]/) do
        $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].class_name : ""
      end
      name_box = face = picture = over_event = false
      # Name box
      if (/\\[Nn]a\[(.+?)\]/.match(text)) != nil
        name_box = true
        name_text = $1
        text.sub!(/\\[Nn]a\[(.*?)\]/){""}
      end
      # Picture
      if (/\\[Pp]ic\[(.+?)\]/.match(text)) != nil
        picture = true
        pic_name = $1
        text.sub!(/\\[Pp]ic\[(.*?)\]/){""}
      end
      # Face
      if (/\\[Ff]ace\[(.+?)\]/.match(text)) != nil
        @face = true
        face_name = $1
        text.sub!(/\\[Ff]ace\[(.*?)\]/){""}
      end
      # Window over event
      if (/\\[Pp]\[([-1,0-9]+)\]/.match(text)) != nil
        over_event = true
        event = $1.to_i
        text.sub!(/\\[Pp]\[([-1,0-9]+)\]/){""}
      end
      # "\" display
      text.gsub!(/\\\\/){"\000"}
      # Text Color
      text.gsub!(/\\[Cc]\[([0-9]+)\]/){"\001[#{$1}]"}
      # Show Gold Window
      text.gsub!(/\\[Gg]/){"\002"}
      # Text size
      text.gsub!(/\\[Tt][Ss]\[([0-9]+)\]/){"\003[#{$1}]"}
      # Text font
      text.gsub!(/\\[Ff]ont\[(.+?)\]/){"\004[#{$1}]"}
      # Text different display
      text.gsub!(/\\[Tt]ext\[([0-9]+)\]/){"\005[#{$1}]"}
      # SlipKnot's Icon
      text.gsub!(/\\[Ii]con\[(.+?)\]/){"\006[#{$1}]"}
      # Dubealex's Icon
      text.gsub!(/\\[Ii]i{([IiWwAaSs]?)}\[([0-9]+)\]/){change_icon($1,$2.to_i)}
      # Bold font
      text.gsub!(/\\[Bb]/){"\007"}
      # Italic font
      text.gsub!(/\\[Ii]/){"\010"}
      # Array with all the lines width
      stxt = [0,0,0,0]
      @back.height = 32
      icon = ""; val = 0
      x = 112 if @face
      while ((c = text.slice!(/./m)) != nil)
        if c == "\000" then c = "\\" end
        if c == "\001"
          text.sub!(/\[([0-9]+)\]/, "")
          color = $1.to_i
          self.contents.font.color = text_color(color) if color >= 0 and color <= 7
          next
        end
        if c == "\002"
          if @gold_window == nil
            @gold_window = Window_Gold.new
            @gold_window.x = 560 - @gold_window.width
            if $game_temp.in_battle then @gold_window.y = 192
            else @gold_window.y = self.y >= 128 ? 32 : 384 end
            @gold_window.opacity = @back.opacity
            @gold_window.back_opacity = @back.back_opacity
          end; next
        end
        if c == "\003"
          text.sub!(/\[([0-9]+)\]/, "")
          self.contents.font.size = [[$1.to_i,8].max,32].min
          next
        end
        if c == "\004"
          text.sub!(/\[(.+?)\]/, "")
          self.contents.font.name = $1.to_s
          next
        end
        if c == "\005"
          text.sub!(/\[([0-9]+)\]/, "")
          case $1.to_i
          when 0 then disp_text
          when 1 then disp_text(false,true)
          when 2 then disp_text(true) end
          next
        end
        if c == "\006"
          text.sub!(/\[(.+?)\]/, "")
          icon = $1.to_s
          val += 24; c = ""
        end
        if c == "\007"
          if self.contents.font.bold
            self.contents.font.bold = false
          else self.contents.font.bold = true end
          next
        end
        if c == "\010"
          if self.contents.font.italic
            self.contents.font.italic = false
          else self.contents.font.italic = true end
          next
        end
        if c == "\011"
          icon = $gold_name
          val += 24; c = ""
        end
        if c == "\013"
          text.sub!(/\[(.*?)\]/,"")
          icon = $1.to_s
          val += 24; c = ""
        end
        if c == "\n"
          @cursor_width = [@cursor_width,x].max if y >= $game_temp.choice_start
          y += 1; x = sx = 0
          sx = x = 112 if @face
          x,sx = 8,14 if y >= $game_temp.choice_start
          next
        else stxt[y] += (self.contents.text_size(c).width+val) end
        @back.height = (y*32)+64
        if icon != ""
          self.contents.blt(4+x,32*y+5,RPG::Cache.icon(icon),Rect.new(0,0,24,24))
          x += 24; val,icon = 0,""
        end
        if $outline_text and !$shadow_text
          draw_text_outline(4+x,32*y,40,32,c,color)
        elsif $shadow_text and !$outline_text
          draw_text_shadow(4+x,32*y,40,32,c,color)
        else
          self.contents.font.color = text_color(color)
          self.contents.draw_text(4+x,32*y,40,32,c)
        end
        x += self.contents.text_size(c).width
      end
      @back.width = stxt.max+42+sx
      men_pos
    end
    if $game_temp.choice_max > 0
      @item_max = $game_temp.choice_max
      self.active,self.index = true,0
    end
    if $game_temp.num_input_variable_id > 0
      digits_max = $game_temp.num_input_digits_max
      number = $game_variables[$game_temp.num_input_variable_id]
      @input_number_window = Window_InputNumber.new(digits_max)
      @input_number_window.number = number
      @back.height += 32
      width = [@back.width,(@input_number_window.width-16)].max
      @back.width = width; men_pos
    end
    if over_event
      if $game_map.events != nil
        if event <= 0 then ch = $game_player
        else ch = $game_map.events[event] end
        fx = [[ch.screen_x-@back.width/2,4].max,636-@back.width].min
        fy = [[ch.screen_y-(@back.height+48),4].max,476-@back.height].min
        self.x = @back.x = fx
        self.y = @back.y = fy
      end
    end
    if picture
      px = self.x + @back.width
      @picture = Sprite.new
      @picture.bitmap = RPG::Cache.load_bitmap(@path,pic_name)
      @picture.x = px - @picture.bitmap.width
      @picture.y = self.y - @picture.bitmap.height
    end
    if name_box
      nbx,nby = self.x,self.y-15
      w = self.contents.text_size(name_text).width+12
      @name_box = Window_Base.new(nbx,nby,w,32)
      @name_box.z = self.z+1
      nbx += 6; nby += 4
      @name_box_text  = Name_Box_Text.new(nbx,nby,name_text)
      @name_box_text.z = self.z+2
    end
    if @face
      face = RPG::Cache.load_bitmap(@path,face_name)
      @back.height <= 128 ? fy = 0 : fy = ((@back.height-128)/2)
      self.contents.blt(0,fy,face,Rect.new(0,0,96,96))
      @back.height = 128 if @back.height <= 128
      men_pos
      @face = false
    end
  end
#-----------------------------------------------------------------
  def update
    super
    if @fade_in
      self.contents_opacity += 24
      if @input_number_window != nil
        @input_number_window.contents_opacity += 24
      end
      @fade_in = false if self.contents_opacity == 255
      return
    end
    if @input_number_window != nil
      @input_number_window.update
      if Input.trigger?(Input::C)
        $game_system.se_play($data_system.decision_se)
        $game_variables[$game_temp.num_input_variable_id] =
          @input_number_window.number
        $game_map.need_refresh = true
        @input_number_window.dispose
        @input_number_window = nil
        terminate_message
      end; return
    end
    if @contents_showing
      if Input.trigger?(Input::B)
        if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
          $game_system.se_play($data_system.cancel_se)
          $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
          terminate_message
        end
      end
      if Input.trigger?(Input::C)
        if $game_temp.choice_max > 0
          $game_system.se_play($data_system.decision_se)
          $game_temp.choice_proc.call(self.index)
        end; terminate_message
      end; return
    end
    if @fade_out == false and $game_temp.message_text != nil
      @contents_showing = true
      $game_temp.message_window_showing = true
      reset_window; refresh
      Graphics.frame_reset
      sk_visible
      self.contents_opacity = 0
      if @input_number_window != nil
        @input_number_window.contents_opacity = 0
      end
      @fade_in = true; return
    end
    if self.visible
      @fade_out = true
      @back.opacity -= 48
      if @back.opacity == 0
        sk_visible(false)
        @fade_out = false
        $game_temp.message_window_showing = false
      end; return
    end
  end
#-----------------------------------------------------------------
  def change_icon(option,index)
    option == nil ? option = "" : nil
    option.downcase!
    case option
    when "i" then s = $data_items[index]
    when "w" then s = $data_weapons[index]
    when "a" then s = $data_armors[index]
    when "s" then s = $data_skills[index] end
    return sprintf("\013[%s]%s",s.icon_name,s.name) unless s.name == nil
  end
#-----------------------------------------------------------------
  def disp_text(w1=false,w2=false)
    $outline_text,$shadow_text = w1,w2
  end
#-----------------------------------------------------------------
  def sk_visible(s=true)
    self.visible,@back.visible = s,s
  end
#-----------------------------------------------------------------
  def men_pos
    if $game_temp.in_battle then self.y = 96 - @back.height/2
    else
      case $game_system.message_position
      when 0 then self.y = 96 - @back.height/2
      when 1 then self.y = 240 - @back.height/2
      when 2 then self.y = 384 - @back.height/2 end
    end
    self.x = 320 - @back.width/2
    if @input_number_window != nil
      @input_number_window.y = (self.y+$game_temp.num_input_start*32)
      @input_number_window.x = self.x+8
      @input_number_window.x = self.x+8+112 if @face
    end
    @back.x,@back.y = self.x,self.y
  end
#-----------------------------------------------------------------
  def reset_window
    men_pos
    if $game_system.message_frame == 0 then @back.opacity = 255
    else @back.opacity = 0 end
    @back.back_opacity = 160
  end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Name_Box_Text < Window_Base
#-----------------------------------------------------------------
  def initialize(x,y,text)
    super(x-16,y-16,text.size*12+32,56)
    init; self.opacity = 0
    w,h = self.contents.width,self.contents.height
    if $outline_text and !$shadow_text then draw_text_outline(0,0,w,h,text)
    elsif $shadow_text and !$outline_text then draw_text_shadow(0,0,w,h,text)
    else self.contents.draw_text(0,0,w,h,text) end
  end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Window_Base < Window
#-----------------------------------------------------------------
  def draw_text_outline(x,y,wid,hei,str,col=0,ali=0)
    self.contents.font.color = Color.new(0,0,0,255)
    self.contents.draw_text(x+1,y,wid,hei,str,ali)
    self.contents.draw_text(x-1,y,wid,hei,str,ali)
    self.contents.draw_text(x,y+1,wid,hei,str,ali)
    self.contents.draw_text(x,y-1,wid,hei,str,ali)
    self.contents.font.color = text_color(col)
    self.contents.draw_text(x,y,wid,hei,str,ali)
  end
#-----------------------------------------------------------------
  def draw_text_shadow(x,y,wid,hei,str,col=0,ali=0)
    self.contents.font.color = Color.new(0,0,0,192)
    self.contents.draw_text(x+1,y+1,wid,hei,str,ali)
    self.contents.font.color = Color.new(0,0,0,96)
    self.contents.draw_text(x+2,y+2,wid,hei,str,ali)
    self.contents.font.color = text_color(col)
    self.contents.draw_text(x,y,wid,hei,str,ali)
  end
#-----------------------------------------------------------------
  def init(win=self,type=0,size=0,wid=0,hei=0)
    swid = (wid == 0 ? win.width-32 : wid)
    shei = (hei == 0 ? win.height-32 : hei)
    win.contents = Bitmap.new(swid,shei)
    type = $defaultfonttype if type == 0
    size = $defaultfontsize if size == 0
    win.contents.font.name = type
    win.contents.font.size = size
  end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
« Last Edit: April 29, 2007, 04:45:28 PM by Season In The Abyss »

THATS...........ONE.........NICE...........SCRIPT! IT MIGHT EVEN BEAT DUBEALEX'S, BUT ARE THE SAME COMMANDS AVAILIBLE???

***
Rep:
Level 90
Not all, but in the Demo all are showed.

*
Rep:
Level 98
Definitely better than Hitler.
2014 Best IRC Chatterbox2014 Best Musician2013 King of RMRK2013 Best Musician2013 Best Use of Avatar and Signature Space2013 Funniest MemberFor the great victory in the Breakfast War.2012 Best Username2012 Best MusicianFor frequent good quality Wiki writing [citation needed]2011 Funniest Member2011 Best MusicianMost entertaining member on the IRC2010 Most Missed Member
That's a great script. I think I'll use it. So you created this?
:tinysmile:

***
Rep:
Level 90
Yes, you can see that in other three forums, is made by me (Slipknot)

**
Rep:
Level 90
I eat leather belts
HOLY CRAP!!!!!!! That's a nice script!! Kudos on the nice script buddy!!

Bridget is SOOOOOOOOOOO kewl XD

******
Rep:
Level 91
a seriously long one too, must have been a true pain in the ass to write it..
very nice one, nice to have a good scripter like you around here
holy shit my sig was big!

**
Rep:
Level 90
I eat leather belts
Sorry if this is a stupid question, but what script do I edit with the code?

Bridget is SOOOOOOOOOOO kewl XD

******
Rep:
Level 91
Window_Message for as far as i can tell
holy shit my sig was big!

*****
Rep:
Level 91
Thanks For Coming
Quote from: blueXx
Window_Message for as far as i can tell


Nope, you make a new script  :D

******
Rep:
Level 91
Quote from: dwarra

Nope, you make a new script  :D


i thought so too that's why i went "omg thats a shiny script" but no, actually it's an edited script, it's still a god damn heavy work, just 200 lines shorter than i thought...

if you'll look closely the first 100-200 lines are the same as it was in the normal script and then comes a big fat editing.

although the results of putting it as a new script are the same as editing the original Window_Message it's still belong in Window_Message script

no, i didn't look 1 by 1 lines i simply noticed the class line:
class Window_Message < Window_Selectable
enterbrain named their scripts after the classes or vice versa so it's ez to tell
holy shit my sig was big!

*****
Rep:
Level 91
Thanks For Coming
Quote from: blueXx
Quote from: dwarra

Nope, you make a new script  :D


i thought so too that's why i went "omg thats a shiny script" but no, actually it's an edited script, it's still a god damn heavy work, just 200 lines shorter than i thought...

if you'll look closely the first 100-200 lines are the same as it was in the normal script and then comes a big fat editing.

although the results of putting it as a new script are the same as editing the original Window_Message it's still belong in Window_Message script

no, i didn't look 1 by 1 lines i simply noticed the class line:
class Window_Message < Window_Selectable
enterbrain named their scripts after the classes or vice versa so it's ez to tell


May i ask without being rude what your point is?
The demo has a new script, so thats what you do  :?

If you wanna reply, PM me, i dont want to spam...

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
You are both partially correct.

@dwarra - when you make it a new script, it overides the original, but it lags because it still has to process the original

@blueXx - you don't have to *edit* anything, just replace all of Window_Message with the fore-posted script
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

*
Rep:
Level 98
Definitely better than Hitler.
2014 Best IRC Chatterbox2014 Best Musician2013 King of RMRK2013 Best Musician2013 Best Use of Avatar and Signature Space2013 Funniest MemberFor the great victory in the Breakfast War.2012 Best Username2012 Best MusicianFor frequent good quality Wiki writing [citation needed]2011 Funniest Member2011 Best MusicianMost entertaining member on the IRC2010 Most Missed Member
Thank you Tsuno for clearing that up.
:tinysmile:

******
Rep:
Level 91
:roll:  and to think i said the very same as tsu and no one understood...
ok let's have a reading class

Quote

i thought so too that's why i went "omg thats a shiny script" but no, actually it's an edited script, it's still a god damn heavy work, just 200 lines shorter than i thought...

if you'll look closely the first 100-200 lines are the same as it was in the normal script and then comes a big fat editing.

that's me explaining to dwarra why this script should be in window_message and not in a new one

Quote
although the results of putting it as a new script are the same as editing the original Window_Message it's still belong in Window_Message script

that's me explaining why it seems to be a new script, and how come it works, i didn't mention no lag cus for some reason my pc doesn't lag with both

Quote
no, i didn't look 1 by 1 lines i simply noticed the class line:
class Window_Message < Window_Selectable
enterbrain named their scripts after the classes or vice versa so it's ez to tell

and that's me explaining how to find out where to post your script.

maybe i need a writing class -.-

Quote
@blueXx - you don't have to *edit* anything, just replace all of Window_Message with the fore-posted script

and maybe you need a reading class? you act as if i didn't know it -.-
"replacing" is a form of editing ... like duh...
and by "edit" i meant that slipknot edited an exisiting script and didn't make a new one from nothing, like duh X 2.
holy shit my sig was big!

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
Editing means to change a part of, yet leave some of it intact, so no, replacing is not a type of editing.
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

******
Rep:
Level 91
true but yet a big part of the "edited file" you request us to replace with the old is in fact the very same as the old one and thus it's still 1 and a half legs in editing , replacing fully is simply taking a shortcut , yet still it does not replace in this case the whole but only a part, that is why it is a form of editing in this case.

and that is also why we are both spamming like morons.
lock before it gets too off topic?
holy shit my sig was big!

*****
Rep:
Level 91
Thanks For Coming
Quote from: blueXx
true but yet a big part of the "edited file" you request us to replace with the old is in fact the very same as the old one and thus it's still 1 and a half legs in editing , replacing fully is simply taking a shortcut , yet still it does not replace in this case the whole but only a part, that is why it is a form of editing in this case.

and that is also why we are both spamming like morons.
lock before it gets too off topic?


I dont say lock, people still want too comment this awesome script, i say shut up to put it quickly  :P

*****
Rep:
Level 91
Captain Fucking Callahan
Quote from: dwarra




I dont say lock, people still want too comment this awesome script, i say shut up to put it quickly  :P


So true Dwarra *claps*  Well i really like this Script GREAT job Dude BlueXx...dont listen to him. Well anywasys great job.
"Always remember the best form of revenge is to better yourself." -ZV

******
Rep:
Level 91
shadow stop spamming up topics if you don't have anything to say, and if you already say something at least try and make sense.
(that's why i asked for locking, the script is explained well, the questions were answered and now the spammers are going to have fun, we know it's a good script without every 2nd person saying that)

*puts an invisible-don't-post-unless-it's-a-question-or-a-"hail-only"-message lock*
holy shit my sig was big!

***
Rep:
Level 90
Only paste it below the orginal Window_Message and above the Mains ection.
And thanks! :roll:

***
Rep: +0/-0Level 89
I really want this script. I j

***
Rep:
Level 90
Uhn, you're double posting with the same post?
Only paste the script before main in the Script editor, What is the problem?

***
Rep:
Level 90
How do you make it do a certain one only?
Quote
Zxmelee says: I FUCKED A CHICK GEEZ
Neko says: I doubt it was a girl
Neko says: Was "she" working the corners?
Zxmelee says: Well, I was lying...
Zxmelee says: but, oh man. They were all over me
Neko says: With a few bucks
Neko says: That hapens

Pwnzorz'd

***
Rep:
Level 90
Quote from: Neko
How do you make it do a certain one only?
What do you mean? :O_o: