Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %Q(
- ╔════╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═════╗
- ║ ╔══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╗ ║
- ╠─╣ Scrolling Help Descriptions. ╠─╣
- ╠─╣ by RPG Maker Source. ╠─╣
- ╠─╣ www.rpgmakersource.com ╠─╣
- ║ ╚══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╝ ║
- ╠════╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═════╣
- ║ ┌────┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴─────┐ ║
- ╠─┤ Version 1.0.1 01/07/15 DD/MM/YY ├─╣
- ║ └────┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┘ ║
- ╠══════╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══════╣
- ║ ║
- ║ This work is protected by the following license: ║
- ║ ╔══════════════════════════════════════════════════════════════════╗ ║
- ║ │ │ ║
- ║ │ Copyright © 2014 Maker Systems. │ ║
- ║ │ │ ║
- ║ │ This software is provided 'as-is', without any kind of │ ║
- ║ │ warranty. Under no circumstances will the author be held │ ║
- ║ │ liable for any damages arising from the use of this software. │ ║
- ║ │ │ ║
- ║ │ Permission is granted to anyone to use this software on their │ ║
- ║ │ free or commercial games made with a legal copy of RPG Maker │ ║
- ║ │ VX Ace, as long as Maker Systems - RPG Maker Source is │ ║
- ║ │ credited within the game. │ ║
- ║ │ │ ║
- ║ │ Selling this code or any portions of it 'as-is' or as part of │ ║
- ║ │ another code, is not allowed. │ ║
- ║ │ │ ║
- ║ │ The original header, which includes this copyright notice, │ ║
- ║ │ must not be edited or removed from any verbatim copy of the │ ║
- ║ │ sotware nor from any edited version. │ ║
- ║ │ │ ║
- ║ ╚══════════════════════════════════════════════════════════════════╝ ║
- ║ ║
- ║ ║
- ╠══════════════════════════════════════════════════════════════════════════════╣
- ║ 1. VERSION HISTORY. ▼ ║
- ╠══════════════════════════════════════════════════════════════════════════════╣
- ║ ║
- ║ • Version 1.0.0, 05/06/15 - (DD/MM/YY). ║
- ║ ║
- ║ • Version 1.0.1, 01/07/15 - (DD/MM/YY). ║
- ║ - Properly matches the visibility and opacity of the window. ║
- ║ ║
- ╠══════════════════════════════════════════════════════════════════════════════╣
- ╠══════════════════════════════════════════════════════════════════════════════╣
- ║ 2. USER MANUAL. ▼ ║
- ╠══════════════════════════════════════════════════════════════════════════════╣
- ║ ║
- ║ ┌──────────────────────────────────────────────────────────────────────────┐ ║
- ║ │ ■ Introduction. │ ║
- ║ └┬┬┬┬──────────────────────────────────────────────────────────────────┬┬┬┬┘ ║
- ║ ║
- ║ Hello there! This script is "plug and play", you can simply insert it into ║
- ║ your project and it will perform flawlessly. ║
- ║ ║
- ║ This script makes the second description line displayed in Help windows ║
- ║ scroll if the line is wider than the window. ║
- ║ By default, the text is shrinked to fit it into the window, but using ║
- ║ this script, the text will be kept in its perfect dimensions and instead, ║
- ║ the line will cycle horizontally at the desired speed. ║
- ║ ║
- ║ We hope you enjoy it. ║
- ║ ║
- ║ Thanks for choosing our products. ║
- ║ ║
- ║ ┌──────────────────────────────────────────────────────────────────────────┐ ║
- ║ │ ■ Configuration. │ ║
- ║ └┬┬┬┬──────────────────────────────────────────────────────────────────┬┬┬┬┘ ║
- ║ ║
- ║ "How do I change the speed of the scrolling?" ║
- ║ Right click anywhere in the script editor and select "Find" (or CTRL + F) ║
- ║ search for "SPEED" (without quotation marks). ║
- ║ ║
- ║ You will see something like "SPEED = 0.8" ║
- ║ ║
- ║ Set the number after the equality sign to any numer you like, bigger ║
- ║ than 0. The bigger the number, the faster the scrolling will seem, and ║
- ║ the smaller the number, the slower. ║
- ║ ║
- ╠══════════════════════════════════════════════════════════════════════════════╣
- ╠══════════════════════════════════════════════════════════════════════════════╣
- ║ 3. NOTES. ▼ ║
- ╠══════════════════════════════════════════════════════════════════════════════╣
- ║ ║
- ║ Have fun and enjoy! ║
- ║ ║
- ╠══════════════════════════════════════════════════════════════════════════════╣
- ╠══════════════════════════════════════════════════════════════════════════════╣
- ║ 4. CONTACT. ▼ ║
- ╠══════════════════════════════════════════════════════════════════════════════╣
- ║ ║
- ║ Keep in touch with us and be the first to know about new releases: ║
- ║ ║
- ║ www.rpgmakersource.com ║
- ║ www.facebook.com/RPGMakerSource ║
- ║ www.twitter.com/RPGMakerSource ║
- ║ www.youtube.com/user/RPGMakerSource ║
- ║ ║
- ║ Get involved! Have an idea for a system? Let us know. ║
- ║ ║
- ║ Spread the word and help us reach more people so we can continue creating ║
- ║ awesome resources for you! ║
- ║ ║
- ╚══════════════════════════════════════════════════════════════════════════════╝)
- #==============================================================================
- # ** MakerSystems
- #------------------------------------------------------------------------------
- # Module for our scripts.
- #==============================================================================
- module MakerSystems
- #============================================================================
- # ** MessagePauseAnimation
- #----------------------------------------------------------------------------
- # This module is used to easily change the behavior of the script.
- #============================================================================
- module ScrollingHelpDescriptions
- #------------------------------------------------------------------------
- # * Scrolling Speed.
- #------------------------------------------------------------------------
- # Bigger numbers mean faster scrolling. Default is 0.8
- #------------------------------------------------------------------------
- SPEED = 0.8
- end
- end
- #==============================================================================
- # ** Window_Help
- #------------------------------------------------------------------------------
- # This window shows skill and item explanations along with actor status.
- #==============================================================================
- class Window_Help < Window_Base
- #--------------------------------------------------------------------------
- # * Update. [MOD]
- #--------------------------------------------------------------------------
- def update
- # Original method.
- super
- @ms_scrolling_help_speed ||= MakerSystems::ScrollingHelpDescriptions::SPEED
- # Scrolling line?
- if @ms_scrolling_help_line
- text = contents_opacity
- help = opacity
- @ms_scrolling_help_line.visible = visible
- @ms_scrolling_help_line.opacity = text < help ? text : help
- # Advance the step value.
- @ms_scrolling_help_step += @ms_scrolling_help_speed
- # If step value is greater than 1, scroll the line.
- if @ms_scrolling_help_step > 1.0
- # Reset step value.
- @ms_scrolling_help_step = 0.0
- # Change the offset X to scroll.
- @ms_scrolling_help_line.ox += 1
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Set Text. [REP]
- #--------------------------------------------------------------------------
- def set_text(text)
- # New text?
- if text != @text
- # Get each line of the description.
- lines = text.split(/\r\n/)
- # Dispose the Scrolling Help objects if needed.
- ms_scrolling_help_dispose if @ms_scrolling_help_line
- # Is there a second line that exceeds the window width?
- if lines[1] && (line_width = contents.text_size(lines[1]).width) > width
- # Then assign the first line as the "normal" text.
- @text = lines[0]
- # ...and draw the second line as a scrolling line.
- ms_scrolling_help_create(lines[1], line_width)
- else
- # Normal method.
- @text = text
- end
- # Draws stuff on thangs.
- refresh
- end
- end
- #--------------------------------------------------------------------------
- # * Scrolling Help Create. [NEW]
- #--------------------------------------------------------------------------
- def ms_scrolling_help_create(line, width)
- # Create a Bitmap instance to draw the text into it.
- line_bitmap = Bitmap.new(width, calc_line_height(line))
- # Save current Window's Bitmap.
- original_contents = contents
- # Set the recently created Bitmap as the Window's Bitmap.
- self.contents = line_bitmap
- # Use the default method to draw the text into it.
- draw_text_ex(4, 0, line)
- # Reset back the Window's Bitmap to the original one.
- self.contents = original_contents
- # Viewport for the Scrolling Line.
- @ms_scrolling_help_view = Viewport.new(
- x + standard_padding,
- y + standard_padding + calc_line_height(line),
- contents.width,
- line_bitmap.height
- )
- # Put the recently created Viewport on top of this Window.
- @ms_scrolling_help_view.z = viewport ? viewport.z + 1 : z + 1
- # Create a Plane instance for the scrolling effect.
- @ms_scrolling_help_line = Plane.new(@ms_scrolling_help_view)
- # Assign the recently created Bitmap (where the line is drawn) to it.
- @ms_scrolling_help_line.bitmap = line_bitmap
- # Initial step value for timing the scrolling according to certain "speed".
- @ms_scrolling_help_step = 0.0
- end
- #--------------------------------------------------------------------------
- # * Scrolling Help Dispose. [NEW]
- #--------------------------------------------------------------------------
- def ms_scrolling_help_dispose
- # Disposes Bitmap, Plane and Viewport.
- @ms_scrolling_help_line.bitmap.dispose
- @ms_scrolling_help_line.dispose
- @ms_scrolling_help_view.dispose
- # Prevents executing this method when the Plane (or Viewport) is disposed.
- @ms_scrolling_help_view = nil
- @ms_scrolling_help_line = nil
- end
- #--------------------------------------------------------------------------
- # * Dispose. [MOD]
- #--------------------------------------------------------------------------
- def dispose
- # Dispose Scrolling Help objects if needed.
- ms_scrolling_help_dispose if @ms_scrolling_help_line
- # Original method.
- super
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement