Input Melhorado - Com CapsLock e NumLock

    Compartilhe
    avatar
    jiraya
    Administrador
    Administrador

    Mensagens : 1299
    Credibilidade : 54

    Input Melhorado - Com CapsLock e NumLock

    Mensagem por jiraya em Seg Abr 16, 2012 7:22 pm

    [Autor:RD12]

    Input Melhorado

    Netplay

    Todos sabem que não da para escrever com o NumLock(Numero do lado direito>), e pra escrever em maiúsculo tinha que segurar Shift.
    Agora está corrigido!

    Agora os números de cima, só servem pro Abs, para as magias, e os do lado, só para digitar, assim você não vai atirar magia e digitar no chat ao mesmo tempo ^^ (odiava isso).

    Script Melhorado:

    Substitua o script [INP] Input pelo script abaixo:

    Código:

    #===============================================================================
    # ** Input Script v2 - This script was first created by Cybersam and she
    #                        deserves most of the credit, all I did was add a few
    #                        functions. (Astro_Mech says)
    #-------------------------------------------------------------------------------
    # Author    Cybersam
    # Modified  Marlos Gama
    # Version  3.0
    # Date      11-04-06
    # Edit      Astro_mech and Mr.Mo
    # Edit²    RD12 - Colocado CapsLock & NumLock
    #===============================================================================
    SDK.log("Input", "Astro_mech and Mr.Mo", "2.0", " 13-04-06")
    #-------------------------------------------------------------------------------
    # Begin SDK Enabled Check
    #-------------------------------------------------------------------------------
    if SDK.state('Input')
    module Input
      #--------------------------------------------------------------------------
      # * Variable Setup
      #--------------------------------------------------------------------------
        @keys = []
        @pressed = []
        Mouse_Left = 1
        Mouse_Right = 2
        Mouse_Middle = 4
        CapsLock = 20
        Back = 8
        Tab = 9
        Enter = 13
        Shift = 16
        Ctrl = 17
        Alt = 18
        Esc = 0x1B
        LT = 0x25
        UPs = 0x26 
        RT = 0x27
        DN = 0x28
        Space = 32
        Numberkeys = {}
        Numberkeys[0] = 48        # => 0
        Numberkeys[1] = 49        # => 1
        Numberkeys[2] = 50        # => 2
        Numberkeys[3] = 51        # => 3
        Numberkeys[4] = 52        # => 4
        Numberkeys[5] = 53        # => 5
        Numberkeys[6] = 54        # => 6
        Numberkeys[7] = 55        # => 7
        Numberkeys[8] = 56        # => 8
        Numberkeys[9] = 57        # => 9
       
        NumberRD12 = {}
        NumberRD12[0] = 0x60        # => 0
        NumberRD12[1] = 0x61        # => 1
        NumberRD12[2] = 0x62        # => 2
        NumberRD12[3] = 0x63        # => 3
        NumberRD12[4] = 0x64        # => 4
        NumberRD12[5] = 0x65        # => 5
        NumberRD12[6] = 0x66        # => 6
        NumberRD12[7] = 0x67        # => 7
        NumberRD12[8] = 0x68        # => 8
        NumberRD12[9] = 0x69        # => 9
       
        Numberpad = {}
        Numberpad[0] = 45
        Numberpad[1] = 35
        Numberpad[2] = 40
        Numberpad[3] = 34
        Numberpad[4] = 37
        Numberpad[5] = 12
        Numberpad[6] = 39
        Numberpad[7] = 36
        Numberpad[8] = 38
        Numberpad[9] = 33
        Letters = {}
        Letters["A"] = 65
        Letters["B"] = 66
        Letters["C"] = 67
        Letters["D"] = 68
        Letters["E"] = 69
        Letters["F"] = 70
        Letters["G"] = 71
        Letters["H"] = 72
        Letters["I"] = 73
        Letters["J"] = 74
        Letters["K"] = 75
        Letters["L"] = 76
        Letters["M"] = 77
        Letters["N"] = 78
        Letters["O"] = 79
        Letters["P"] = 80
        Letters["Q"] = 81
        Letters["R"] = 82
        Letters["S"] = 83
        Letters["T"] = 84
        Letters["U"] = 85
        Letters["V"] = 86
        Letters["W"] = 87
        Letters["X"] = 88
        Letters["Y"] = 89
        Letters["Z"] = 90
       
        Equ={} # Shift Value for num US
        Equ[0]=')'    # FR: à
        Equ[1]='!'    # FR: &
        Equ[2]='@'    # FR: é
        Equ[3]='#'    # FR: "
        Equ[4]='$'    # FR: '
        Equ[5]='%'    # FR: (
        Equ[6]='^'    # FR: -
        Equ[7]='&'    # FR: è
        Equ[8]='*'    # FR: _
        Equ[9]='('    # FR: ç
       
        Carac = {}
        Carac[0] = 0x60          # => 0
        Carac[1] = 0x61          # => 1
        Carac[2] = 0x62          # => 2
        Carac[3] = 0x63          # => 3
        Carac[4] = 0x64          # => 4
        Carac[5] = 0x65          # => 5
        Carac[6] = 0x66          # => 6
        Carac[7] = 0x67          # => 7
        Carac[8] = 0x68          # => 8
        Carac[9] = 0x69          # => 9
        Carac["A"] = 65
        Carac["B"] = 66
        Carac["C"] = 67
        Carac["D"] = 68
        Carac["E"] = 69
        Carac["F"] = 70
        Carac["G"] = 71
        Carac["H"] = 72
        Carac["I"] = 73
        Carac["J"] = 74
        Carac["K"] = 75
        Carac["L"] = 76
        Carac["M"] = 77
        Carac["N"] = 78
        Carac["O"] = 79
        Carac["P"] = 80
        Carac["Q"] = 81
        Carac["R"] = 82
        Carac["S"] = 83
        Carac["T"] = 84
        Carac["U"] = 85
        Carac["V"] = 86
        Carac["W"] = 87
        Carac["X"] = 88
        Carac["Y"] = 89
        Carac["Z"] = 90
       
        Fkeys = {}
        Fkeys[1] = 112
        Fkeys[2] = 113
        Fkeys[3] = 114
        Fkeys[4] = 115
        Fkeys[5] = 116
        Fkeys[6] = 117
        Fkeys[7] = 118
        Fkeys[8] = 119
        Fkeys[9] = 120
        Fkeys[10] = 121
        Fkeys[11] = 122
        Fkeys[12] = 123
        Collon = 186        # => \ |
        Equal = 187        # => = +
        Comma = 188        # => , <
        Underscore = 189    # => - _
        Dot = 190          # => . >
        Backslash = 193    # => / ?
        Lb = 219
        Rb = 221
        Quote = 222        # => '"
        DC = 220            # US: \|  FR: *µ
        State = Win32API.new('user32','GetKeyState',['i'],'i')
        Key = Win32API.new('user32','GetAsyncKeyState',['i'],'i')
    #-------------------------------------------------------------------------------
        USED_KEYS = [Mouse_Left, Mouse_Right, Mouse_Middle]
    #-------------------------------------------------------------------------------
      module_function
        #-------------------------------------------------------------------------- 
        def Input.getstate(key)
          return true unless State.call(key).between?(0, 1)
          return false
        end
        #--------------------------------------------------------------------------
        def Input.testkey(key)
          Key.call(key) & 0x01 == 1
        end
        #--------------------------------------------------------------------------
        def Input.update
          $mouse.update
          @keys = []
          @keys.push(Input::Mouse_Left) if Input.testkey(Input::Mouse_Left)
          @keys.push(Input::Mouse_Right) if Input.testkey(Input::Mouse_Right)
          @keys.push(Input::Back) if Input.testkey(Input::Back)
          @keys.push(Input::Tab) if Input.testkey(Input::Tab)
          @keys.push(Input::Enter) if Input.testkey(Input::Enter)
          @keys.push(Input::CapsLock) if Win32API.new("user32", "GetKeyState", "i", "i").call(20) != 0
          @keys.push(Input::Shift) if Input.testkey(Input::Shift)
          @keys.push(Input::Ctrl) if Input.testkey(Input::Ctrl)
          @keys.push(Input::Alt) if Input.testkey(Input::Alt)
          @keys.push(Input::Esc) if Input.testkey(Input::Esc)
          for key in Input::Letters.values
            @keys.push(key) if Input.testkey(key)
          end
          for key in Input::Numberkeys.values
            @keys.push(key) if Input.testkey(key)
          end
          for key in Input::NumberRD12.values
            @keys.push(key) if Input.testkey(key)
          end
          for key in Input::Numberpad.values
            @keys.push(key) if Input.testkey(key)
          end
          for key in Input::Fkeys.values
            @keys.push(key) if Input.testkey(key)
          end
          @keys.push(Input::Collon) if Input.testkey(Input::Collon)
          @keys.push(Input::Equal) if Input.testkey(Input::Equal)
          @keys.push(Input::Comma) if Input.testkey(Input::Comma)
          @keys.push(Input::Underscore) if Input.testkey(Input::Underscore)
          @keys.push(Input::Dot) if Input.testkey(Input::Dot)
          @keys.push(Input::Backslash) if Input.testkey(Input::Backslash)
          @keys.push(Input::Lb) if Input.testkey(Input::Lb)
          @keys.push(Input::Rb) if Input.testkey(Input::Rb)
          @keys.push(Input::Quote) if Input.testkey(Input::Quote)
          @keys.push(Input::Space) if Input.testkey(Input::Space)
          @keys.push(Input::LT) if Input.testkey(Input::LT)
          @keys.push(Input::UPs) if Input.testkey(Input::UPs)
          @keys.push(Input::RT) if Input.testkey(Input::RT)
          @keys.push(Input::DN) if Input.testkey(Input::DN)
          @pressed = []
          @pressed.push(Input::Space) if Input.getstate(Input::Space)
          @pressed.push(Input::Mouse_Left) if Input.getstate(Input::Mouse_Left)
          @pressed.push(Input::Mouse_Right) if Input.getstate(Input::Mouse_Right)
          @pressed.push(Input::Back) if Input.getstate(Input::Back)
          @pressed.push(Input::Tab) if Input.getstate(Input::Tab)
          @pressed.push(Input::Enter) if Input.getstate(Input::Enter)
          @pressed.push(Input::CapsLock) if Win32API.new("user32", "GetKeyState", "i", "i").call(20) != 0
          @pressed.push(Input::Shift) if Input.getstate(Input::Shift)
          @pressed.push(Input::Ctrl) if Input.getstate(Input::Ctrl)
          @pressed.push(Input::Alt) if Input.getstate(Input::Alt)
          @pressed.push(Input::Esc) if Input.getstate(Input::Esc)
          @pressed.push(Input::LT) if Input.getstate(Input::LT)
          @pressed.push(Input::UPs) if Input.getstate(Input::UPs)
          @pressed.push(Input::RT) if Input.getstate(Input::RT)
          @pressed.push(Input::DN) if Input.getstate(Input::DN)
          for key in Input::Numberkeys.values
            @pressed.push(key) if Input.getstate(key)
          end
          for key in Input::Numberpad.values
            @pressed.push(key) if Input.getstate(key)
          end
          for key in Input::Letters.values
            @pressed.push(key) if Input.getstate(key)
          end
          for key in Input::Fkeys.values
            @pressed.push(key) if Input.getstate(key)
          end
          @pressed.push(Input::Collon) if Input.getstate(Input::Collon)
          @pressed.push(Input::Equal) if Input.getstate(Input::Equal)
          @pressed.push(Input::Comma) if Input.getstate(Input::Comma)
          @pressed.push(Input::Underscore) if Input.getstate(Input::Underscore)
          @pressed.push(Input::Dot) if Input.getstate(Input::Dot)
          @pressed.push(Input::Backslash) if Input.getstate(Input::Backslash)
          @pressed.push(Input::Lb) if Input.getstate(Input::Lb)
          @pressed.push(Input::Rb) if Input.getstate(Input::Rb)
          @pressed.push(Input::Quote) if Input.getstate(Input::Quote) 
        end
        #--------------------------------------------------------------------------
        def Input.triggerd?(key)
          return true if @keys.include?(key)
          return false
        end
        #--------------------------------------------------------------------------
        def Input.pressed?(key)
          return true if @pressed.include?(key)
          return false
        end
      #--------------------------------------------------------------------------
      # * 4 Diraction
      #--------------------------------------------------------------------------
      def Input.dir4
        return 2 if Input.pressed?(Input::DN)
        return 4 if Input.pressed?(Input::LT)
        return 6 if Input.pressed?(Input::RT)
        return 8 if Input.pressed?(Input::UPs)
      end
      #--------------------------------------------------------------------------
      # * Trigger (key)
      #--------------------------------------------------------------------------
      def trigger?(key)
        keys = []
        case key
        when Input::DOWN
          keys.push(Input::DN)
        when Input::UP
          keys.push(Input::UPs)
        when Input::LEFT
          keys.push(Input::LT)
        when Input::RIGHT
          keys.push(Input::RT)
        when Input::C
          keys.push(Input::Space, Input::Enter)
        when Input::B
          keys.push(Input::Esc, Input::Numberpad[0])
        when Input::X
          keys.push(Input::Letters["A"])
        when Input::L
          keys.push(Input::Letters["Q"])
        when Input::R
          keys.push(Input::Letters["W"])
        when Input::Y
          keys.push(Input::Letters["R"])
        when Input::F5
          keys.push(Input::Fkeys[5])
        when Input::F6
          keys.push(Input::Fkeys[6])
        when Input::F7
          keys.push(Input::Fkeys[7])
        when Input::F8
          keys.push(Input::Fkeys[8])
        when Input::F9
          keys.push(Input::Fkeys[9])
        when Input::SHIFT
          keys.push(Input::Shift)
        when Input::CTRL
          keys.push(Input::Ctrl)
        when Input::ALT
          keys.push(Input::Alt)
        else
          keys.push(key)
        end
        for k in keys
        if Input.triggerd?(k)
          return true
        end
      end
      return false
     end
     
      #--------------------------------------------------------------------------
      # * Mouse Triggered ? (key)
      #--------------------------------------------------------------------------
      def trigger(key)
        return @used_i.include?(key)
      end
      #--------------------------------------------------------------------------
      # * Mouse Pressed ? (key)
      #--------------------------------------------------------------------------
      def pressed(key)
        return true unless Win32API.new("user32","GetKeyState",['i'],'i').call(key).between?(0, 1)
        return false
      end
      #--------------------------------------------------------------------------
      # * Repeat (key)
      #--------------------------------------------------------------------------
      def repeat?(key)
        keys = []
        case key
        when Input::DOWN
          keys.push(Input::DN)
        when Input::UP
          keys.push(Input::UPs)
        when Input::LEFT
          keys.push(Input::LT)
        when Input::RIGHT
          keys.push(Input::RT)
        when Input::C
          keys.push(Input::Space, Input::Enter)
        when Input::B
          keys.push(Input::Esc, Input::Numberpad[0])
        when Input::X
          keys.push(Input::Letters["A"])
        when Input::L
          keys.push(Input::Letters["Q"])
        when Input::R
          keys.push(Input::Letters["W"])
        when Input::Y
          keys.push(Input::Letters["R"])
        when Input::F5
          keys.push(Input::Fkeys[5])
        when Input::F6
          keys.push(Input::Fkeys[6])
        when Input::F7
          keys.push(Input::Fkeys[7])
        when Input::F8
          keys.push(Input::Fkeys[8])
        when Input::F9
          keys.push(Input::Fkeys[9])
        when Input::SHIFT
          keys.push(Input::Shift)
        when Input::CTRL
          keys.push(Input::Ctrl)
        when Input::ALT
          keys.push(Input::Alt)
        else
          keys.push(key)
        end
        for k in keys
        if Input.triggerd?(k)
          return true
        end
      end
      return false
      end   
      #--------------------------------------------------------------------------
      # * Check (key)
      #--------------------------------------------------------------------------
      def check(key)
        Win32API.new("user32","GetAsyncKeyState",['i'],'i').call(key) & 0x01 == 1  # key 0
      end
      #--------------------------------------------------------------------------
      # * Mouse Update
      #--------------------------------------------------------------------------
      def mouse_update
        @used_i = []
        for i in USED_KEYS
          x = check(i)
          if x == true
            @used_i.push(i)
          end
        end
      end
      #--------------------------------------------------------------------------
      # * Short Write C
      #--------------------------------------------------------------------------
      def Input.C
        Input.trigger?(C)
      end
      #--------------------------------------------------------------------------
      # * Short Write B
      #--------------------------------------------------------------------------
      def Input.B
        Input.trigger?(B)
      end
      #--------------------------------------------------------------------------
      # * Short Write A
      #--------------------------------------------------------------------------
      def Input.A
        Input.trigger?(A)
      end
      #--------------------------------------------------------------------------
      # * Short Write Down
      #--------------------------------------------------------------------------
      def Input.Down
        Input.trigger?(DOWN)
      end
      #--------------------------------------------------------------------------
      # * Short Write Up
      #--------------------------------------------------------------------------
      def Input.Up
        Input.trigger?(UP)
      end
      #--------------------------------------------------------------------------
      # * Short Write Right
      #--------------------------------------------------------------------------
      def Input.Right
        Input.trigger?(RIGHT)
      end
      #--------------------------------------------------------------------------
      # * Short Write Left
      #--------------------------------------------------------------------------
      def Input.Left
        Input.trigger?(LEFT)
      end
      #--------------------------------------------------------------------------
      # * Anykey pressed?  ( A or B or C or Down or Up or Right or Left )
      #--------------------------------------------------------------------------
      def Input.Anykey
        if A or B or C or Down or Up or Right or Left
          return true
        else
          return false
        end
      end
    end

    module Keys
    MOUSE_PRIMARY = Input::Mouse_Left
    MOUSE_SECONDARY = Input::Mouse_Right

      def Keys.name?(num)
        return "MOUSE PRIMARY" if num==1
        return "MOUSE SECONDARY" if num==2
        return "MOUSE MIDDLE" if num==4
        return "MOUSE 4TH" if num==5
        return "MOUSE 5TH" if num==6
        return "BACKSPACE" if num==8
        return "TAB" if num==9
        return "RETURN" if num==13
        return "SHIFT" if num==16
        return "CTLR" if num==17
        return "ALT" if num==18
        return "CAPS LOCK" if num==20
        return "ESCAPE" if num==27
        return "SPACE" if num==32
        return "PGUP" if num==33
        return "PGDN" if num==34
        return "END" if num==35
        return "HOME" if num==36
        return "LEFT" if num==37
        return "UP" if num==38
        return "RIGHT" if num==39
        return "DOWN" if num==40
        return "SNAPSHOT" if num==44
        return "INSERT" if num==45
        return "DELETE" if num==46
        return "0" if num==48
        return "1" if num==49
        return "2" if num==50
        return "3" if num==51
        return "4" if num==52
        return "5" if num==53
        return "6" if num==54
        return "7" if num==55
        return "8" if num==56
        return "9" if num==57
        return "A" if num==65
        return "B" if num==66
        return "C" if num==67
        return "D" if num==68
        return "E" if num==69
        return "F" if num==70
        return "G" if num==71
        return "H" if num==72
        return "I" if num==73
        return "J" if num==74
        return "K" if num==75
        return "L" if num==76
        return "M" if num==77
        return "N" if num==78
        return "O" if num==79
        return "P" if num==80
        return "Q" if num==81
        return "R" if num==82
        return "S" if num==83
        return "T" if num==84
        return "U" if num==85
        return "V" if num==86
        return "W" if num==87
        return "X" if num==88
        return "Y" if num==89
        return "Z" if num==90
        return "LWIN" if num==91
        return "RWIN" if num==92
        return "APPS" if num==93
        return "0" if num==96
        return "1" if num==97
        return "2" if num==98
        return "3" if num==99
        return "4" if num==100
        return "5" if num==101
        return "6" if num==102
        return "7" if num==103
        return "8" if num==104
        return "9" if num==105
        return "*" if num==106
        return "+" if num==107
        return "-" if num==109
        return "." if num==110
        return "/" if num==111
        return "F1" if num==112
        return "F2" if num==113
        return "F3" if num==114
        return "F4" if num==115
        return "F5" if num==116
        return "F6" if num==117
        return "F7" if num==118
        return "F8" if num==119
        return "F9" if num==120
        return "F10" if num==121
        return "F11" if num==122
        return "F12" if num==123
        return "NUM LOCK" if num==144
        return "SCROLL LOCK" if num==145
        return "LEFT SHIFT" if num==160
        return "RIGHT SHIFT" if num==161
        return "LEFT CTRL" if num==162
        return "RIGHT CTRL" if num==163
        return "LEFT ALT" if num==164
        return "RIGHT ALT" if num==165
        return ";" if num==186
        return "=" if num==187
        return "," if num==188
        return "_" if num==189
        return "." if num==190
        return "/" if num==191
        return "`" if num==192
        return "[" if num==219
        return " \\ " if num==220
        return "]" if num==221
        return "'" if num==222
        return "??? - " + "#{num}"
      end
     
    end
    end
    #-------------------------------------------------------------------------------
    # End SDK Enabled Check
    #-------------------------------------------------------------------------------


    Substitua o [NEW] Text_Box por este:

    Código:

    # ** Text boxes - This class is used to create Text boxes.
    #------------------------------------------------------------------------------
    # Author    Trebor777
    # Modified  Marlos Gama
    # Version  2.0
    #==============================================================================
    class Text_Box < Widget
      attr_accessor( :hide, :active, :extended)
      def initialize(win,x,y,width,max,lines=1)
        super(win,x,y)
        @max = max
        @width = width
        @height = lines*(16+2)
        @lines = lines
        s.bitmap = Bitmap.new(width,lines*(16+2))
        s.bitmap.font.color = Color.new(0, 0, 0, 255)
        s.bitmap.font.size = win.contents.font.size
        @text = ""
        @extended = true
        @wait = 0
        @hide = false
        @blink = false
        self.tool_tip=["Comprimento máximo de #{@max} caráters."]
        refresh
      end
      #--------------------------------------------------------------------------
      def text
        return @text
      end
      #--------------------------------------------------------------------------
      def text=(t)
        @text=t.to_s
        refresh
      end
      #--------------------------------------------------------------------------
      def con(t)
        return "" if t == nil
        return t if !@hide
        return "*"*t.size
      end
      #--------------------------------------------------------------------------
      def refresh
        #s.bitmap.clear
       
        s.bitmap.fill_rect(0+1, 0, @s.bitmap.width-2, s.bitmap.height, User_Edit::BORDA)
        s.bitmap.fill_rect(0, 0+1, @s.bitmap.width, s.bitmap.height-2, User_Edit::COR1)
        s.bitmap.fill_rect(0+1, 0+1, @s.bitmap.width-2, s.bitmap.height-2-10, User_Edit::COR2)
        s.bitmap.fill_rect(0+1, 0+1+5, @s.bitmap.width-2, s.bitmap.height-2-10, User_Edit::COR3)
        s.bitmap.fill_rect(0+1, 0+1+10, @s.bitmap.width-2, s.bitmap.height-2-10, User_Edit::COR4)
       
       
        #s.bitmap.fill_rect(0, 0, @width, @height, Color.new(59,59,59,127))
        #s.bitmap.fill_rect(1, 1, @width-2, @height-2, Color.new(208,214,221,127))
        #s.bitmap.fill_rect(2, 2, @width-4, 9, Color.new(221,226,233,127))
        #s.bitmap.fill_rect(2, 10, @width-4, 7, Color.new(195,203,213,127))
        if s.bitmap.height>win.contents.height-5
            win.oy=text.count("-N-")*win.contents.font.size-1
        end
        if @lines>1 and text.count("-N-")>0
          i=0
          for line in text.split("-N-")
            @tw = s.bitmap.text_size(con(line)).width
            s.bitmap.draw_text(5, i*win.contents.font.size, @width, 18, con(line))
            i+=1
          end
               
        else
          @tw = s.bitmap.text_size(con(text)).width
          s.bitmap.draw_text(5, 0, @width, 18, con(text))
        end
        @tw = 0 if text[-1,1] == "-N-"
        s.bitmap.font.color = Color.new(40,40,40)
        s.bitmap.draw_text(@tw+2+2, text.count("-N-")*win.contents.font.size-1, @width, 18, '|') if self.active and not @blink
        s.bitmap.draw_text(@tw+2+2, text.count("-N-")*win.contents.font.size-1, @width, 18, ' ') if !self.active or (self.active and @blink)
      end
      #--------------------------------------------------------------------------
      def outclick
        refresh
      end
      #--------------------------------------------------------------------------
      def update
        super
        s.visible = win.visible
        if self.active and not @blink
          @wait += 1
          @blink = true if @wait >= 20
          @wait = 0 if @wait >= 20
        elsif not @blink
          @blink = false
          @wait = 0
        end
        if self.active and @blink
          @wait += 1
          @blink = false if @wait >= 20
          @wait = 0 if @wait >= 20
        elsif @blink
          @blink = false
          @wait = 0
        end
        if self.active
          entry = @text
          if Input.triggerd?(Input::Back) and entry.size != 0
            entry.chop!
            @text = entry
            refresh
            return
          end
          if entry.size-entry.count("-N-") == @max
            return
          end
          k=""
        if Input.pressed?(Input::Alt) and Input.pressed?(Input::Back)
          for i in [Você precisa estar registrado e conectado para ver este link.]
          @text.chop!
            end
            end
          Input::Carac.keys.each do |key|
            if Input.triggerd?(Input::Numberkeys[key])
              k = key.to_s.downcase
              if Input.pressed?(Input::Shift)
                k = key.to_s.upcase
                k = Input::Equ[key].to_s# if key.kind_of? Numeric and @extended
              end
              entry+="-N-" if entry.split("-N-").last != nil and @s.bitmap.text_size(entry.split("-N-").last+k).width>=@s.bitmap.width-5
              entry+=k
            end
            if Input.triggerd?(Input::Carac[key])
              k = key.to_s.downcase
              if Input.pressed?(Input::CapsLock)
                k = key.to_s.upcase
              end
              if Input.pressed?(Input::Shift)
                k = key.to_s.upcase
              end

              entry+="-N-" if entry.split("-N-").last != nil and @s.bitmap.text_size(entry.split("-N-").last+k).width>=@s.bitmap.width-5
              entry+=k
            end
          end
          if @extended
            k=""
            if Input.triggerd?(Input::Comma)
              k=","
              k="<" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Space)
              k=" "
            elsif Input.triggerd?(Input::Dot)
              k="."
              k=">" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Collon)
              k=";"
              k=":" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Equal)
              k="="
              k="+" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Backslash)
              k="/"
              k="?" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Quote)
              k="'"
              k="''" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Underscore)
              k="-"
              k="_" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Lb)
              k="]"
              k="}" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Rb)
              k="["
              k= "{" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::DC)
              k="\\"
              k="|" if Input.pressed?(Input::Shift)
            end
            if k!=""
              entry+="-N-" if entry.split("-N-").last != nil and @s.bitmap.text_size(entry.split("-N-").last+k).width>=@s.bitmap.width-5
              entry+=k
            end
          end
          entry+="-N-" if Input.triggerd?(13) and @lines>1 and entry.count("-N-")<@lines-1
          if entry != @text
            @text = entry
          end
          s.bitmap.font.size = win.contents.font.size
          #s.bitmap.font.color = Window_Edits::Text_Box_FontColor
          s.bitmap.font.color = win.text_color(2) if text.size-text.count("-N-") == @max
          refresh
        end
      end
      #--------------------------------------------------------------------------
      def dispose
        super
        @text = nil
      end
    end

    #==============================================================================
    # ** Pass boxes
    #==============================================================================
    class Pass_Box < Widget
      attr_accessor( :hide, :active, :extended)
      def initialize(win,x,y,width,max,lines=1)
        super(win,x,y)
        @max = max
        @width = width
        @height = lines*(16+2)
        @lines = lines
        s.bitmap = Bitmap.new(width,lines*(16+2))
        s.bitmap.font.color = Window_Edits::Text_Box_FontColor
        s.bitmap.font.size = win.contents.font.size
        @text = ""
        @extended = true
        @wait = 0
        @hide = false
        @blink = false
        self.tool_tip=["Comprimento máximo de #{@max} caráters."]
        refresh
      end
      #--------------------------------------------------------------------------
      def text
        return @text
      end
      #--------------------------------------------------------------------------
      def text=(t)
        @text=t.to_s
        refresh
      end
      #--------------------------------------------------------------------------
      def con(text)
        return "" if text == nil
        return text if !@hide
        return "*"*t.size
      end
     
      def refresh
        #s.bitmap.clear
       
        s.bitmap.fill_rect(0+1, 0, @s.bitmap.width-2, s.bitmap.height, User_Edit::BORDA)
        s.bitmap.fill_rect(0, 0+1, @s.bitmap.width, s.bitmap.height-2, User_Edit::COR1)
        s.bitmap.fill_rect(0+1, 0+1, @s.bitmap.width-2, s.bitmap.height-2-10, User_Edit::COR2)
        s.bitmap.fill_rect(0+1, 0+1+5, @s.bitmap.width-2, s.bitmap.height-2-10, User_Edit::COR3)
        s.bitmap.fill_rect(0+1, 0+1+10, @s.bitmap.width-2, s.bitmap.height-2-10, User_Edit::COR4)
       
        #s.bitmap.fill_rect(0, 0, @width, @height, Color.new(59,59,59,127))
        #s.bitmap.fill_rect(1, 1, @width-2, @height-2, Color.new(208,214,221,127))
        #s.bitmap.fill_rect(2, 2, @width-4, 9, Color.new(221,226,233,127))
        #s.bitmap.fill_rect(2, 10, @width-4, 7, Color.new(195,203,213,127))
        if s.bitmap.height>win.contents.height-5
            win.oy=text.count("-N-")*win.contents.font.size-1
        end
        if @lines>1 and text.count("-N-")>0
          i=0
          for line in text.split("-N-")
            @tw = s.bitmap.text_size(con(line)).width
            s.bitmap.draw_text(5, i*win.contents.font.size, @width, 18, con(line))
            i+=1
          end
               
        else
          @tw = s.bitmap.text_size(con(text)).width
          s.bitmap.draw_text(5, 0, @width, 18, con(text))
        end
        @tw = 0 if text[-1,1] == "-N-"
        s.bitmap.font.color = Color.new(40,40,40)
        #s.bitmap.draw_text(@tw+2, text.count("-N-")*win.contents.font.size-1, @width, 18, con(@text)) if not self.active
        s.bitmap.draw_text(@tw+2+2, text.count("-N-")*win.contents.font.size-1, @width, 18, '|') if self.active and not @blink
        s.bitmap.draw_text(@tw+2+2, text.count("-N-")*win.contents.font.size-1, @width, 18, ' ') if !self.active or (self.active and @blink)
      end
      #--------------------------------------------------------------------------
      def outclick
      end
        #--------------------------------------------------------------------------
        def con(text)
        return if text == nil
        t = text
        text = []
        for i in 0..t.size-1
          text.push("*")
        end
        return text.to_s
      end
      #--------------------------------------------------------------------------
      def update
        super
        s.visible = win.visible
        if self.active and not @blink
          @wait += 1
          @blink = true if @wait >= 20
          @wait = 0 if @wait >= 20
        elsif not @blink
          @blink = false
          @wait = 0
        end
        if self.active and @blink
          @wait += 1
          @blink = false if @wait >= 20
          @wait = 0 if @wait >= 20
        elsif @blink
          @blink = false
          @wait = 0
        end
        if self.active
          entry = @text
          if Input.triggerd?(Input::Back) and entry.size != 0
            entry.chop!
            @text = entry
            return
          end
          if entry.size-entry.count("-N-") == @max
            return
          end
          k=""
          Input::Carac.keys.each do |key|
            if Input.triggerd?(Input::Carac[key])
              k = key.to_s.downcase
              if Input.pressed?(Input::Shift)
                k = key.to_s.upcase
                k = Input::Equ[key].to_s if key.kind_of? Numeric and @extended
              end
              entry+="-N-" if entry.split("-N-").last != nil and @s.bitmap.text_size(entry.split("-N-").last+k).width>=@s.bitmap.width-5
              entry+=k
            end
          end
          if @extended
            k=""
            if Input.triggerd?(Input::Comma)
              k=","
              k="<" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Space)
              k=" "
            elsif Input.triggerd?(Input::Dot)
              k="."
              k=">" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Collon)
              k=";"
              k=":" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Equal)
              k="="
              k="+" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Backslash)
              k="/"
              k="?" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Quote)
              k="'"
              k="''" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Underscore)
              k="-"
              k="_" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Lb)
              k="["
              k="{" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Rb)
              k="]"
              k= "}" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::DC)
              k="\\"
              k="|" if Input.pressed?(Input::Shift)
            end
            if k!=""
              entry+="-N-" if entry.split("-N-").last != nil and @s.bitmap.text_size(entry.split("-N-").last+k).width>=@s.bitmap.width-5
              entry+=k
            end
          end
          entry+="-N-" if Input.triggerd?(13) and @lines>1 and entry.count("-N-")<@lines-1
          if entry != @text
            @text = entry
          end
          s.bitmap.font.size = win.contents.font.size
          #s.bitmap.font.color = Window_Edits::Text_Box_FontColor
          s.bitmap.font.color = win.text_color(2) if text.size-text.count("-N-") == @max
          refresh
        end
      end
      #--------------------------------------------------------------------------
      def dispose
        super
        @text = nil
      end
    end


    #==============================================================================
    # ** Text boxes - This class is used to create Text boxes.
    #------------------------------------------------------------------------------
    # Author    Trebor777
    # Modified  Marlos Gama
    # Version  2.0
    #==============================================================================
    class Guild_Box < Widget
      attr_accessor( :hide, :active, :extended)
      def initialize(win,x,y,width,max,lines=1)
        super(win,x,y)
        @max = max
        @width = width
        @height = lines*(16+2)
        @lines = lines
        s.bitmap = Bitmap.new(width,lines*(16+2))
        s.bitmap.font.color = Color.new(0, 0, 0, 255)
        s.bitmap.font.size = win.contents.font.size
        @text = ""
        @extended = true
        @wait = 0
        @hide = false
        @blink = false
        self.tool_tip=["Comprimento máximo de #{@max} caráters."]
        refresh
      end
      #--------------------------------------------------------------------------
      def text
        return @text
      end
      #--------------------------------------------------------------------------
      def text=(t)
        @text=t.to_s
        refresh
      end
      #--------------------------------------------------------------------------
      def con(t)
        return "" if t == nil
        return t if !@hide
        return "*"*t.size
      end
      #--------------------------------------------------------------------------
      def refresh
        #s.bitmap.clear
       
        s.bitmap.fill_rect(0+1, 0, @s.bitmap.width-2, s.bitmap.height, User_Edit::BORDA)
        s.bitmap.fill_rect(0, 0+1, @s.bitmap.width, s.bitmap.height-2, User_Edit::COR1)
        s.bitmap.fill_rect(0+1, 0+1, @s.bitmap.width-2, s.bitmap.height-2-10, User_Edit::COR2)
        s.bitmap.fill_rect(0+1, 0+1+5, @s.bitmap.width-2, s.bitmap.height-2-10, User_Edit::COR3)
        s.bitmap.fill_rect(0+1, 0+1+10, @s.bitmap.width-2, s.bitmap.height-2-10, User_Edit::COR4)
       
        #s.bitmap.fill_rect(0, 0, @width, @height, Color.new(59,59,59,127))
        #s.bitmap.fill_rect(1, 1, @width-2, @height-2, Color.new(208,214,221,127))
        #s.bitmap.fill_rect(2, 2, @width-4, 9, Color.new(221,226,233,127))
        #s.bitmap.fill_rect(2, 10, @width-4, 7, Color.new(195,203,213,127))
        if s.bitmap.height>win.contents.height-5
            win.oy=text.count("-N-")*win.contents.font.size-1
        end
        if @lines>1 and text.count("-N-")>0
          i=0
          for line in text.split("-N-")
            @tw = s.bitmap.text_size(con(line)).width
            s.bitmap.draw_text(5, i*win.contents.font.size, @width, 18, con(line))
            i+=1
          end
               
        else
          @tw = s.bitmap.text_size(con(text)).width
          s.bitmap.draw_text(5, 0, @width, 18, con(text))
        end
        @tw = 0 if text[-1,1] == "-N-"
        s.bitmap.font.color = Color.new(40,40,40)
        s.bitmap.draw_text(@tw+2, text.count("-N-")*win.contents.font.size-1, @width, 18, '|') if self.active and not @blink
        s.bitmap.draw_text(@tw+2, text.count("-N-")*win.contents.font.size-1, @width, 18, ' ') if !self.active or (self.active and @blink)
      end
      #--------------------------------------------------------------------------
      def outclick
        refresh
      end
      #--------------------------------------------------------------------------
      def update
        super
        s.visible = win.visible
        if self.active and not @blink
          @wait += 1
          @blink = true if @wait >= 20
          @wait = 0 if @wait >= 20
        elsif not @blink
          @blink = false
          @wait = 0
        end
        if self.active and @blink
          @wait += 1
          @blink = false if @wait >= 20
          @wait = 0 if @wait >= 20
        elsif @blink
          @blink = false
          @wait = 0
        end
        if self.active
          entry = @text
          if Input.triggerd?(Input::Back) and entry.size != 0
            entry.chop!
            @text = entry
            refresh
            return
          end
          if entry.size-entry.count("-N-") == @max
            return
          end
          k=""
          Input::Carac.keys.each do |key|
            if Input.triggerd?(Input::Carac[key])
              k = key.to_s.downcase
              if Input.pressed?(Input::Shift)
                k = key.to_s.upcase
                k = Input::Equ[key].to_s if key.kind_of? Numeric and @extended
              end
              entry+="-N-" if entry.split("-N-").last != nil and @s.bitmap.text_size(entry.split("-N-").last+k).width>=@s.bitmap.width-5
              entry+=k
            end
          end
          if @extended
            k=""
            if Input.triggerd?(Input::Comma)
              k=","
              k="<" if Input.pressed?(Input::Shift)
            #elsif Input.triggerd?(Input::Space)
              #k=" "
            elsif Input.triggerd?(Input::Dot)
              k="."
              k=">" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Collon)
              k=";"
              k=":" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Equal)
              k="="
              k="+" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Backslash)
              k="/"
              k="?" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Quote)
              k="'"
              k="''" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Underscore)
              k="-"
              k="_" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Lb)
              k="["
              k="{" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::Rb)
              k="]"
              k= "}" if Input.pressed?(Input::Shift)
            elsif Input.triggerd?(Input::DC)
              k="\\"
              k="|" if Input.pressed?(Input::Shift)
            end
            if k!=""
              entry+="-N-" if entry.split("-N-").last != nil and @s.bitmap.text_size(entry.split("-N-").last+k).width>=@s.bitmap.width-5
              entry+=k
            end
          end
          entry+="-N-" if Input.triggerd?(13) and @lines>1 and entry.count("-N-")<@lines-1
          if entry != @text
            @text = entry
          end
          s.bitmap.font.size = win.contents.font.size
          s.bitmap.font.color = Window_Edits::Text_Box_FontColor
          s.bitmap.font.color = win.text_color(2) if text.size-text.count("-N-") == @max
          refresh
        end
      end
      #--------------------------------------------------------------------------
      def dispose
        super
        @text = nil
      end
    end

    Créditos: RD12
    Se encontrarem um erro postem por favor.

      Data/hora atual: Sab Ago 18, 2018 6:44 pm