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
> Simple Message Box Script, Bored of normal text box in writing messages? Try this!
mattfriends
post Jul 28 2010, 04:45 AM
Post #1


Level 3
Group Icon

Group: Member
Posts: 43
Type: Scripter
RM Skill: Advanced




This is the simple message that allow you to read messages or letter in the box rather than normal text box.

SCREENSHOTS / VIDEOS
Inside the DEMO.

INTRODUCTION
Inside the script.

DEMO
Link 1

SCRIPT
CODE
#=============================================================================
#
#                     Mattfriends's Simple Message Box
#
# Introduction:
# Place the script above Main.
#
# How to use:
# Use this to call the script,
# $scene = Scene_Message.new
#
# To add texts in the message use this,
# MyMessage.setText("LINE 1","LINE 2","LINE 3","LINE 4","LINE 5")
#
# Don't forget to set the title,
# MyMessage.setTitle("TITLE TEXTS")
#
# If you want the picture in it use this,
# MyMessage.setSprite("PIC_NAME.png")
# The picture need to stay in the Battlers folder.
#
# This is what the picture will look like.
# --------------------------------------------------------
# | Picture  | Picture  | Picture  | Picture  | Picture  |
# |  Frame   |  Frame   |  Frame   |  Frame   |  Frame   |
# |    1     |    2     |    3     |    4     |    5     |
# --------------------------------------------------------
#
# Examples:
# MyMessage.setTitle("Return the book.")
# MyMessage.setText(
# "Please reture the book",
# "back to the library and",
# "pay $5 for the fee.",
# "",
# "")
# MyMessage.setSprite("Book.png")
#
# Credit:
# mattfriends for making it
#
# PLEASE GIVE CREDITS AFTER USING IT
#
#=============================================================================


class ThisDesc < Window_Base
  def initialize
    super(0, 0, 640, 70)
    self.contents = Bitmap.new(width - 32, height - 32)
    update
  end
  def update
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.font.size = 25
    cx = contents.text_size($msgTitle).width
    self.contents.draw_text(0, 0, cx, 37, $msgTitle)
  end
end

class ThisMain < Window_Base
  def initialize
    #+-----------------------------------------------------+
    #| Blank Picture when you haven't set the picture yet. |
    #+-----------------------------------------------------+
    $BLANK_PIC = ""
    
    super(0, 70, 640, 410)
    self.contents = Bitmap.new(width - 32, height - 32)
    @frame = 0
    @frames = 0
    @frame_count = Graphics.frame_count
    @frame_width = 0
    @frame_height = 0
    
    if $sprite!=nil and $sprite!=""
      @bitmap = RPG::Cache.battler($sprite, 0)
    else
      @bitmap = RPG::Cache.battler($BLANK_PIC, 0)
    end
    get_settings
    update
  end
  
  def get_settings
      #Gets the number of frames from the image
      @frames = @bitmap.width / @bitmap.height
      #Get's the frame height
      @frame_height = @bitmap.height
      #Get's the frame width;
      @frame_width = @bitmap.width / @frames
  end
  
  def update
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.font.size = 20
    cx = contents.text_size($ln1).width
    self.contents.draw_text(0, 0, cx, 32, $ln1)
    cx = contents.text_size($ln2).width
    self.contents.draw_text(0, 32, cx, 32, $ln2)
    cx = contents.text_size($ln3).width
    self.contents.draw_text(0, 64, cx, 32, $ln3)
    cx = contents.text_size($ln4).width
    self.contents.draw_text(0, 96, cx, 32, $ln4)
    cx = contents.text_size($ln5).width
    self.contents.draw_text(0, 128, cx, 32, $ln5)
    
    time = Graphics.frame_count - @frame_count
    if time >= 10
      #Save the current frame count
      @frame_count = Graphics.frame_count
      #Get the next frame
      rect = Rect.new(@frame * @frame_width, 0, @frame_width, @frame_height)
      #Displays the image
      self.contents.blt(width/3, 160, @bitmap, rect, 160)
      #Increase the current frame
      @frame += 1
      # if its the end of the frame
      if @frame == @frames
        @frame = 0  
      end
    else #if its the same frame;
      #Get the next frame
      rect = Rect.new(@frame * @frame_width, 0, @frame_width, @frame_height)
      #Displays the image
      self.contents.blt(width/3, 160, @bitmap, rect, 160)
    end
  end
end

class Scene_Message
  def main
    @windowDesc = ThisDesc.new
    @windowMain = ThisMain.new
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
      if Input.trigger?(Input::B) or Input.trigger?(Input::C)
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
        break
      end
    end
    Graphics.freeze
    @windowDesc.dispose
    @windowMain.dispose
  end
  
  def update
    @windowDesc.update
    @windowMain.update
  end
end

class MyMessage
  def self.setTitle(text)
    $msgTitle = text
  end
  def self.setText(ln1,ln2,ln3,ln4,ln5)
    $ln1 = ln1
    $ln2 = ln2
    $ln3 = ln3
    $ln4 = ln4
    $ln5 = ln5
  end
  def self.setSprite(sprite)
    $sprite = sprite
  end
end

CREDIT
Me - For making all of the script. biggrin.gif

I hope you will use it or at least interest. laugh.gif


__________________________
The new adventure - Real time action battle game.

Lastest Version - Demo v2.0

MY WEBSITE: I have moved to my website now. I'm not usually activate here anymore.

http://rpgxpultimate.darkbb.com/
Please register.
Go to the top of the page
 
+Quote Post
   
DementedCashew
post Jul 28 2010, 07:13 AM
Post #2


Big Sister
Group Icon

Group: Revolutionary
Posts: 242
Type: Developer
RM Skill: Skilled




It's a nice script, i might use it if you make it compatible with VX.

This post has been edited by DonyaClaudia: Jul 28 2010, 07:14 AM


__________________________


------------------------------------------------------------------------------------------
My Stuff



Go to the top of the page
 
+Quote Post
   
Locke
post Aug 6 2010, 04:30 PM
Post #3


Level 10
Group Icon

Group: Revolutionary
Posts: 151
Type: Mapper
RM Skill: Intermediate




Nice i like this script, Good Job thumbsup.gif


__________________________
We are one (Really i,m not joking)



I've seen many things when mankind rule the land


Which Final Fantasy Character Are You?
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: 18th May 2013 - 09:09 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker