Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Wecoc

101
RMXP Script Database / [XP] Scene_Shop Item Counter
January 11, 2013, 03:45:05 pm
Scene_Shop Item Counter
Authors: Wecoc
Version: 1.0
Type: Shop AddOn
Key Term: Custom Shop System

Introduction

With that easy script, you will be able to control how many items you will buy (or sell), without going to a counter window.
The new multiplier number shown on the same window as the items list, will be managed now with -> and <-

Features

  • Works on Buy Window and Sell Window
  • Price string is multiplied automatically.

Screenshots

Spoiler: ShowHide




Demo

Nope for this type of script.

Script

Spoiler: ShowHide

#==============================================================================
# ** [XP] Castlevania Shop Item Counter v 1.1
#------------------------------------------------------------------------------
# Autor: Wecoc (no requiere créditos)
#==============================================================================

#==============================================================================
# ** Window_ShopBuy
#==============================================================================

class Window_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  attr_accessor :shop_multipliers
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  alias castle_multi_ini initialize unless $@
  def initialize(shop_goods)
    @shop_multipliers = Array.new(shop_goods.size, 1)
    castle_multi_ini(shop_goods)
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    multi = @shop_multipliers[index]
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    price = item.price * multi
    if price <= $game_party.gold and number < 99
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4
    y = index * 32
    rect = Rect.new(x, y, self.width - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 160, y, 88, 32, multi.to_s, 2)
    self.contents.draw_text(x + 240, y, 88, 32, price.to_s, 2)
  end
end

#==============================================================================
# ** Scene_Shop
#==============================================================================

class Scene_Shop
  #--------------------------------------------------------------------------
  # * Frame Update (when buy window is active)
  #--------------------------------------------------------------------------
  def update_buy
    @status_window.item = @buy_window.item
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @command_window.active = true
      @dummy_window.visible = true
      @buy_window.active = false
      @buy_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      @help_window.set_text("")
      return
    end
    if Input.repeat?(Input::RIGHT)
      item = @buy_window.item
      return if item == nil
      multi = @buy_window.shop_multipliers[@buy_window.index]
      return if multi == 99 or item.price * (multi + 1) > $game_party.gold
      $game_system.se_play($data_system.cursor_se)
      @buy_window.shop_multipliers[@buy_window.index] += 1
      @buy_window.draw_item(@buy_window.index)
    end
    if Input.repeat?(Input::LEFT)
      item = @buy_window.item
      return if item == nil
      multi = @buy_window.shop_multipliers[@buy_window.index]
      return if multi == 1
      $game_system.se_play($data_system.cursor_se)
      @buy_window.shop_multipliers[@buy_window.index] -= 1
      @buy_window.draw_item(@buy_window.index)
    end
    if Input.trigger?(Input::C)
      @item = @buy_window.item
      if @item == nil
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      multi = @buy_window.shop_multipliers[@buy_window.index]
      price = @item.price * multi
      if price > $game_party.gold
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      case @item
      when RPG::Item
        number = $game_party.item_number(@item.id)
      when RPG::Weapon
        number = $game_party.weapon_number(@item.id)
      when RPG::Armor
        number = $game_party.armor_number(@item.id)
      end
      if number == 99
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.shop_se)
      $game_party.lose_gold(price)
      case @item
      when RPG::Item
        $game_party.gain_item(@item.id, multi)
      when RPG::Weapon
        $game_party.gain_weapon(@item.id, multi)
      when RPG::Armor
        $game_party.gain_armor(@item.id, multi)
      end
      @buy_window.shop_multipliers[@buy_window.index] = 1
      @gold_window.refresh
      @buy_window.refresh
      @status_window.refresh
    end
  end
end


Instructions

Just post above main.

Compatibility

Probably it will not fit well with custom shop systems.

Credits and Thanks

  • Wecoc

Author's Notes

Please report any bugs/issues.
102
I did.
------
I posted some examples on screenshot section. Anyway, with that example I think it will be easily understandable what that script does:

Spoiler: ShowHide


Imagine you created the next autotile:



But you can't do the corners tile in a good way to make it without cuts.



Well, now try this one with the script:





It's like a Graphic Designer's tool.
103
RMXP Script Database / [XP] Message Choice Edit
January 07, 2013, 05:52:54 pm
Message Choice Edit
Authors: Wecoc
Version: 1.1
Type: Message Add-on
Key Term: Message Add-on



Introduction

This edit changes choice distribution displaying it horizontally instead of vertically. Long sentences will be shown as always.


Features


  • Short sentences will be shown horizontally (even if 4 choices fit on 1 line).

  • Long sentences will be shown as always.

  • You can easily activate and deactivate the script anytime using Game Temp.




Screenshots

Spoiler: ShowHide

That was silly



Demo

None.


Script

Spoiler: ShowHide

#==============================================================================
# Choice Edit - versión 1.1
# by Wecoc
#==============================================================================

class Game_Temp

  attr_accessor :choice_short
  attr_accessor :choice_type
  attr_accessor :choice_data

  alias ini initialize unless $@
  def initialize
    ini
   
    # To activate / deactivate the script only thing you have to do is
    #modify next line:
       
        @choice_short = true
       
    # false: vertical (default), true : horizontal (just short words)
    # Long sentences will always be displayed vertically.
   
    @choice_data = nil
    @choice_type = 0 # 0 = vertical, 1 = horizontal
  end
end

class Interpreter
  def setup_choices(parameters)
    $game_temp.choice_max = parameters[0].size
    $game_temp.choice_data = parameters[0]
   
    w = $game_temp.choice_data.to_s.length
    if w > 26
      $game_temp.choice_type = 0
    else
      if $game_temp.choice_short == true
        $game_temp.choice_type = 1
      else
        $game_temp.choice_type = 0
      end
    end
   
    if $game_temp.choice_type == 0 # Vertical
      for text in parameters[0]
        $game_temp.message_text += text + "\n"
      end   
    else # Horizontal
      for text in parameters[0]
        $game_temp.message_text += text + "      "
      end
      $game_temp.message_text += "\n"
    end
    $game_temp.message_text += "\n"
    $game_temp.choice_cancel_type = parameters[1]
    current_indent = @list[@index].indent
    $game_temp.choice_proc = Proc.new { |n| @branch[current_indent] = n }
  end
end

class Interpreter
  def command_101 # Show Text
    if $game_temp.message_text != nil
      return false
    end
    @message_waiting = true
    $game_temp.message_proc = Proc.new { @message_waiting = false }
    $game_temp.message_text = @list[@index].parameters[0] + "\n"
    line_count = 1
    loop do
      if @list[@index+1].code == 401 # Show Text
        $game_temp.message_text += @list[@index+1].parameters[0] + "\n"
        line_count += 1
      else
        if @list[@index+1].code == 102 # Show Choices
         
          a = @list[@index+1].parameters[0]
          w = a.to_s.length
          if w > 26
            $game_temp.choice_type = 0
          else
            if $game_temp.choice_short == true
              $game_temp.choice_type = 1
            else
              $game_temp.choice_type = 0
            end
          end

          if (@list[@index+1].parameters[0].size <= 4 - line_count and
          $game_temp.choice_type == 0) or (line_count < 4 and
          $game_temp.choice_type == 1) then
            @index += 1
            $game_temp.choice_start = line_count
            setup_choices(@list[@index].parameters)
          end
        elsif @list[@index+1].code == 103 # Input Number
          if line_count < 4
            @index += 1
            $game_temp.num_input_start = line_count
            $game_temp.num_input_variable_id = @list[@index].parameters[0]
            $game_temp.num_input_digits_max = @list[@index].parameters[1]
          end
        end
        return true
      end
      @index += 1
    end
  end
end

class Window_Message < Window_Selectable
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    x = y = 0
    if $game_temp.choice_start == 0
      x = 8
    end
    @cursor_width = 0
    if $game_temp.message_text != nil
      text = $game_temp.message_text
      begin
        last_text = text.clone
        text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
      end until text == last_text
      text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
        $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
      end
      text.gsub!(/\\\\/) { "\000" }
      text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
      text.gsub!(/\\[Gg]/) { "\002" }
      while ((c = text.slice!(/./m)) != nil)
        if c == "\000"
          c = "\\"
        end
        if c == "\001"
          text.sub!(/\[([0-9]+)\]/, "")
          color = $1.to_i
          if color >= 0 and color <= 7
            self.contents.font.color = text_color(color)
          end
          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
              @gold_window.y = 192
            else
              @gold_window.y = self.y >= 128 ? 32 : 384
            end
            @gold_window.opacity = self.opacity
            @gold_window.back_opacity = self.back_opacity
          end
          next
        end
        if c == "\n"
          if y >= $game_temp.choice_start
            @cursor_width = [@cursor_width, x].max
          end
          y += 1
          x = 0
         
          if y >= $game_temp.choice_start and $game_temp.choice_type == 0
            x = 8
          end
          next
        end
        self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
        x += self.contents.text_size(c).width
      end
    end
   
    # If choice
    if $game_temp.choice_max > 0
      @column_max = $game_temp.choice_max if $game_temp.choice_type == 1
      @item_max = $game_temp.choice_max
      self.active = true
      self.index = 0
    end
    # If number input
    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
      @input_number_window.x = self.x + 8
      @input_number_window.y = self.y + $game_temp.num_input_start * 32
    end
  end

  def update_cursor_rect
    if @index >= 0
      if $game_temp.choice_type == 0
        n = $game_temp.choice_start + @index
        self.cursor_rect.set(8, n * 32, @cursor_width, 32)
      else
        n = $game_temp.choice_start
        w = self.contents.text_size($game_temp.choice_data[@index]).width
        a = 0
        for i in 0..@index-1
          a += self.contents.text_size($game_temp.choice_data[i] + "      ").width
        end
        self.cursor_rect.set(a, n * 32, w+10, 32)
      end
    else
      self.cursor_rect.empty
    end
  end
end



Instructions

Use $game_temp.choice_short = (true/false) on a Script Call before a choice to activate or deactivate the script.



Compatibility

Should be compatible, but I didn't used any alias except on Game Temp.


Credits and Thanks


  • Wecoc




Author's Notes

