Jump to content
Rpg²S Forum

Sylaer

Utenti
  • Posts

    287
  • Joined

  • Last visited

Posts posted by Sylaer

  1. Beh le variabili le puoi sempre utilizzare, no?

    Quando, per esempio attivi la quest del brigante, metti una variabile particolare a 1 oppure usi le switch, purtroppo tra i comandi con le pagine degli eventi non c'è la possibilità di fare un call script e richiamare una condizione basato sul risultato, sennò s'era già bell'e fatto.

  2. Perché usare le variabili globali utilizza come ho fatto io un game in più, ti spiego:

    crei una nuova classe e la chiami RPG::Quest, così fa molto professionale, e ci metti dentro tutto quello che può riguardare una quest, tipo nome, id (per eventuali più missioni con lo stesso nome), nome dell'icona(da visualizzare nella finestra, se ce la metti), o un'immagine,una descrizione , insomma fai te.

    Poi crei un'altra classe che chiami Game_Quest e gli fai gestire le missioni, cioè ci metti dentro un'array di RPG::Quest, e poi ci aggiungi metodi per aggiungere o togliere missioni cambiare lo stato e altro, così che ti basti un call script per aggiungere missioni all'array tipo:

    $game_quest.add_quest(nome, id, icona, descrizione)

    Infine aggiungi alla lista dei game che devono essere inizializzati in Scene_Title, salvati in Scene_Save e caricati in Scene_Load.

    In seguito crei una finestra con una Scene_Quest, che ti mostri il contenuto dell'array in game_quest.

  3. Chiaro. Se invece di usare le switches, ti creo una funzione che si possa richiamare col call script a cui passi un parametro particolare che poi è l'id del mostro e quella attiva il mostro scelto, che ne pensi?

    Esempio:

    $bestiary.unlock(id)

    dove id è il numero del mostro scelto, in questa maniera non utilizzi le switches che rompono abbastanza quando c'hai da lavorare con l'RGSS.

    Ah, gli zeri prima dell'id ce li devo lasciare o posso toglierli?

    I mostri presenti nella finestra sono gli stessi del database o li vuoi inseriti tutti in maniera diversa?

  4. Se ti interessa io ho fatto un sistema per le missioni clicca qui.

    Mission System + Dialog Recorder

    E ancora in fase sperimentale peò è possibile anche oltre che cominciare, completare e fallire le missioni date, tutto tramite commento anche registrare i dialoghi dei pg e dei png.

    Per quanto riguarda il discorso della Window_Command, si, si può passare un vettore di stringhe guarda in Scene_Menu, quello è l'esempio migliore.

  5. Sinceramente non ho capito quello che mi chiedi:

    -esiste già questo script o lo devo fare io?

    -cos'è che di preciso deve essere attivato dalle switches, il fatto che all'inizio ti dà la casella vuota e dopo con una switch attiva invece ti mostra il nome e i dati del personaggio?

    Non ho capito se lo vuoi accessibile da call script o da menu o da entrambe.

  6. Posta gli script che hai usato, così vedo dov'è il problema.

    Comunque non è hai fatto un salvataggio prima di aggiungere gli script e poi lo hai caricato dopo? Spesso questo tipo di problema è dovuto soprattutto a questo errore.

  7. Mi servirebbe poter riavvolgere la mappa in orizzontale e in verticale in mappe enormi (per ora ho una mappa di 150 di larghezza e 120 di altezza ma penso che sarà molto più grande, si tratta di una mappa del mondo e mancano ancora alcuni continenti), ho provato la Mode07 ma con mappe di questa grandezza inizia ad andare a scatti o a crashare ... ho provato anche la Wrap Map ma quella che c'è sul forum non funziona bene anche in mappe piccole (poi non so se ce n'è una funzionante XD) ... mi andrebbe bene sia un nuovo script o una modifica a mode07 o alla wrap map.

    Cmq non so se è un lavoro semplice o meno, per ora ho solo 3 Rens, se accetti il lavoro quanti me ne servirebbero? :sisi:

    Beh penso che prenderò la parte del mode07 e la sistemerò un po' quindi si tratta di una modifica sostanziale di uno script quindi sarebbero cinque rens(almeno), ma te la faccio anche a 3 se vuoi.

  8. if Keyboard.trigger?(Keyboard::Letters['M'])
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_Menu.new
    end unless $game_system.map_interpreter.running?

    Se ti riferisci a questo ho solo aggiunto due cose in più:

    1) "$game_system.se_play($data_system.decision_se)" significa che ti fa il suono di decisione se premi quel tasto.

    2) "unless $game_system.map_interpreter.running?" questo serve perché tu non possa richiamare la classe mentre un evento sta avendo luogo.

  9. Concordo con Marigno se fosse Open Source si risolverebbero molti problemi.

    E' anche vero che essendo un programma a pagamento non sarebbe proponibile metterlo Open Source, almeno però potrebbero mettere molte più cose personalizzabili, anche il database, per esempio senza ricorrere agli script per risolvere il problema. Dovrebbero inoltre pensare che la maggior parte della gente non è interessata a fare il classico rpg idiota, quindi mettere più libertà riguardo altri stili di gioco.

  10. Keyboard Input Module

     

     

    Descrizione

    Si tratta di un controllo tasti, più semplice e più utile di quello che è già stato postato qui, si può addirittura aggiungere una finestra da cui si può inserire i tasti.

    Autore

    Near Fantastica

    con collaborazione di Wachunaga e SephirothSpawn

    quindi è molto serio

    Allegati

    Nessuno

    Istruzioni per l'uso

    Premessa nonstante sia fatto da quelli qui sopra non ci vuole l'SDK.

    Comunque tutto quello che dovete fare è scrivere una condizione come questa:

    if Keyboard.trigger?(Keyboard::Costante)
    ...
    end

    al posto di Costante ci mettete una di quelle costanti scritte in cima allo script e ricordate di inserire Letters[C] se invece volete inserire una lettera. Questo è un esempio.

    if Keyboard.trigger?(Keyboard::Letters['G'])
    $scene = Scene_Menu.new
    end

    Questo codice, messo nel punto giusto, permette di richiamare il menu anche col tasto G.

    Ah, una cosa mi raccomando mettete sempre il nome del tasto tra apici, come nell'esempio.

     

     

    #============================================================================== 
    # ** Modules.Keyboard Input (6.1)							By Near Fantastica
    #									   Additions By Wachunaga & SephirothSpawn
    #------------------------------------------------------------------------------
    # * Description :
    #
    #   The Keyboard Input Module is designed to function as the default Input 
    #   module does. It is better then other methods keyboard input because as a 
    #   key is tested it is not removed form the list. so you can test the same 
    #   key multiple times the same loop. This script automatically updates itself
    #   with the input module.
    #------------------------------------------------------------------------------
    # * Syntax :
    #
    #   Test if Key is Triggered :
    #	- if Keyboard.trigger?(Keyboard::<Keyboard_constant>)
    #
    #   Test if Key is Pressed :
    #	- if Keyboard.pressed?(Keyboard::<Keyboard_constant>)
    #==============================================================================
    
    #MACL::Loaded << 'Modules.Keyboard Module'
      
    #==============================================================================
    # ** Keyboard
    #==============================================================================
    
    module Keyboard
      #--------------------------------------------------------------------------
      # * Constants (These Are Your Keyboard Keys)
      #--------------------------------------------------------------------------
      Mouse_Left	  = 1; Mouse_Right	 = 2
      Back			= 8; Tab			 = 9
      Enter		   = 13; Shift		   = 16
      Ctrl			= 17; Alt			 = 18
      Capslock		= 20; Esc			 = 27
      Space		   = 32; End			 = 35
      Home			= 36; Left			= 37
      Right		   = 39
      Del			 = 46; Collon		  = 186
      Equal		   = 187; Comma		   = 188
      Underscore	  = 189; Dot			 = 190
      Backslash	   = 191; Tilde		   = 192
      Lb			  = 219; Rb			  = 221
      Forwardslash	= 220; Quote		   = 222
      Numberkeys	  = {}; Numberkeys[0]   = 48
      Numberkeys[1]   = 49; Numberkeys[2]   = 50
      Numberkeys[3]   = 51; Numberkeys[4]   = 52
      Numberkeys[5]   = 53; Numberkeys[6]   = 54
      Numberkeys[7]   = 55; Numberkeys[8]   = 56
      Numberkeys[9]   = 57
      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
      Numpad = {}	; Numpad[0] = 96
      Numpad[1] = 97	; Numpad[2] = 98
      Numpad[3] = 99	; Numpad[4] = 100
      Numpad[5] = 101; Numpad[6] = 102
      Numpad[7] = 103; Numpad[8] = 104
      Numpad[9] = 105
      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
      #--------------------------------------------------------------------------
      # * Text Representation
      #--------------------------------------------------------------------------
      TR = {}
      TR[Tab]		   = ['	 ', '	 ']
      TR[Enter]		 = ['/n', '/n']
      TR[Collon]		= [';', ':']
      TR[Equal]		 = ['=', '+']
      TR[Comma]		 = [',', '<']
      TR[Underscore]	= ['-', '_']
      TR[Dot]		   = ['.', '>']
      TR[Backslash]	 = ['/', '?']
      TR[Tilde]		 = ['`', '~']
      TR[Forwardslash]  = ["\\", "|"]
      TR[Quote]		 = ["'", '"']
      TR[Numberkeys[0]] = ['0', ')']
      TR[Numberkeys[1]] = ['1', '!']
      TR[Numberkeys[2]] = ['2', '@']
      TR[Numberkeys[3]] = ['3', '#']
      TR[Numberkeys[4]] = ['4', '$' ]
      TR[Numberkeys[5]] = ['5', '^%']
      TR[Numberkeys[6]] = ['6', '^']
      TR[Numberkeys[7]] = ['7', '&']
      TR[Numberkeys[8]] = ['8', '*']
      TR[Numberkeys[9]] = ['9', '(']
      Letters.values.each do |key|
     TR[key] = [key.chr.downcase, key.chr.upcase]
      end
      #--------------------------------------------------------------------------
      # * API Declaration
      #--------------------------------------------------------------------------
      State   = Win32API.new('user32','GetKeyState',	  ['i'],'i')
      Key	 = Win32API.new('user32','GetAsyncKeyState', ['i'],'i')
      #--------------------------------------------------------------------------
      # * Clear Key & Pressed
      #--------------------------------------------------------------------------
      @keys = []; @pressed = []; @lock = []
      @disabled_keys = []; @disabled_timer = {}
      @delay = {}; @disabled_tr = []; @text_window = nil; @text_max = 10
      #--------------------------------------------------------------------------
      # * Get Key State (Test Pressed)
      #--------------------------------------------------------------------------
      def self.getstate(key)
     return !State.call(key).between?(0, 1)
      end
      #--------------------------------------------------------------------------
      # * Test Key (Test Trigger)
      #--------------------------------------------------------------------------
      def self.testkey(key)
     return Key.call(key) & 0x01 == 1
      end
      #--------------------------------------------------------------------------
      # * Test Lock (Test Trigger)
      #--------------------------------------------------------------------------
      def self.testlock(key)
     return State.call(key) & 0x01 == 1
      end
      #--------------------------------------------------------------------------
      # * Trigger? Test
      #--------------------------------------------------------------------------
      def self.trigger?(key)
     return @keys.include?(key)
      end
      #--------------------------------------------------------------------------
      # * Pressed? Test
      #--------------------------------------------------------------------------
      def self.pressed?(key)
     return @pressed.include?(key)
      end
      #--------------------------------------------------------------------------
      def self.lock?(key)
     return @lock.include?(key)
      end
      #--------------------------------------------------------------------------
      # * Update
      #--------------------------------------------------------------------------
      def self.update
     # Clears Keys & Pressed
     @keys, @pressed, @lock = [], [], []
     # Pass Through Timer List
     @disabled_timer.each do |key, timer|
       # Next if nil timer or key not-disabled
       next if timer.nil? || !@disabled_keys.include?(key)
       # If Greater than 0 Timer
       if timer > 0
    	 timer -= 1
    	 next
       end
       # Enable Key
       @disabled_keys.delete(key) if @disabled_keys.include?(key)
       # Set Timer to Nil
       @disabled_timer[key] = nil
     end
     # Test All Keys
     for key in [Mouse_Left, Mouse_Right, Back, Tab, Enter, Shift, Ctrl, Alt,
    			 Capslock, Esc, Space, End, Home, Left, Right, Del, Collon, 
    			 Equal, Comma, Underscore, Dot, Backslash, Tilde, Lb, Rb, 
    			 Forwardslash, Quote] + Numberkeys.values + Numberpad.values +
    			 Numpad.values + Letters.values + Fkeys.values
       # Skip If Key Disabled
       next if @disabled_keys.include?(key)
       # Add Key to Triggered Array if Triggered
       @keys.push(key)	if self.testkey(key)
       # Add Key to Pressed Array if Pressed
       @pressed.push(key) if self.getstate(key)
     end
     # Add Lock Key If Capslock
     @lock.push(Keyboard::Capslock) if Keyboard.testlock(Keyboard::Capslock)
     # Update Text Window Text If Text Window Present
     self.update_text if @text_window != nil && @text_window.active
      end
      #--------------------------------------------------------------------------
      # * Update Text
      #--------------------------------------------------------------------------
      def self.update_text
     # Return if Nil Text Window
     return if @text_window.nil?
     # Gets Text Window Text
     text = @text_window.text.dup
     # Backspace Pressed
     text = text.chop if self.trigger?(Back)
     # If Text Size is Less Than Text Max
     if text.size < @text_max
       # Pass Through Triggered Array
       (@keys + @pressed).each do |key|
    	 # If TR has Key
    	 if TR.has_key?(key)
    	   # If Delay Has Key
    	   if @delay.has_key?(key)
    		 # Subtract Delay Count and Return (if greater than 0)
    		 if @delay[key] > 0
    		   @delay[key] -= 1
    		   next
    		 end
    	   end
    	   # Skip if TR Key Disabled
    	   next if @disabled_tr.include?(key)
    	   # If Shiftcase
    	   if ( self.lock?(Capslock) && !self.pressed?(Shift)) || 
    		  (!self.lock?(Capslock) &&  self.pressed?(Shift))
    		 text += TR[key][1] unless key==Enter
    	   # If Regular Case
    	   else
    		 text += TR[key][0] unless key==Enter
    	   end
    	   # Start Delay Count
    	   @delay[key] = 6
    	 end
       end
     end
     # Sets Text Window Text
     @text_window.text = text
      end
      #--------------------------------------------------------------------------
      # * Read Disabled TR
      #--------------------------------------------------------------------------
      def self.disabled_tr
     return disabled_tr
      end
      #--------------------------------------------------------------------------
      # * Set Disabled TR
      #--------------------------------------------------------------------------
      def self.disabled_tr=(disabled_tr)
     @disabled_tr = disabled_tr
      end
      #--------------------------------------------------------------------------
      # * Read Text Window
      #--------------------------------------------------------------------------
      def self.text_window
     return @text_window
      end
      #--------------------------------------------------------------------------
      # * Set Text Window
      #--------------------------------------------------------------------------
      def self.text_window=(text_window)
     @text_window = text_window
      end
      #--------------------------------------------------------------------------
      # * Read Text Max
      #--------------------------------------------------------------------------
      def self.text_max
     return text_max
      end
      #--------------------------------------------------------------------------
      # * Set Text Max
      #--------------------------------------------------------------------------
      def self.text_max=(text_max)
     @text_max = text_max
      end
      #------------------------------------------------------------------------
      # * Disable Key
      #------------------------------------------------------------------------
      def self.disable_key(constant, frames = nil)
     # Add Key to Disabled List
     @disabled_keys << constant unless @disabled_keys.include?(constant)
     # Set Disabled Counter if non-nil
     @disabled_timer[constant] = frames unless frames.nil?
      end
      #------------------------------------------------------------------------
      # * Enable Key
      #------------------------------------------------------------------------
      def self.enable_key(constant)
     # Remove Constant From List
     @disabled_keys.delete(constant)
     # Set Nil Timer
     @disabled_timer[constant] = nil
      end
    end
    
    #==============================================================================
    # ** Input
    #==============================================================================
    
    module Input
      class << self
     #------------------------------------------------------------------------
     # * Alias Listings
     #------------------------------------------------------------------------
     unless self.method_defined?(:seph_keyboard_input_update)
       alias_method :seph_keyboard_input_update,   :update
     end
     #------------------------------------------------------------------------
     # * Frame Update
     #------------------------------------------------------------------------
     def update
       # Original Update
       seph_keyboard_input_update
       # Update Keyboard
       Keyboard.update
     end
      end
    end

     

     

     

    Bugs e Conflitti Noti

    N/A

     

     

    Se avete dei problemi io sono qui.

  11. Se invece vuoi usare tutti i tasti possibili usa questo script, va messo in cima a tutto sopra Game_Temp, per capirsi:

     

    #============================================================================== 
    # ** Modules.Keyboard Input (6.1)							By Near Fantastica
    #									   Additions By Wachunaga & SephirothSpawn
    #------------------------------------------------------------------------------
    # * Description :
    #
    #   The Keyboard Input Module is designed to function as the default Input 
    #   module does. It is better then other methods keyboard input because as a 
    #   key is tested it is not removed form the list. so you can test the same 
    #   key multiple times the same loop. This script automatically updates itself
    #   with the input module.
    #------------------------------------------------------------------------------
    # * Syntax :
    #
    #   Test if Key is Triggered :
    #	- if Keyboard.trigger?(Keyboard::<Keyboard_constant>)
    #
    #   Test if Key is Pressed :
    #	- if Keyboard.pressed?(Keyboard::<Keyboard_constant>)
    #==============================================================================
    
    #MACL::Loaded << 'Modules.Keyboard Module'
     
    #==============================================================================
    # ** Keyboard
    #==============================================================================
    
    module Keyboard
     #--------------------------------------------------------------------------
     # * Constants (These Are Your Keyboard Keys)
     #--------------------------------------------------------------------------
     Mouse_Left	  = 1	  ; Mouse_Right	 = 2
     Back			= 8	  ; Tab			 = 9
     Enter		   = 13	 ; Shift		   = 16
     Ctrl			= 17	 ; Alt			 = 18
     Capslock		= 20	 ; Esc			 = 27
     Space		   = 32	 ; End			 = 35
     Home			= 36	 ; Left			= 37
     Right		   = 39
     Del			 = 46	 ; Collon		  = 186
     Equal		   = 187	; Comma		   = 188
     Underscore	  = 189	; Dot			 = 190
     Backslash	   = 191	; Tilde		   = 192
     Lb			  = 219	; Rb			  = 221
     Forwardslash	= 220	; Quote		   = 222
     Numberkeys	  = {}	 ; Numberkeys[0]   = 48
     Numberkeys[1]   = 49	 ; Numberkeys[2]   = 50
     Numberkeys[3]   = 51	 ; Numberkeys[4]   = 52
     Numberkeys[5]   = 53	 ; Numberkeys[6]   = 54
     Numberkeys[7]   = 55	 ; Numberkeys[8]   = 56
     Numberkeys[9]   = 57
     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
     Numpad = {}			  ; Numpad[0] = 96
     Numpad[1] = 97		   ; Numpad[2] = 98
     Numpad[3] = 99		   ; Numpad[4] = 100
     Numpad[5] = 101		  ; Numpad[6] = 102
     Numpad[7] = 103		  ; Numpad[8] = 104
     Numpad[9] = 105
     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
     #--------------------------------------------------------------------------
     # * Text Representation
     #--------------------------------------------------------------------------
     TR = {}
     TR[Tab]		   = ['	 ', '	 ']
     TR[Enter]		 = ['/n', '/n']
     TR[Collon]		= [';', ':']
     TR[Equal]		 = ['=', '+']
     TR[Comma]		 = [',', '<']
     TR[Underscore]	= ['-', '_']
     TR[Dot]		   = ['.', '>']
     TR[Backslash]	 = ['/', '?']
     TR[Tilde]		 = ['`', '~']
     TR[Forwardslash]  = ["\\", "|"]
     TR[Quote]		 = ["'", '"']
     TR[Numberkeys[0]] = ['0', ')']
     TR[Numberkeys[1]] = ['1', '!']
     TR[Numberkeys[2]] = ['2', '@']
     TR[Numberkeys[3]] = ['3', '#']
     TR[Numberkeys[4]] = ['4', '$']
     TR[Numberkeys[5]] = ['5', '^%']
     TR[Numberkeys[6]] = ['6', '^']
     TR[Numberkeys[7]] = ['7', '&']
     TR[Numberkeys[8]] = ['8', '*']
     TR[Numberkeys[9]] = ['9', '(']
     Letters.values.each do |key|
    TR[key] = [key.chr.downcase, key.chr.upcase]
     end
     #--------------------------------------------------------------------------
     # * API Declaration
     #--------------------------------------------------------------------------
     State   = Win32API.new('user32','GetKeyState',	  ['i'],'i')
     Key	 = Win32API.new('user32','GetAsyncKeyState', ['i'],'i')
     #--------------------------------------------------------------------------
     # * Clear Key & Pressed
     #--------------------------------------------------------------------------
     @keys = []; @pressed = []; @lock = []
     @disabled_keys = []; @disabled_timer = {}
     @delay = {}; @disabled_tr = []; @text_window = nil; @text_max = 10
     #--------------------------------------------------------------------------
     # * Get Key State (Test Pressed)
     #--------------------------------------------------------------------------
     def self.getstate(key)
    return !State.call(key).between?(0, 1)
     end
     #--------------------------------------------------------------------------
     # * Test Key (Test Trigger)
     #--------------------------------------------------------------------------
     def self.testkey(key)
    return Key.call(key) & 0x01 == 1
     end
     #--------------------------------------------------------------------------
     # * Test Lock (Test Trigger)
     #--------------------------------------------------------------------------
     def self.testlock(key)
    return State.call(key) & 0x01 == 1
     end
     #--------------------------------------------------------------------------
     # * Trigger? Test
     #--------------------------------------------------------------------------
     def self.trigger?(key)
    return @keys.include?(key)
     end
     #--------------------------------------------------------------------------
     # * Pressed? Test
     #--------------------------------------------------------------------------
     def self.pressed?(key)
    return @pressed.include?(key)
     end
     #--------------------------------------------------------------------------
     def self.lock?(key)
    return @lock.include?(key)
     end
     #--------------------------------------------------------------------------
     # * Update
     #--------------------------------------------------------------------------
     def self.update
    # Clears Keys & Pressed
    @keys, @pressed, @lock = [], [], []
    # Pass Through Timer List
    @disabled_timer.each do |key, timer|
      # Next if nil timer or key not-disabled
      next if timer.nil? || !@disabled_keys.include?(key)
      # If Greater than 0 Timer
      if timer > 0
    	timer -= 1
    	next
      end
      # Enable Key
      @disabled_keys.delete(key) if @disabled_keys.include?(key)
      # Set Timer to Nil
      @disabled_timer[key] = nil
    end
    # Test All Keys
    for key in [Mouse_Left, Mouse_Right, Back, Tab, Enter, Shift, Ctrl, Alt,
    			Capslock, Esc, Space, End, Home, Left, Right, Del, Collon, 
    			Equal, Comma, Underscore, Dot, Backslash, Tilde, Lb, Rb, 
    			Forwardslash, Quote] + Numberkeys.values + Numberpad.values +
    			Numpad.values + Letters.values + Fkeys.values
      # Skip If Key Disabled
      next if @disabled_keys.include?(key)
      # Add Key to Triggered Array if Triggered
      @keys.push(key)	if self.testkey(key)
      # Add Key to Pressed Array if Pressed
      @pressed.push(key) if self.getstate(key)
    end
    # Add Lock Key If Capslock
    @lock.push(Keyboard::Capslock) if Keyboard.testlock(Keyboard::Capslock)
    # Update Text Window Text If Text Window Present
    self.update_text if @text_window != nil && @text_window.active
     end
     #--------------------------------------------------------------------------
     # * Update Text
     #--------------------------------------------------------------------------
     def self.update_text
    # Return if Nil Text Window
    return if @text_window.nil?
    # Gets Text Window Text
    text = @text_window.text.dup
    # Backspace Pressed
    text = text.chop if self.trigger?(Back)
    # If Text Size is Less Than Text Max
    if text.size < @text_max
      # Pass Through Triggered Array
      (@keys + @pressed).each do |key|
    	# If TR has Key
    	if TR.has_key?(key)
    	  # If Delay Has Key
    	  if @delay.has_key?(key)
    		# Subtract Delay Count and Return (if greater than 0)
    		if @delay[key] > 0
    		  @delay[key] -= 1
    		  next
    		end
    	  end
    	  # Skip if TR Key Disabled
    	  next if @disabled_tr.include?(key)
    	  # If Shiftcase
    	  if ( self.lock?(Capslock) && !self.pressed?(Shift)) || 
    		 (!self.lock?(Capslock) &&  self.pressed?(Shift))
    		text += TR[key][1] unless key==Enter
    	  # If Regular Case
    	  else
    		text += TR[key][0] unless key==Enter
    	  end
    	  # Start Delay Count
    	  @delay[key] = 6
    	end
      end
    end
    # Sets Text Window Text
    @text_window.text = text
     end
     #--------------------------------------------------------------------------
     # * Read Disabled TR
     #--------------------------------------------------------------------------
     def self.disabled_tr
    return disabled_tr
     end
     #--------------------------------------------------------------------------
     # * Set Disabled TR
     #--------------------------------------------------------------------------
     def self.disabled_tr=(disabled_tr)
    @disabled_tr = disabled_tr
     end
     #--------------------------------------------------------------------------
     # * Read Text Window
     #--------------------------------------------------------------------------
     def self.text_window
    return @text_window
     end
     #--------------------------------------------------------------------------
     # * Set Text Window
     #--------------------------------------------------------------------------
     def self.text_window=(text_window)
    @text_window = text_window
     end
     #--------------------------------------------------------------------------
     # * Read Text Max
     #--------------------------------------------------------------------------
     def self.text_max
    return text_max
     end
     #--------------------------------------------------------------------------
     # * Set Text Max
     #--------------------------------------------------------------------------
     def self.text_max=(text_max)
    @text_max = text_max
     end
     #------------------------------------------------------------------------
     # * Disable Key
     #------------------------------------------------------------------------
     def self.disable_key(constant, frames = nil)
    # Add Key to Disabled List
    @disabled_keys << constant unless @disabled_keys.include?(constant)
    # Set Disabled Counter if non-nil
    @disabled_timer[constant] = frames unless frames.nil?
     end
     #------------------------------------------------------------------------
     # * Enable Key
     #------------------------------------------------------------------------
     def self.enable_key(constant)
    # Remove Constant From List
    @disabled_keys.delete(constant)
    # Set Nil Timer
    @disabled_timer[constant] = nil
     end
    end
    
    #==============================================================================
    # ** Input
    #==============================================================================
    
    module Input
     class << self
    #------------------------------------------------------------------------
    # * Alias Listings
    #------------------------------------------------------------------------
    unless self.method_defined?(:seph_keyboard_input_update)
      alias_method :seph_keyboard_input_update,   :update
    end
    #------------------------------------------------------------------------
    # * Frame Update
    #------------------------------------------------------------------------
    def update
      # Original Update
      seph_keyboard_input_update
      # Update Keyboard
      Keyboard.update
    end
     end
    end

     

    Puoi usare il metodo di Tio o farlo completamente a script, se ti interessa di dico come.

    Comunque questo di sopra funziona così:

    if Keyboard.trigger?(Keyboard::Costante)

    Dove Costante è una di quelle scritte in cima nel tuo caso sarebbe:

    if Keyboard.trigger?(Keyboard::Letters['M'])
    $scene = Scene_bo.new
    end

×
×
  • Create New...