Aldeia RPG

Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Suporte ao desenvolvimento de jogos


5 participantes

    Erro no script linha 268

    Komuro Takashi
    Komuro Takashi
    Colaborador
    Colaborador


    Mensagens : 1047
    Créditos : 130

    Erro no script linha 268 Empty Erro no script linha 268

    Mensagem por Komuro Takashi Sex Jun 22, 2012 1:46 pm

    Pessoal to com um script de Input só que ele ta dando erro na linha 268 falando o seguinte:

    undefined method*"to_a" for 16:Fixnun

    e essas são as linhas 267,268*a do problema e 269:

    Código:

      def Input.press?(vk)
        @press.indexes(*vk.to_a).include?(true)
      end

    Alguem pode me ajudar?


    _________________
    Erro no script linha 268 Takashi_komuro_by_minato8-d51g9o4

    Paga um café? Patreon
    avatar
    vipvipkk1!!
    Banido
    Banido


    Mensagens : 20
    Créditos : 1

    Erro no script linha 268 Empty Re: Erro no script linha 268

    Mensagem por vipvipkk1!! Sex Jun 22, 2012 1:55 pm

    Voce pode tentar pegar outro Intup,
    Komuro Takashi
    Komuro Takashi
    Colaborador
    Colaborador


    Mensagens : 1047
    Créditos : 130

    Erro no script linha 268 Empty Re: Erro no script linha 268

    Mensagem por Komuro Takashi Sex Jun 22, 2012 1:57 pm

    eu preciso deste


    _________________
    Erro no script linha 268 Takashi_komuro_by_minato8-d51g9o4

    Paga um café? Patreon
    avatar
    Roku
    Iniciante
    Iniciante


    Mensagens : 41
    Créditos : 6

    Erro no script linha 268 Empty Re: Erro no script linha 268

    Mensagem por Roku Sex Jun 22, 2012 2:30 pm

    Eu não entendi bem, mas pelo que vi, ocorre um erro ao passar a variável vk pra array. Eu também não entendi o * antes da variável.


    _________________
    MRM
    é igual um gigante cadeirante, quando cai, é muito difícil se levantar,
    e quando se levanta não consegue ir para frente sem cair novamente.
    Komuro Takashi
    Komuro Takashi
    Colaborador
    Colaborador


    Mensagens : 1047
    Créditos : 130

    Erro no script linha 268 Empty Re: Erro no script linha 268

    Mensagem por Komuro Takashi Sex Jun 22, 2012 2:33 pm

    isso mesmo poderia me ajudar a resolver este problema


    _________________
    Erro no script linha 268 Takashi_komuro_by_minato8-d51g9o4

    Paga um café? Patreon
    Paulo Soreto
    Paulo Soreto
    Lenda
    Lenda


    Mensagens : 1980
    Créditos : 367

    Ficha do personagem
    Nível: 1
    Experiência:
    Erro no script linha 268 Left_bar_bleue0/0Erro no script linha 268 Empty_bar_bleue  (0/0)
    Vida:
    Erro no script linha 268 Left_bar_bleue30/30Erro no script linha 268 Empty_bar_bleue  (30/30)

    Erro no script linha 268 Empty Re: Erro no script linha 268

    Mensagem por Paulo Soreto Sex Jun 22, 2012 3:36 pm

    Me explique o que deseja fazer, talvez eu possa ajuda-lo.


    _________________
    Erro no script linha 268 FwYnoXI
    RD12
    RD12
    Lenda
    Lenda


    Medalhas : Erro no script linha 268 48080450Erro no script linha 268 Trophy11Erro no script linha 268 GIueZErro no script linha 268 ZgLkiRU
    Mensagens : 1946
    Créditos : 745

    Erro no script linha 268 Empty Re: Erro no script linha 268

    Mensagem por RD12 Sex Jun 22, 2012 5:21 pm

    Isso por que você está copiando um script do XP, e o Ace usa outra versão do ruby e não tem o to_a, pelo que eu testei.

    Faça o seguinte:

    Código:
     def Input.press?(vk)
        ary = [vk]
        @press.indexes(*ary).include?(true)
      end

    obs: não tenho certeza que dará certo.
    Paulo Soreto
    Paulo Soreto
    Lenda
    Lenda


    Mensagens : 1980
    Créditos : 367

    Ficha do personagem
    Nível: 1
    Experiência:
    Erro no script linha 268 Left_bar_bleue0/0Erro no script linha 268 Empty_bar_bleue  (0/0)
    Vida:
    Erro no script linha 268 Left_bar_bleue30/30Erro no script linha 268 Empty_bar_bleue  (30/30)

    Erro no script linha 268 Empty Re: Erro no script linha 268

    Mensagem por Paulo Soreto Sex Jun 22, 2012 5:58 pm

    Na verdade tem sim o to_a, mas não sei se é correto utiliza-lo ai, então, ao invéz de tentar converter para array, só ponha a mesma lá.

    def Input.press?(vk)
    @press.indexes(*vk).include?(true)
    end


    Aqui um exemplo de uso do to_a (retirado do RGSS3 Help
    a = [1, 2, 3, 4]
    a.combination(1).to_a #=> [[1],[2],[3],[4]]


    _________________
    Erro no script linha 268 FwYnoXI
    RD12
    RD12
    Lenda
    Lenda


    Medalhas : Erro no script linha 268 48080450Erro no script linha 268 Trophy11Erro no script linha 268 GIueZErro no script linha 268 ZgLkiRU
    Mensagens : 1946
    Créditos : 745

    Erro no script linha 268 Empty Re: Erro no script linha 268

    Mensagem por RD12 Sex Jun 22, 2012 6:00 pm

    mas para fixnum? ai no exemplo ta usando to_a para array , eu testei numa var fixnum que nem a dele e deu método idefinido.
    Komuro Takashi
    Komuro Takashi
    Colaborador
    Colaborador


    Mensagens : 1047
    Créditos : 130

    Erro no script linha 268 Empty Re: Erro no script linha 268

    Mensagem por Komuro Takashi Sex Jun 22, 2012 10:18 pm

    Bom das duas formar o erro saiu só que agora gerou outro.

    fala que o metodo indexes não foi definido.

    Script para análise e teste
    Código:

    #=============================================================================
    # *** AWorks Input Module(AIM)
    #=============================================================================
    # Created by AWorks
    # Version: 3.00 BETA
    # Last Modification: 30/11/2008 (day/month/year)
    #=============================================================================
    #==== Special Thanks ====
    # * Poccil(Peter O.)
    #  - For his researchs on modifing ruby objects with C
    # * ERZENGEL
    #  - For his help in editing ruby strings with C
    #=============================================================================
    #==== Description ====
    # This script simulates the RGSS module "Input". It is not the original module,
    # but it has all the original module functions and some new.
    #=============================================================================
    #==== Requeriments ====
    # * AWorks DLL BETA
    #=============================================================================
    #==== Version History ====
    # * Version 1.00
    #  - New methods: Input.reiterate?; Input.activated?; Input.press_all;
    #    Input.trigger_all; Input.repeat_all; Input.reiterate_all
    #  - New Keys: LOWER_LEFT; LOWER_RIGHT; UPPER_LEFT; UPPER_RIGHT
    # * Version 1.10
    #  - New methods: Input.event; Input.free_key; Input.free_all_keys
    # * Version 1.11
    #  - Changed the variables: @repeat_time, @reiterate_time, @reiterate and
    #    @update_keys to constants variables for easy editing.
    # * Version 1.12(Now in Aleworks Input Module Compability Patch 1)
    #  - Compability with the event commands: Asing Key and Condition Branch
    # * Version 1.20
    #  - Little lag reduction
    #  - New methods: Input.release?; Input.release_all
    # * Version 1.21
    #  - Major bug lammer, when using arrays in Input.press?, Input.trigger?,
    #    Input.reiterate? and Input.release?
    #  - Removed UPDATE_KEYS and REITERATE
    # * Version 2.00
    #  - Little lag reduction
    #  - Rewrited some code
    #  - No more need of Win32::Registry, but need Aleworks Library
    #  - Key Combos
    #    - New Class: Input::Key_Combo
    #    - New Methods: Input.add_combo; Input.combo; Input.combos; Input.combos;
    #      Input.delete_combo; Input.delete_ended_combos
    #  - Mouse Input
    #    - New Methods: Input.mouse_double_click?; Input.mouse_x?; Input.mouse_y?;
    #      Input.mouse_dragging?; Input.mouse_drag_rect?; Input.mouse_drag_coor?
    #    - New Constants: MOUSE_INPUT; MOUSE_DOUBLE_CLICK_TIME;
    #      MOUSE_DOUBLE_CLICK_PIX; MOUSE_DRAG_PIX; MOUSE_PRIMARY; MOUSE_SECONDARY
    # * Version 2.01
    #  - Input.mouse_x? and Input.mouse_y? will now return nil if the mouse pointer
    #    is out of the game screen.
    # * Version 2.02
    #  - lammer error in Input.press?
    # * Version 2.03
    #  - lammer error of the Array Input feature
    #  - Updated Input.dir4 and Input.dir8
    #  - New Constants: REAL_DIRS
    # * Version 2.04
    #  - lammer error direction input error.
    # * Version 3.00 BETA
    #  - Complete rewrite of the script, now it uses AWorks.dll for input updating
    #=============================================================================

    #=============================================================================
    # ** Module Input
    #=============================================================================
    module Input
        @keys = []
        @pressed = []
        Mouse_Left = 1
        MOUSE_PRIMARY = 1
        Mouse_Right = 2
        MOUSE_SECONDARY = 2
        Mouse_Middle = 4
        Back= 8
        Tab = 9
        Enter = 13
        Shift = 16
        Ctrl = 17
        Alt = 18
        Esc = 0x1B
        LEFT=0x25
        UP=0x26
        RIGHT=0X27
        DOWN=0x28
        LT = 0x25
        UPs = 0x26 
        RT = 0x27
        DN = 0x28
        Space = 32
        CapsLock = 20
        Esc = 27
        PGUP = 33
        PGDN = 34
        End = 35
        Home = 36
        Left = 37
        Up = 38
        Right = 39
        Down = 40
        PrintScreen = 44
        Insert = 45
        Delete = 46
        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
        Numberpad = {}
        Numberpad[0] = 0
        Numberpad[1] = 0
        Numberpad[2] = 0
        Numberpad[3] = 0
        Numberpad[4] = 0
        Numberpad[5] = 0
        Numberpad[6] = 0
        Numberpad[7] = 0
        Numberpad[8] = 0
        Numberpad[9] = 0
        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
        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 = 191    # => / ?
        Lb = 219
        Rb = 221
        Quote = 222        # => '"
      #===========================================================================
      # ** Module Registry
      #===========================================================================
      module Registry
        module_function
        RegCloseKey = Win32API.new('advapi32', 'RegCloseKey', 'L', 'L')
        RegOpenKeyExA = Win32API.new('advapi32', 'RegOpenKeyExA', 'LPLLP', 'L')
        RegQueryValueExA = Win32API.new('advapi32', 'RegQueryValueExA','LPLPPP','L')
        HKEYS = {'HKEY_CLASSES_ROOT' => 0x80000000,'HKEY_CURRENT_USER' =>0x80000001,
          'HKEY_LOCAL_MACHINE' => 0x80000002, 'HKEY_USERS' => 0x80000003,
          'HKEY_CURRENT_CONFIG' => 0x80000005}
        #-------------------------------------------------------------------------
        # * Read an Entry
        #-------------------------------------------------------------------------
        def read_entry(key, entry)
          key.sub!(/(.*?)\\/, '')
          if HKEYS[$1] != nil
            hkey = HKEYS[$1]
          else
            return nil
          end
          opened, type, size = [0].pack('V'), [0].pack('V'), [0].pack('V')
          RegOpenKeyExA.call(hkey, key, 0, 131097, opened)
          opened = (opened + [0].pack('V')).unpack('V')[0]
          RegQueryValueExA.call(opened, entry, 0, type, 0, size)
          data = ' ' * (size + [0].pack('V')).unpack('V')[0]
          RegQueryValueExA.call(opened, entry, 0, type, data, size)
          RegCloseKey.call(opened)
          data = data[0, (size + [0].pack('V')).unpack('V')[0]]
          type = (type += [0].pack('V')).unpack('V')[0]
          case type
          when 1
            data.chop
          when 2
            data.chop.gsub(/%([^%]+)%/) { ENV[$1] || $& }
          when 3
            data
          when 4
            (data += [0].pack('V')).unpack('V')[0]
          when 5
            data.unpack('N')[0]
          when 7
            data.split(/\0/)
          when 11
            (data.unpack('VV')[1] << 32) | data[0]
          else
            nil
          end
        end
      end
      #---------------------------------------------------------------------------
      # * Variables definition
      #---------------------------------------------------------------------------
      @time = Array.new(256, 0)
      @press = Array.new(256, false)
      @trigger = Array.new(256, false)
      @repeat = Array.new(256, false)
      @release = Array.new(256, false)
      @dirs = [0, 0]
      #---------------------------------------------------------------------------
      # * API declaration
      #---------------------------------------------------------------------------
      InputInitialize = Win32API.new("Input", 'InputInitialize', 'LLLLLL', '')
      InputUpdate = Win32API.new("Input", 'InputUpdate', '', '')
      #---------------------------------------------------------------------------
      # * convert_keys (internal method)
      #---------------------------------------------------------------------------
      REG_KVALUES = {0=>32,1=>13,2=>27,3=>96,4=>16,5=>90,6=>88,7=>67,8=>86,9=>66,
                    10=>65,11=>83,12=>68,13=>81,14=>87}
      def convert_keys(key)
        keys = []
        reg_key = 'HKEY_CURRENT_USER\\Software\\Enterbrain\\RGSS2'
        data = Registry.read_entry(reg_key, 'ButtonAssign')[10, 25].scan(/./)
        15.times {|i| keys.push(REG_KVALUES[i]) if key == data[i].unpack('C')[0]}
        keys
      end 
      module_function :convert_keys
      #---------------------------------------------------------------------------
      # * Keys Constants definitions
      #---------------------------------------------------------------------------
      LOWER_LEFT = 97
      LOWER_RIGHT = 99
      UPPER_LEFT = 103
      UPPER_RIGHT = 105
      DOWN = [98, 40]
      LEFT = [100, 37]
      RIGHT = [ 102, 39]
      UP = [104, 38]
      A = convert_keys(11)
      B = [45] + convert_keys(12)
      C = convert_keys(13)
      X = convert_keys(14)
      Y = convert_keys(15)
      Z = convert_keys(16)
      L = [33] + convert_keys(17)
      R = [34] + convert_keys(18)
      SHIFT = 16
      CTRL = 17
      ALT = 18
      F5 = 116
      F6 = 117
      F7 = 118
      F8 = 119
      F9 = 120
      #---------------------------------------------------------------------------
      # * Initialize Input DLL
      #---------------------------------------------------------------------------
      InputInitialize.call(@time.object_id, @press.object_id, @trigger.object_id,
      @repeat.object_id,  @release.object_id, @dirs.object_id)
      #---------------------------------------------------------------------------
      # * Keys input state update
      #---------------------------------------------------------------------------
      def Input.update
        InputUpdate.call
      end
      #---------------------------------------------------------------------------
      # * Press?
      #---------------------------------------------------------------------------
      def Input.press?(vk)
        @press.indexes(*vk).include?(true)
      end
      #---------------------------------------------------------------------------
      # * Pressed
      #---------------------------------------------------------------------------
      def Input.pressed
        array = Array.new
        @press.each_index {|i| array.push(i) if @press[i]}
        array
      end
      #---------------------------------------------------------------------------
      # * Trigger?
      #---------------------------------------------------------------------------
      def Input.trigger?(vk)
        @trigger.indexes(*vk.to_a).include?(true)
      end
      #---------------------------------------------------------------------------
      # * Triggered
      #---------------------------------------------------------------------------
      def Input.triggered
        array = Array.new
        @trigger.each_index {|i| array.push(i) if @trigger[i]}
        array
      end
     
      def Input.triggerd?(what)
        if triggered.include?(what)
          return true
        end
      end
     
      def Input.pressed?(what)
        if pressed.include?(what)
          return true
        end
      end
     
     
      #---------------------------------------------------------------------------
      # * Repeat?
      #---------------------------------------------------------------------------
      def Input.repeat?(vk)
        @repeat.indexes(*vk.to_a).include?(true)
      end
      #---------------------------------------------------------------------------
      # * Repeated
      #---------------------------------------------------------------------------
      def Input.repeated
        array = Array.new
        @repeat.each_index {|i| array.push(i) if @repeat[i]}
        array
      end
      #---------------------------------------------------------------------------
      # * Release?
      #---------------------------------------------------------------------------
      def Input.release?(vk)
        @release.indexes(*vk.to_a).include?(true)
      end
      #---------------------------------------------------------------------------
      # * Released
      #---------------------------------------------------------------------------
      def Input.released
        array = Array.new
        @release.each_index {|i| array.push(i) if @release[i]}
        array
      end
      #---------------------------------------------------------------------------
      # * 4 Directions
      #---------------------------------------------------------------------------
      def Input.dir4
        @dirs[0]
      end
      #---------------------------------------------------------------------------
      # * 8 Directions
      #---------------------------------------------------------------------------
      def Input.dir8
        @dirs[1]
      end
    end


    _________________
    Erro no script linha 268 Takashi_komuro_by_minato8-d51g9o4

    Paga um café? Patreon

    Conteúdo patrocinado


    Erro no script linha 268 Empty Re: Erro no script linha 268

    Mensagem por Conteúdo patrocinado


      Data/hora atual: Sex Abr 26, 2024 3:31 pm