Please report any bugs/issues/incompatibilities.
104
RMXP Script Database / [XP] RM2kXP v0.7
January 06, 2013, 08:06:05 am
    RM2kXP
    Authors: Wecoc
    Version: 0.7
    Type: Add-on Collection
    Key Term: Add-on Collection



    Introduction

    RM2kXP is a compilation of add-ons for XP that makes all to work like on the old RPG Maker or simulating it's style. It includes a lot of new features.



    Features

    VERSION 0.1 (Aug 07, 2011)


    • Windowskin System

    • Draw_Text Colors

    • 2k CMS

    • Faceset support

    • Fullscreen

    • Sprite Timer

    • 2k Shop with "only buy / sell" function

    • 2k Name Input



    VERSION 0.5 (Jan 03, 2013)


    • Vehicle System (by Orochii)



    VERSION 0.6 (Feb 03, 2013)


    • Vocab Script

    • Encounters by terrain (by gameus)

    • Terrain battlebacks (by gameus)

    • Replace Tile AddOn



    VERSION 0.7 (Jul 09, 2013)

    • F4 & F5 support

    • Interpreter Script Call Fix (by Juan)

    • New icon style using "2k_" on it's name

    • Restricted use and apply items (by gerrtunk)

    • Multiusable items (by gerrtunk)

    • Weapon & Skill AddOns (by gerrtunk)

    • Encounter step rate command (by gerrtunk)





    Screenshots

    Spoiler: ShowHide













    Demo

    Download RM2kXP v0.7.zip



    Compatibility

    Checked with Mode 7, Neo_Mode 7 and Cogwheel's Sideview Battle and fits well with them.
    With big systems like XAS or BABS may appear issues.
    Not compatible with SDK.



    Credits and Thanks


    • Wecoc => RM2KXP Author

    • Poccil/Flameguru => Window module base for System Windowskin

    • Orochii => Vehicle System XP

    • gameus => Terrain Battlebacks / Monster Areas

    • Zeus81 => Fullscreen (F5) script

    • Juan => Interpreter Script Call Fix

    • gerrtunk => Some lost features



    [/list]
    105
    I'm using the 1.2 version of this script on XP but I found a problem with that. Well, without the script, when you are on a map with a current music and you teleport to another map, if the other map's music is the same it continues. But with the script it restarts.

    I would like to make an iMuse easy engine with that script (I believe it could be possible) but with that bug I can't...
    106
    I thought I had more margin with the template, sorry. I already edited the post.
    107
    Tilemap new Autotile lecture
    Authors: Wecoc
    Version: 1.0
    Type: Tilemap Add-on
    Key Term: Environment Add-on



    Introduction

    The script now allows to use a new type of autotiles:

    Before
    After



    Features


    • You can use both lectures, it reads each depending on autotile height.

    • It supports animated autotiles

    • On the editor you will see the normal autotile




    Screenshots

    Spoiler: ShowHide
    Before

    After



    Spoiler: ShowHide
    Before

    After





    Script

    Spoiler: ShowHide
    # Tilemap de Pokemon Essentials
    # + Nueva Lectura de Autotiles

    class TilemapAutotiles
     attr_accessor :changed
     def initialize
     @changed=true
     @tiles=[nil,nil,nil,nil,nil,nil,nil]
     end
     def []=(i,value)
     @tiles[i]=value
     @changed=true
     end
     def [](i)
     return @tiles[i]
     end
    end

    class Tilemap
     Animated_Autotiles_Frames = 15
       NewAutotiles = [
       [ [27, 28, 33, 34], [49, 50, 55, 56], [51, 52, 57, 58], [49, 52, 55, 58],
         [63, 64, 69, 70], [65, 66, 71, 72], [51, 52, 69, 70], [ 5,  6, 33, 12] ],
       [ [61, 62, 67, 68], [49, 50, 67, 68], [53, 54, 59, 60], [ 5,  6, 11, 34],
         [61, 64, 67, 70], [ 5, 28, 11, 12], [27,  6, 11, 12], [ 5,  6, 11, 12] ],
       [ [25, 26, 31, 32], [25,  6, 31, 32], [25, 26, 31, 12], [25,  6, 31, 12],
         [15, 16, 21, 22], [15, 16, 21, 12], [15, 16, 11, 22], [15, 16, 11, 12] ],
       [ [29, 30, 35, 36], [29, 30, 11, 36], [ 5, 30, 35, 36], [ 5, 30, 11, 36],
         [39, 40, 45, 46], [ 5, 40, 45, 46], [39,  6, 45, 46], [ 5,  6, 45, 46] ],
       [ [25, 30, 31, 36], [15, 16, 45, 46], [13, 14, 19, 20], [13, 14, 19, 12],
         [17, 18, 23, 24], [17, 18, 11, 24], [41, 42, 47, 48], [ 5, 42, 47, 48] ],
       [ [37, 38, 43, 44], [37,  6, 43, 44], [13, 18, 19, 24], [13, 14, 43, 44],
         [37, 42, 43, 48], [17, 18, 47, 48], [13, 18, 43, 48], [ 1,  2,  7,  8] ]
     ]
     OldAutotiles = [
       [ [27, 28, 33, 34], [ 5, 28, 33, 34], [27,  6, 33, 34], [ 5,  6, 33, 34],
         [27, 28, 33, 12], [ 5, 28, 33, 12], [27,  6, 33, 12], [ 5,  6, 33, 12] ],
       [ [27, 28, 11, 34], [ 5, 28, 11, 34], [27,  6, 11, 34], [ 5,  6, 11, 34],
         [27, 28, 11, 12], [ 5, 28, 11, 12], [27,  6, 11, 12], [ 5,  6, 11, 12] ],
       [ [25, 26, 31, 32], [25,  6, 31, 32], [25, 26, 31, 12], [25,  6, 31, 12],
         [15, 16, 21, 22], [15, 16, 21, 12], [15, 16, 11, 22], [15, 16, 11, 12] ],
       [ [29, 30, 35, 36], [29, 30, 11, 36], [ 5, 30, 35, 36], [ 5, 30, 11, 36],
         [39, 40, 45, 46], [ 5, 40, 45, 46], [39,  6, 45, 46], [ 5,  6, 45, 46] ],
       [ [25, 30, 31, 36], [15, 16, 45, 46], [13, 14, 19, 20], [13, 14, 19, 12],
         [17, 18, 23, 24], [17, 18, 11, 24], [41, 42, 47, 48], [ 5, 42, 47, 48] ],
       [ [37, 38, 43, 44], [37,  6, 43, 44], [13, 18, 19, 24], [13, 14, 43, 44],
         [37, 42, 43, 48], [17, 18, 47, 48], [13, 18, 43, 48], [ 1,  2,  7,  8] ]
     ]
     FlashOpacity=[100,90,80,70,80,90]
     attr_reader :tileset
     attr_reader :autotiles
     attr_reader :map_data
     attr_accessor :flash_data
     attr_accessor :priorities
     attr_reader :visible
     attr_accessor :ox
     attr_accessor :oy
     attr_reader :viewport
     attr_accessor :tone
     attr_accessor :color
     def graphicsHeight
       return 480
     end
     def graphicsWidth
       return 640
     end
     def initialize(viewport)
       @tileset    = nil  # Refers to Map Tileset Name
       @autotiles  = TilemapAutotiles.new
       @map_data  = nil  # Refers to 3D Array Of Tile Settings
       @flash_data = nil  # Refers to 3D Array of Tile Flashdata
       @priorities = nil  # Refers to Tileset Priorities
       @visible    = true # Refers to Tileset Visibleness
       @ox        = 0    # Bitmap Offsets
       @oy        = 0    # bitmap Offsets
       @plane      = false
       @tone=Tone.new(0,0,0,0)
       @color=Color.new(0,0,0,0)
       @oldtone=Tone.new(0,0,0,0)
       @oldcolor=Color.new(0,0,0,0)
       @selfviewport=Viewport.new(0,0,graphicsWidth,graphicsHeight)
       @viewport=viewport ? viewport : @selfviewport
       @tiles=[]
       @autotileInfo=[]
       @regularTileInfo=[]
       @oldOx=0
       @oldOy=0
       @layer0=Sprite.new(viewport)
       @layer0.visible=true
       @nowshown=false
       @layer0.bitmap=Bitmap.new([graphicsWidth*2,1].max,[graphicsHeight*2,1].max)
       @flash=nil
       @layer0.ox=0
       @layer0.oy=0
       @oxLayer0=0
       @oyLayer0=0
       @oxFlash=0
       @oyFlash=0
       @layer0.z=0
       @priotiles=[]
       @prioautotiles=[]
       @autosprites=[]
       @framecount=[]
       @tilesetChanged=true
       @flashChanged=false
       @firsttime=true
       @disposed=false
       @usedsprites=false
       @layer0clip=true
       @firsttimeflash=true
       @fullyrefreshed=false
       @fullyrefreshedautos=false
     end
     def disposed?
     return @disposed
     end
     def flash_data=(value)
     @flash_data=value
     @flashChanged=true
     end
     def update
       if @oldtone!=@tone
         @layer0.tone=@tone
         @flash.tone=@tone if @flash
         for sprite in @autosprites
           sprite.tone=@tone
         end
         for sprite in @tiles
           sprite.tone=@tone if sprite.is_a?(Sprite)
         end
         @oldtone=@tone.clone
       end
       if @oldcolor!=@color
         @layer0.color=@color
         @flash.color=@color if @flash
         for sprite in @autosprites
           sprite.color=@color
         end
         for sprite in @tiles
           sprite.color=@color if sprite.is_a?(Sprite)
         end
         @oldcolor=@color.clone
       end
       if @autotiles.changed
         refresh_autotiles
         repaintAutotiles
       end
       if @flashChanged
         refresh_flash
       end
       if @tilesetChanged
         refresh_tileset
       end
       if @flash
       @flash.opacity=FlashOpacity[(Graphics.frame_count/2) % 6]
       end
       if !(@oldOx==@ox && @oldOy==@oy &&
             !@tilesetChanged &&
             !@autotiles.changed)
         refresh
       end
       if (Graphics.frame_count % Animated_Autotiles_Frames == 0) || @nowshown
         repaintAutotiles
         refresh(true)
       end
       @nowshown=false
       @autotiles.changed=false
       @tilesetChanged=false
     end
    def priorities=(value)
     @priorities=value
     @tilesetChanged=true
    end
    def tileset=(value)
     @tileset=value
     @tilesetChanged=true
    end
    def shown?
     return false if !@visible
     ysize=@map_data.ysize
     xsize=@map_data.xsize
     xStart=(@ox/32)-1
     xEnd=((@ox+@viewport.rect.width)/32)+1
     yStart=(@oy/32)-1
     yEnd=((@oy+@viewport.rect.height)/32)+1
     xStart=0 if xStart<0
     xStart=xsize-1 if xStart>=xsize
     xEnd=0 if xEnd<0
     xEnd=xsize-1 if xEnd>=xsize
     yStart=0 if yStart<0
     yStart=ysize-1 if yStart>=ysize
     yEnd=0 if yEnd<0
     yEnd=ysize-1 if yEnd>=ysize
     return (xStart<xEnd && yStart<yEnd)
    end
    def dispose
    return if disposed?
    @help.dispose if @help
    @help=nil
    i=0;len=@autotileInfo.length;while i<len
     if @autotileInfo[i]
       @autotileInfo[i].dispose
       @autotileInfo[i]=nil
     end
     i+=1
    end
    i=0;len=@regularTileInfo.length;while i<len
     if @regularTileInfo[i]
       @regularTileInfo[i].dispose
       @regularTileInfo[i]=nil
     end
     i+=1
    end
    i=0;len=@tiles.length;while i<len
     @tiles[i].dispose
     @tiles[i]=nil
     i+=2
    end
    i=0;len=@autosprites.length;while i<len
     @autosprites[i].dispose
     @autosprites[i]=nil
     i+=2
    end
    if @layer0
     @layer0.bitmap.dispose if !@layer0.disposed?
     @layer0.bitmap=nil if !@layer0.disposed?
     @layer0.dispose
     @layer0=nil
    end
    if @flash
     @flash.bitmap.dispose if !@flash.disposed?
     @flash.bitmap=nil if !@flash.disposed?
     @flash.dispose
     @flash=nil
    end
    for i in 0...7
     self.autotiles[i]=nil
    end
    @tiles.clear
    @autosprites.clear
    @autotileInfo.clear
    @regularTileInfo.clear
    @tilemap=nil
    @tileset=nil
    @priorities=nil
    @selfviewport.dispose
    @selfviewport=nil
    @disposed=true
    end

    def bltAutotile(bitmap,x,y,id,frame)
     return if frame<0
     autotile=@autotiles[id/48-1]
     return if !autotile
     if autotile.height==32
       anim=frame<<5
       src_rect=Rect.new(anim,0,32,32)
       bitmap.blt(x,y,autotile,src_rect)
     else
       anim=frame*96
       id%=48
       if autotile.height==192
         tiles = NewAutotiles[id>>3][id&7]
       else
         tiles = OldAutotiles[id>>3][id&7]
       end
       src=Rect.new(0,0,0,0)
       for i in 0...4
         tile_position = tiles[i] - 1
         src.set(
         (tile_position % 6)*16 + anim,
         (tile_position / 6)*16, 16, 16)
         bitmap.blt(i%2*16+x,i/2*16+y, autotile, src)
       end
     end
    end

    def autotileNumFrames(id)
     autotile=@autotiles[id/48-1]
     return 0 if !autotile || autotile.disposed?
     frames=1
     if autotile.height==32
     frames=autotile.width>>5
     else
     frames=autotile.width/96
     end
     return frames
    end

    def autotileFrame(id)
     autotile=@autotiles[id/48-1]
     return -1 if !autotile || autotile.disposed?
     frames=1
     if autotile.height==32
     frames=autotile.width>>5
     else
     frames=autotile.width/96
     end
     return (Graphics.frame_count/Animated_Autotiles_Frames)%frames
    end

    def repaintAutotiles
    for i in 0...@autotileInfo.length
     next if !@autotileInfo[i]
     frame=autotileFrame(i)
     bltAutotile(@autotileInfo[i],0,0,i,frame)
    end
    end

    def getAutotile(sprite,id)
     anim=autotileFrame(id)
     return if anim<0
     bitmap=@autotileInfo[id]
     if !bitmap
       bitmap=Bitmap.new(32,32)
       bltAutotile(bitmap,0,0,id,anim)
       @autotileInfo[id]=bitmap
     end
     sprite.bitmap=bitmap if !sprite.equal?(bitmap) || sprite.bitmap!=bitmap
    end

    def getRegularTile(sprite,id)
    if false
     sprite.bitmap=@tileset if !sprite.equal?(@tileset) || sprite.bitmap!=@tileset
     sprite.src_rect.set(((id - 384)&7)<<5,((id - 384)>>3)<<5,32,32)
    else
     bitmap=@regularTileInfo[id]
     if !bitmap
     bitmap=Bitmap.new(32,32)
     rect=Rect.new(((id - 384)&7)<<5,((id - 384)>>3)<<5,32,32)
     bitmap.blt(0,0,@tileset,rect)
     @regularTileInfo[id]=bitmap
     end
     sprite.bitmap=bitmap if !sprite.equal?(bitmap) || sprite.bitmap!=bitmap
    end
    end

    def addTile(tiles,count,xpos,ypos,id)
     if id>=384
       if count>=tiles.length
         sprite=Sprite.new(@viewport)
         tiles.push(sprite,0)
       else
         sprite=tiles[count]
         tiles[count+1]=0
       end
       sprite.visible=@visible
       sprite.x=xpos
       sprite.y=ypos
       sprite.tone=@tone
       sprite.color=@color
       getRegularTile(sprite,id)
       spriteZ=(@priorities[id]==0||!@priorities[id]) ? 0 : ypos+@priorities[id]*32+32
       sprite.z=spriteZ
       count+=2
     else
       if count>=tiles.length
         sprite=Sprite.new(@viewport)
         tiles.push(sprite,1)
       else
         sprite=tiles[count]
         tiles[count+1]=1
       end
       sprite.visible=@visible
       sprite.x=xpos
       sprite.y=ypos
       sprite.tone=@tone
       sprite.color=@color
       getAutotile(sprite,id)
       spriteZ=(@priorities[id]==0||!@priorities[id]) ? 0 : ypos+@priorities[id]*32+32
       sprite.z=spriteZ
       count+=2
     end
     return count
    end

    def refresh_tileset
    i=0;len=@regularTileInfo.length;while i<len
     if @regularTileInfo[i]
       @regularTileInfo[i].dispose
       @regularTileInfo[i]=nil
     end
     i+=1
    end
    @regularTileInfo.clear
    @priotiles.clear
    ysize=@map_data.ysize
    xsize=@map_data.xsize
    zsize=@map_data.zsize
    if xsize>100 || ysize>100
     @fullyrefreshed=false
    else
     for z in 0...zsize
     for y in 0...ysize
       for x in 0...xsize
       id = @map_data[x, y, z]
       next if id==0 || !@priorities[id]
       next if @priorities[id]==0
       @priotiles.push([x,y,z,id])
       end
     end
     end
     @fullyrefreshed=true
    end
    end

    def refresh_flash
    if @flash_data && !@flash
     @flash=Sprite.new(viewport)
     @flash.visible=true
     @flash.z=1
     @flash.blend_type=1
     @flash.bitmap=Bitmap.new([graphicsWidth*2,1].max,[graphicsHeight*2,1].max)
     @firsttimeflash=true
    elsif !@flash_data && @flash
     @flash.bitmap.dispose if @flash.bitmap
     @flash.dispose
     @flash=nil
     @firsttimeflash=false
    end
    end

    def refresh_autotiles
    i=0;len=@autotileInfo.length;while i<len
     if @autotileInfo[i]
       @autotileInfo[i].dispose
       @autotileInfo[i]=nil
     end
     i+=1
    end
    i=0;len=@autosprites.length;while i<len
     if @autosprites[i]
       @autosprites[i].dispose
       @autosprites[i]=nil
     end
     i+=2
    end
    @autosprites.clear
    @autotileInfo.clear
    @prioautotiles.clear
    hasanimated=false
    for i in 0...7
     numframes=autotileNumFrames(48*(i+1))
     hasanimated=true if numframes>=2
     @framecount[i]=numframes
    end
    if hasanimated
     ysize=@map_data.ysize
     xsize=@map_data.xsize
     zsize=@map_data.zsize
     if xsize>100 || ysize>100
       @fullyrefreshedautos=false
     else
       for y in 0...ysize
       for x in 0...xsize
         haveautotile=false
         for z in 0...zsize
         id = @map_data[x, y, z]
         next if id==0 || id>=384 || @priorities[id]!=0 || !@priorities[id]
         next if @framecount[id/48-1]<2
         haveautotile=true
         break
         end
         @prioautotiles.push([x,y]) if haveautotile
       end
       end
       @fullyrefreshedautos=true
     end
    else
     @fullyrefreshedautos=true
    end
    end

    def map_data=(value)
    @map_data=value
    @tilesetChanged=true
    end

    def refreshFlashSprite
    return if !@flash || @flash_data.nil?
    ptX=@ox-@oxFlash
    ptY=@oy-@oyFlash
    if !@firsttimeflash && !@usedsprites &&
       ptX>=0 && ptX+@viewport.rect.width<=@flash.bitmap.width &&
       ptY>=0 && ptY+@viewport.rect.height<=@flash.bitmap.height
     @flash.ox=0
     @flash.oy=0
     @flash.src_rect.set(ptX.round,ptY.round,
       @viewport.rect.width,@viewport.rect.height)
     return
    end
    width=@flash.bitmap.width
    height=@flash.bitmap.height
    bitmap=@flash.bitmap
    ysize=@map_data.ysize
    xsize=@map_data.xsize
    zsize=@map_data.zsize
    @firsttimeflash=false
    @oxFlash=@ox-(width>>2)
    @oyFlash=@oy-(height>>2)
    @flash.ox=0
    @flash.oy=0
    @flash.src_rect.set(width>>2,height>>2,
       @viewport.rect.width,@viewport.rect.height)
    @flash.bitmap.clear
    @oxFlash=@oxFlash.floor
    @oyFlash=@oyFlash.floor
    xStart=(@oxFlash>>5)
    xStart=0 if xStart<0
    yStart=(@oyFlash>>5)
    yStart=0 if yStart<0
    xEnd=xStart+(width>>5)+1
    yEnd=yStart+(height>>5)+1
    xEnd=xsize if xEnd>=xsize
    yEnd=ysize if yEnd>=ysize
    if xStart<xEnd && yStart<yEnd
     yrange=yStart...yEnd
     xrange=xStart...xEnd
     tmpcolor=Color.new(0,0,0,0)
     for y in yrange
     ypos=(y<<5)-@oyFlash
     for x in xrange
       xpos=(x<<5)-@oxFlash
       id = @flash_data[x, y, 0]
       r=(id>>8)&15
       g=(id>>4)&15
       b=(id)&15
       tmpcolor.set(r<<4,g<<4,b<<4)
       bitmap.fill_rect(xpos,ypos,32,32,tmpcolor)
     end
     end
    end
    end


    def refreshLayer0(autotiles=false)
    if autotiles
     return true if !shown?
    end
    ptX=@ox-@oxLayer0
    ptY=@oy-@oyLayer0
    if !autotiles && !@firsttime && !@usedsprites &&
       ptX>=0 && ptX+@viewport.rect.width<=@layer0.bitmap.width &&
       ptY>=0 && ptY+@viewport.rect.height<=@layer0.bitmap.height
     if @layer0clip
     @layer0.ox=0
     @layer0.oy=0
     @layer0.src_rect.set(ptX.round,ptY.round,
       @viewport.rect.width,@viewport.rect.height)
     else
     @layer0.ox=ptX.round
     @layer0.oy=ptY.round
     @layer0.src_rect.set(0,0,@layer0.bitmap.width,@layer0.bitmap.height)
     end
     return true
    end
    width=@layer0.bitmap.width
    height=@layer0.bitmap.height
    bitmap=@layer0.bitmap
    ysize=@map_data.ysize
    xsize=@map_data.xsize
    zsize=@map_data.zsize
    if autotiles
     return true if @fullyrefreshedautos && @prioautotiles.length==0
     xStart=(@oxLayer0>>5)
     xStart=0 if xStart<0
     yStart=(@oyLayer0>>5)
     yStart=0 if yStart<0
     xEnd=xStart+(width>>5)+1
     yEnd=yStart+(height>>5)+1
     xEnd=xsize if xEnd>xsize
     yEnd=ysize if yEnd>ysize
     return true if xStart>=xEnd || yStart>=yEnd
     trans=Color.new(0,0,0,0)
     temprect=Rect.new(0,0,0,0)
     tilerect=Rect.new(0,0,32,32)
     range=0...zsize
     overallcount=0
     count=0
     if !@fullyrefreshedautos
     for y in yStart..yEnd
       for x in xStart..xEnd
       haveautotile=false
       for z in range
         id = @map_data[x, y, z]
         next if id<48 || id>=384 || @priorities[id]!=0 || !@priorities[id]
         next if @framecount[id/48-1]<2
         if !haveautotile
           haveautotile=true
           overallcount+=1
           xpos=(x<<5)-@oxLayer0
           ypos=(y<<5)-@oyLayer0
           bitmap.fill_rect(xpos,ypos,0,0,trans) if overallcount<=2000
           break
         end
       end
       for z in range
         id = @map_data[x,y,z]
         next if id<48 || @priorities[id]!=0 || !@priorities[id]
         if overallcount>2000
         xpos=(x<<5)-@oxLayer0
         ypos=(y<<5)-@oyLayer0
         count=addTile(@autosprites,count,xpos,ypos,id)
         next
         elsif id>=384
         temprect.set(((id - 384)&7)<<5,((id - 384)>>3)<<5,32,32)
         xpos=(x<<5)-@oxLayer0
         ypos=(y<<5)-@oyLayer0
         bitmap.blt(xpos,ypos,@tileset,temprect)
         else
         tilebitmap=@autotileInfo[id]
         if !tilebitmap
           anim=autotileFrame(id)
           next if anim<0
           tilebitmap=Bitmap.new(32,32)
           bltAutotile(tilebitmap,0,0,id,anim)
           @autotileInfo[id]=tilebitmap
         end
         xpos=(x<<5)-@oxLayer0
         ypos=(y<<5)-@oyLayer0
         bitmap.blt(xpos,ypos,tilebitmap,tilerect)
         end
       end
       end
     end
     else
     for tile in @prioautotiles
       x=tile[0]
       y=tile[1]
       next if x<xStart||x>xEnd
       next if y<yStart||y>yEnd
       overallcount+=1
       xpos=(x<<5)-@oxLayer0
       ypos=(y<<5)-@oyLayer0
       bitmap.fill_rect(xpos,ypos,0,0,trans) if overallcount<=2000
       for z in range
       id = @map_data[x,y,z]
       next if id<48 || @priorities[id]!=0 || !@priorities[id]
       if overallcount>2000
         count=addTile(@autosprites,count,xpos,ypos,id)
         next
       elsif id>=384
         temprect.set(((id - 384)&7)<<5,((id - 384)>>3)<<5,32,32)
         bitmap.blt(xpos,ypos,@tileset,temprect)
       else
         tilebitmap=@autotileInfo[id]
         if !tilebitmap
           anim=autotileFrame(id)
           next if anim<0
           tilebitmap=Bitmap.new(32,32)
           bltAutotile(tilebitmap,0,0,id,anim)
           @autotileInfo[id]=tilebitmap
         end
         bitmap.blt(xpos,ypos,tilebitmap,tilerect)
       end
       end
     end
     end
     Graphics.frame_reset if overallcount>2000
     @usedsprites=false
     return true
    end
    return false if @usedsprites
    @firsttime=false
    @oxLayer0=@ox-(width>>2)
    @oyLayer0=@oy-(height>>2)
    if @layer0clip
     @layer0.ox=0
     @layer0.oy=0
     @layer0.src_rect.set(width>>2,height>>2,
       @viewport.rect.width,@viewport.rect.height)
    else
     @layer0.ox=(width>>2)
     @layer0.oy=(height>>2)
    end
    @layer0.bitmap.clear
    @oxLayer0=@oxLayer0.floor
    @oyLayer0=@oyLayer0.floor
    xStart=(@oxLayer0>>5)
    xStart=0 if xStart<0
    yStart=(@oyLayer0>>5)
    yStart=0 if yStart<0
    xEnd=xStart+(width>>5)+1
    yEnd=yStart+(height>>5)+1
    xEnd=xsize if xEnd>=xsize
    yEnd=ysize if yEnd>=ysize
    if xStart<xEnd && yStart<yEnd
     tmprect=Rect.new(0,0,0,0)
     yrange=yStart...yEnd
     xrange=xStart...xEnd
     for z in 0...zsize
     for y in yrange
       ypos=(y<<5)-@oyLayer0
       for x in xrange
       xpos=(x<<5)-@oxLayer0
       id = @map_data[x, y, z]
       next if id==0 || @priorities[id]!=0 || !@priorities[id]
       if id>=384
         tmprect.set((id - 384) % 8 * 32, (id - 384) / 8 * 32,32,32)
         bitmap.blt(xpos,ypos,@tileset,tmprect)
       else
         frame=autotileFrame(id)
         bltAutotile(bitmap,xpos,ypos,id,frame)
       end
       end
     end
     end
     Graphics.frame_reset
    end
    return true
    end
    def getResizeFactor
     return $ResizeFactor ? $ResizeFactor : 1.0
    end
    def ox=(val)
     val=(val*getResizeFactor).to_i
     val=(val/getResizeFactor).to_i
     wasshown=self.shown?
     @ox=val.floor
     @nowshown=(!wasshown && self.shown?)
    end
    def oy=(val)
     val=(val*getResizeFactor).to_i
     val=(val/getResizeFactor).to_i
     wasshown=self.shown?
     @oy=val.floor
     @nowshown=(!wasshown && self.shown?)
    end
    def visible=(val)
     wasshown=@visible
     @visible=val
     @nowshown=(!wasshown && val)
    end
    def refresh(autotiles=false)
    @oldOx=@ox
    @oldOy=@oy
    usesprites=false
    if @layer0
     @layer0.visible=@visible
     usesprites=!refreshLayer0(autotiles)
     if autotiles && !usesprites
     return
     end
    else
     usesprites=true
    end
    refreshFlashSprite
    vpx=@viewport.rect.x
    vpy=@viewport.rect.y
    vpr=@viewport.rect.width+vpx
    vpb=@viewport.rect.height+vpy
    xsize=@map_data.xsize
    ysize=@map_data.ysize
    minX=(@ox/32)-1
    maxX=((@ox+@viewport.rect.width)/32)+1
    minY=(@oy/32)-1
    maxY=((@oy+@viewport.rect.height)/32)+1
    minX=0 if minX<0
    minX=xsize-1 if minX>=xsize
    maxX=0 if maxX<0
    maxX=xsize-1 if maxX>=xsize
    minY=0 if minY<0
    minY=ysize-1 if minY>=ysize
    maxY=0 if maxY<0
    maxY=ysize-1 if maxY>=ysize
    count=0
    if minX<maxX && minY<maxY
     @usedsprites=usesprites || @usedsprites
     if @layer0
     @layer0.visible=false if usesprites
     end
     if @fullyrefreshed
     for prio in @priotiles
       x=prio[0]
       y=prio[1]
       next if x<minX||x>maxX
       next if y<minY||y>maxY
       id=prio[3]
       xpos=(x<<5)-@ox
       ypos=(y<<5)-@oy
       count=addTile(@tiles,count,xpos,ypos,id)
     end
     else
     for z in 0...@map_data.zsize
       for y in minY..maxY
       for x in minX..maxX
         id = @map_data[x, y, z]
         next if id==0 || !@priorities[id]
         next if @priorities[id]==0
         xpos=(x<<5)-@ox
         ypos=(y<<5)-@oy
         count=addTile(@tiles,count,xpos,ypos,id)
       end
       end
     end
     end
    end
    if count<@tiles.length
     bigchange=(count<=(@tiles.length*2/3)) && (@tiles.length*2/3)>25
     j=count;len=@tiles.length;while j<len
     sprite=@tiles[j]
     @tiles[j+1]=-1
     if bigchange
       sprite.dispose
       @tiles[j]=nil
       @tiles[j+1]=nil
     elsif !@tiles[j].disposed?
       sprite.visible=false if sprite.visible
     end
     j+=2
     end
     @tiles.compact! if bigchange
    end
    end
    end



    Instructions

    Just insert this script above main.


    Compatibility

    No compatibility issues found.


    Credits and Thanks


    • Pokemon Essentials - for the original code source

    • Wecoc (me) - for the simple add-on




    Author's Notes

    If you have any problem with that script or with incompatibilities don't hestitate to ask.
    108
    RMXP Script Database / Re: [XP] Scene_SketchBook
    January 05, 2013, 01:29:11 am
    I love this! I made an edit that allows you to choice colors, like a "very poor MSPaint" inside RPG maker xD

    DRG - Mouse Gestures:
    #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
    # [Xp/Vx-VxA] DRG - Mouse Gesture
    # Version: 1.50
    # Author : LiTTleDRAgo
    # Edit by: Wecoc
    #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
    module LiTTleDRAgo
     module MouseGestures
       
     VXA = defined?(Window_BattleActor)
    #==============================================================================
    # ** CONFIGURATION
    #==============================================================================
     ALLOWED_SCENE = ['Scene_SketchBook']
             # Insert name scene you want to activate mouse gesture
                     
     # Enter all the condition and result you want here
     def result_mouse_gesture(result)
       if scene.is_a?(Scene_SketchBook)
         save_gesture
         return
       end
     end
       
     # Enter all condition to disable mouse gesture here
     def forbid_mouse_gestures
       return false if !scene.is_a?(Scene_Map)
       if defined?(Window_ActorCommand)            # If VX or VXA
         return true if !$game_player.movable?
         return false
       end                                         # If XP
       return true if $game_system.map_interpreter.running?
       return true if $game_player.move_route_forcing
       return true if $game_temp.message_window_showing
     end
     
     # Enter all condition to ignore scene changing here
     def ignore_changing_scene
       return true if scene.is_a?(Scene_Map) && forbid_mouse_gestures
       return true if $game_system.disable_scene_gesture.include?(scene)
     end
    #==============================================================================
    # ** CONFIG END
    #==============================================================================
     end
    end

    #==============================================================================
    # ** Game_System
    #------------------------------------------------------------------------------
    #  This class handles data surrounding the system. Backround music, etc.
    #  is managed here as well. Refer to "$game_system" for the instance of
    #  this class.
    #==============================================================================

    class Game_System
     #--------------------------------------------------------------------------
     # * Initialize Gesture
     #--------------------------------------------------------------------------
     def init_gesture
       $game_system.disable_scene_gesture = [
               Scene_Battle,
               Scene_Load,
               Scene_Title,
       ]
     end
     #--------------------------------------------------------------------------
     # * Public Instance Variables
     #--------------------------------------------------------------------------
     attr_accessor :disable_scene_gesture
     attr_accessor :saved_gesture, :saved_index
    end

    #==============================================================================
    # ** Game_Temp
    #------------------------------------------------------------------------------
    #  This class handles temporary data that is not included with save data.
    #  Refer to "$game_temp" for the instance of this class.
    #==============================================================================

    class Game_Temp
     attr_accessor :saved_gesture
    end

    module LiTTleDRAgo
     module MouseGestures
           
     def update_mouse_gestures
       return if forbid_mouse_gestures
       clear_mouse_gesture if @mouse_gesture.nil?
       $game_temp.saved_gesture = {} if !$game_temp.saved_gesture
       
       if Mouse.trigger?(Mouse::LBUTTON)
         wecoc_choice_color
       end
         
       if Mouse.dragging?
         point = @mouse_gesture[0][@mouse_gesture[4]]
         if point == nil ||  point.disposed?
           @mouse_gesture[0][@mouse_gesture[4]] = Sprite.new
         end
         @mouse_gesture[0][@mouse_gesture[4]].x = @mouse_gesture[4] == 0 ?
         Mouse.drag_coor[0] : Mouse.x
         @mouse_gesture[0][@mouse_gesture[4]].y = @mouse_gesture[4] == 0 ?
         Mouse.drag_coor[1] : Mouse.y
         recog_mouse_gesture # if @mouse_gesture[6] == Mouse.pos
         @mouse_gesture[6] = Mouse.pos if @mouse_gesture[6] != Mouse.pos
         @mouse_gesture[4] += 1
       else
         if !@mouse_gesture[0].empty?
           @mouse_gesture[1].each_with_index { |s,i|
           @mouse_gesture[1][i-1] = nil if i > 0 && s == @mouse_gesture[1][i-1] }
           result_mouse_gesture(@mouse_gesture[1].compact)
           @mouse_gesture[0].each {|i| i.dispose }
           @mouse_gesture[2].each {|i| i.dispose }
           clear_mouse_gesture
         end
       end
     end
     
     def save_gesture
       return if @mouse_gesture[2][0].nil?
       $game_temp.saved_gesture[index] = @mouse_gesture[2][0].bitmap.clone
     end
     
     def index
       ($game_system.saved_index || 1).abs
     end
     
     def change_scene(some_scene=nil)
       $game_system.init_gesture if !$game_system.disable_scene_gesture
       return if ignore_changing_scene
       VXA ? SceneManager.call(some_scene) : $scene = some_scene.new
     end
     
     def scene() VXA ? SceneManager.scene : $scene end
     def clear_mouse_gesture()  @mouse_gesture = [[],[],[],0,0,0] end
     def draw_mouse_line(start_x,start_y,end_x,end_y,
                   start_color,width=1,end_color=start_color)
       point = @mouse_gesture[2][0]
       if point == nil || point.disposed?
         @mouse_gesture[2][0] = Sprite.new
         @mouse_gesture[2][0].bitmap = Bitmap.new(640,480)
         @mouse_gesture[2][0].z = 9999
       end
       distance = (start_x - end_x).abs + (start_y - end_y).abs
       if end_color == start_color
         (1..distance).each {|i|
           x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
           y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
           @mouse_gesture[2][0].bitmap.fill_rect(x, y, width, width, start_color)
           if scene.is_a?(Scene_SketchBook)
             $game_temp.saved_gesture[index.to_s] = [] if
                      !$game_temp.saved_gesture[index.to_s]
             $game_temp.saved_gesture[index.to_s] << [x,y]
           end}
       else
         (1..distance).each {|i|
           x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
           y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
           r = start_color.red*(distance-i)/distance+end_color.red*i/distance
           g = start_color.green*(distance-i)/distance+end_color.green*i/distance
           b = start_color.blue*(distance-i)/distance+end_color.blue*i/distance
           a = start_color.alpha*(distance-i)/distance+end_color.alpha*i/distance
           @mouse_gesture[2][0].bitmap.fill_rect(x, y, width,
           width, Color.new(r, g, b, a))
           if scene.is_a?(Scene_SketchBook)
             $game_temp.saved_gesture[index.to_s] = [] if
                      !$game_temp.saved_gesture[index.to_s]
             $game_temp.saved_gesture[index.to_s] << [x,y]
           end}
       end
       @mouse_gesture[3] += 1
     end
     
     def wecoc_choice_color
       if Mouse.x > 10 and Mouse.x < 50 and Mouse.y > 390 and Mouse.y < 430
         @ini_color = Color.new(0,0,0)
       end
       if Mouse.x > 10 and Mouse.x < 50 and Mouse.y > 430 and Mouse.y < 470
         @ini_color = Color.new(255,255,255)
       end
       
       if Mouse.x > 60-5 and Mouse.x < 100-5 and Mouse.y > 390 and Mouse.y < 430
         @ini_color = Color.new(255,0,0)
       end
       if Mouse.x > 60-5 and Mouse.x < 100-5 and Mouse.y > 430 and Mouse.y < 470
         @ini_color = Color.new(128,0,0)
       end

       if Mouse.x > 110-10 and Mouse.x < 150-10 and Mouse.y > 390 and Mouse.y < 430
         @ini_color = Color.new(255,255,0)
       end
       if Mouse.x > 110-10 and Mouse.x < 150-10 and Mouse.y > 430 and Mouse.y < 470
         @ini_color = Color.new(128,128,0)
       end

       if Mouse.x > 160-15 and Mouse.x < 200-15 and Mouse.y > 390 and Mouse.y < 430
         @ini_color = Color.new(0,255,0)
       end
       if Mouse.x > 160-15 and Mouse.x < 200-15 and Mouse.y > 430 and Mouse.y < 470
         @ini_color = Color.new(0,128,0)
       end
       
       if Mouse.x > 210-20 and Mouse.x < 250-20 and Mouse.y > 390 and Mouse.y < 430
         @ini_color = Color.new(0,255,255)
       end
       if Mouse.x > 210-20 and Mouse.x < 250-2 and Mouse.y > 430 and Mouse.y < 470
         @ini_color = Color.new(0,128,128)
       end    

       if Mouse.x > 260-25 and Mouse.x < 300-25 and Mouse.y > 390 and Mouse.y < 430
         @ini_color = Color.new(0,0,255)
       end
       if Mouse.x > 260-25 and Mouse.x < 300-25 and Mouse.y > 430 and Mouse.y < 470
         @ini_color = Color.new(0,0,128)
       end    

       if Mouse.x > 310-30 and Mouse.x < 350-30 and Mouse.y > 390 and Mouse.y < 430
         @ini_color = Color.new(255,0,255)
       end
       if Mouse.x > 310-30 and Mouse.x < 350-30 and Mouse.y > 430 and Mouse.y < 470
         @ini_color = Color.new(128,0,128)
       end        
     end
     
     def recog_mouse_gesture
       awal = @mouse_gesture[0][@mouse_gesture[5]]
       akhir = @mouse_gesture[0][@mouse_gesture[4]]
       
       if not @ini_color.instance_of?(Color)
         @ini_color = Color.new(0,0,0)
       end
       
       draw_mouse_line(awal.x,awal.y, akhir.x,akhir.y, @ini_color,3)
       sensitivity = 1#25
       if awal.x - akhir.x > sensitivity && (awal.y - akhir.y).abs < sensitivity
         @mouse_gesture[1] << 'left'
       end
       if awal.x - akhir.x < -sensitivity && (awal.y - akhir.y).abs < sensitivity
         @mouse_gesture[1] << 'right'
       end
       if awal.y - akhir.y > sensitivity && (awal.x - akhir.x).abs < sensitivity
         @mouse_gesture[1] << 'up'
       end
       if awal.y - akhir.y < -sensitivity && (awal.x - akhir.x).abs < sensitivity
         @mouse_gesture[1] << 'down'
       end
       if awal.x - akhir.x > sensitivity && awal.y - akhir.y > sensitivity
         @mouse_gesture[1] << 'upleft'
       end
       if awal.x - akhir.x < -sensitivity && awal.y - akhir.y > sensitivity
         @mouse_gesture[1] << 'upright'
       end
       if awal.x - akhir.x > sensitivity && awal.y - akhir.y < -sensitivity
         @mouse_gesture[1] << 'downleft'
       end
       if awal.x - akhir.x < -sensitivity && awal.y - akhir.y < -sensitivity
         @mouse_gesture[1] << 'downright'
       end
       @mouse_gesture[5] = @mouse_gesture[4]
     end
     end
    end


    #==============================================================================
    # ** Scene_Something
    #------------------------------------------------------------------------------
    #  This class is definition from All Class
    #==============================================================================
    LiTTleDRAgo::MouseGestures::ALLOWED_SCENE.each {|kelas| eval "
    class #{kelas}
     include LiTTleDRAgo::MouseGestures
     alias drg_143_upd update unless method_defined?(:drg_143_upd) ||
                                    !method_defined?(:update)
     def update
       drg_143_upd
       update_mouse_gestures
     end
    end#"}
    #==============================================================================
    # ** Input
    #------------------------------------------------------------------------------
    #  This module performs key input processing
    #==============================================================================
    module Input
     class << self
       if !method_defined?(:glitch_input_keys_update)
         raise "This Script needs Glitchfinder's Key Input Module and "+
            "Glitchfinder's Mouse Input Module"
       end
     end
    end


    $drago_mouse_gestures = true


    Back image: http://s8.postimage.org/8cervzvgl/paint_back.png

    Screen:
    Spoiler: ShowHide