Jump to content
Rpg²S Forum

Inserisci nome con la tastiera


Lusianl
 Share

Recommended Posts

Inserisci nome con la tastiera

 

Descrizione

Fa le stesse cose dell'inserisci nome normale, solamente con la differenza che si può scriverlo con la testiera.

 

Screen

http://img12.imageshack.us/img12/2397/semttulogbi.png

 

Script

 

 

################################################################################
# Inserir nome do herói com o teclado Ace                                      #
################################################################################
#--------------------------------Créditos--------------------------------------#
################################################################################
# Por: Lasso.                                                                  #
################################################################################
#-----------------------------Características----------------------------------#
################################################################################
# Tem as mesmas funções do "Inserir nome do herói", porém usa o teclado.       #
################################################################################
#--------------------------------Intruções-------------------------------------#
################################################################################
# Coloque acima de Main.                                                       #
#                                                                              #
# Vá à 3ª aba dos comandos do evento, cloque "Chamar Script" e chame isso      #
# change_name(id, caracteres)                                                  #
# sendo id o id do personagem e caracteres o numero de caracteres              #
# nao tem limite pro numero de caracteres                                      #
################################################################################
$nome_id = 0
$nome_n = 0
module Keys
  @getAsyncKeyState = Win32API.new('user32', 'GetAsyncKeyState', 'i', 'i')
  @last_array = Array.new(256, false)
  @trigger = Array.new(256, false)
  @press = Array.new(256, false)
  def self.update
    @trigger = Array.new(256, false)
    @press = Array.new(256, false)
    for i in 0..255
      @press[i] = (@getAsyncKeyState.call(i) == 0)? false : true
      if @last_array[i] == false and @press[i] == true
        @trigger[i] = true
      end
    end
    @last_array = @press
  end
  def self.trigger?(i)
    return @trigger[i]
  end
  def self.press?(i)
    return @press[i]
  end
end
module Input
  class << self
    alias keys_update update
  end
  def self.update
    self.keys_update
    Keys.update
  end
end
class Window_Name < Window_Base
  attr_reader   :name
  attr_reader   :index
  attr_reader   :max_char
  def initialize(actor_id, max_char)
    super(0, 0, 544, 128)
    @actor = $game_actors[actor_id]
    @name = @actor.name
    @max_char = max_char
    @default_name = @name
    @index = @name.size
    self.active = false
    refresh
    update_cursor
  end
  def restore_default
    @name = @default_name
    @index = @name.size
    refresh
    update_cursor
  end
  def add(character)
    if @index < @max_char and character != ''
      @name += character
      @index += 1
      refresh
      update_cursor
    end
  end
  def back
    if @index > 0
      name_array = @name.split(//)
      @name = ""
      for i in 0...name_array.size-1
        @name += name_array[i]
      end
      @index -= 1
      refresh
      update_cursor
    end
  end
  def item_rect(index)
    rect = Rect.new(0, 0, 0, 0)
    rect.x = 220 - (@max_char + 1) * 12 + index * 24
    rect.y = 36
    rect.width = 24
    rect.height = line_height
    return rect
  end
  def refresh
    self.contents.clear
    draw_actor_face(@actor, 0, 0)
    name_array = @name.split(//)
    for i in 0...@max_char
      c = name_array[i]
      c = '_' if c == nil
      self.contents.draw_text(item_rect(i), c, 1)
    end
  end
  def update_cursor
    self.cursor_rect = item_rect(@index)
  end
  def update
    super
    update_cursor
  end
end
class Scene_NameInput < Scene_MenuBase
  CHARACTERS = [[65,'a'],[66,'b'],[67,'c'],[68,'d'],[69,'e'],[70,'f'],[71,'g'],[72,'h'],[73,'i'],[74,'j'],[75,'k'],[76,'l'],[77,'m'],[78,'n'],[79,'o'],[80,'p'],[81,'q'],[82,'r'],[83,'s'],[84,'t'],[85,'u'],[86,'v'],[87,'w'],[88,'x'],[89,'y'],[90,'z'],[48,'0'],[49,'1'],[50,'2'],[51,'3'],[52,'4'],[53,'5'],[54,'6'],[55,'7'],[56,'8'],[57,'9'],[32,' '],[96,'0'],[97,'1'],[98,'2'],[99,'3'],[100,'4'],[101,'5'],[102,'6'],[103,'7'],[104,'8'],[105,'9']]
  ENTER = 13
  BACKSPACE = 8
  LEFT_SHIFT = 160
  RIGHT_SHIFT = 161
  def start
    super
    @actor = $game_actors[$nome_id]
    @edit_window = Window_Name.new($nome_id, $nome_n)
  end
  def terminate
    super
    @edit_window.dispose
  end
  def update
    super
    @edit_window.update
    if Keys.trigger?(BACKSPACE)
      if @edit_window.index > 0
        @edit_window.back
      end
    elsif Keys.trigger?(ENTER)
      if @edit_window.name == ''
        @edit_window.restore_default
      else
        @actor.name = @edit_window.name
        return_scene
      end
    end
    for i in CHARACTERS
      if Keys.trigger?(i[0])
       unless @edit_window.index == @edit_window.max_char
          case shift?
          when true
            @edit_window.add(i[1].upcase)
          when false
            @edit_window.add(i[1])
          end
        end
      end
    end
  end
  def shift?
    return (Keys.press?(LEFT_SHIFT) or Keys.press?(RIGHT_SHIFT))
  end
end
def change_name(id,characters)
  $nome_id = id
  $nome_n = characters
  SceneManager.call(Scene_NameInput)
end

 

 

 

Per chiamare lo script:

change_name(id, caracteres)

http://www.freankexpo.net/signature/1129.png

2986.png

BIM_Banner3.png

Premi RpgMaker

 


http://www.rpg2s.net/forum/uploads/monthly_01_2017/msg-293-0-48316500-1483794996.jpghttp://www.rpg2s.net/dax_games/r2s_regali2.pngContesthttp://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gifhttp://rpg2s.net/gif/SCContest2Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gifhttp://rpg2s.net/gif/SCContest2Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gifhttp://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest2Oct.gif http://rpg2s.net/gif/SCContest1Oct.gif http://rpg2s.net/gif/SCContest2Oct.gif http://rpg2s.net/gif/SCContest2Oct.gifhttp://rpg2s.net/gif/SCContest1Oct.gifhttp://www.rpg2s.net/awards/bestpixel2.jpghttp://www.rpg2s.net/awards/bestresourCSist2.jpghttp://www.rpg2s.net/awards/mostproductive1.jpghttp://i42.servimg.com/u/f42/13/12/87/37/iconap13.pnghttp://i42.servimg.com/u/f42/13/12/87/37/iconap14.pnghttp://i42.servimg.com/u/f42/13/12/87/37/iconap15.pnghttp://i42.servimg.com/u/f42/13/12/87/37/iconap16.pnghttp://i42.servimg.com/u/f42/13/12/87/37/screen10.pnghttp://www.rpgmkr.net/contest/screen-contest-primo.pnghttp://www.makerando.com/forum/uploads/jawards/iconawards3.png

Link to comment
Share on other sites

Comodo! XD

 

Già che c'era poteva renderla disponibile per tutto! XD

^ ^

(\_/)
(^ ^) <----coniglietto rosso, me!
(> <)


Il mio Tumblr dove seguire i miei progetti, i progetti della Reverie : : Project ^ ^

http://i.imgur.com/KdUDtQt.png disponibile su Google Play, qui i dettagli! ^ ^

http://i.imgur.com/FwnGMI3.png completo! Giocabile online, qui i dettagli! ^ ^

REVERIE : : RENDEZVOUS (In allenamento per apprendere le buone arti prima di cominciarlo per bene ^ ^) Trovate i dettagli qui insieme alla mia intervista (non utilizzerò più rpgmaker) ^ ^

 

SUWOnzB.jpg 🖤
http://www.rpg2s.net/dax_games/r2s_regali2s.png E:3 http://www.rpg2s.net/dax_games/xmas/gifnatale123.gif
http://i.imgur.com/FfvHCGG.png by Testament (notare dettaglio in basso a destra)! E:3
http://i.imgur.com/MpaUphY.jpg by Idriu E:3

Membro Onorario, Ambasciatore dei Coniglietti (Membro n.44)

http://i.imgur.com/PgUqHPm.png
Ufficiale
"Ad opera della sua onestà e del suo completo appoggio alla causa dei Panda, Guardian Of Irael viene ufficialmente considerato un Membro portante del Partito, e Ambasciatore del suo Popolo presso di noi"


http://i.imgur.com/TbRr4iS.png<- Grazie Testament E:3
Ricorda...se rivolgi il tuo sguardo ^ ^ a Guardian anche Guardian volge il suo sguardo ^ ^ a te ^ ^
http://i.imgur.com/u8UJ4Vm.gifby Flame ^ ^
http://i.imgur.com/VbggEKS.gifhttp://i.imgur.com/2tJmjFJ.gifhttp://projectste.altervista.org/Our_Hero_adotta/ado2.png
Grazie Testament XD Fan n°1 ufficiale di PQ! :D

Viva
il Rhaxen! <- Folletto te lo avevo detto (fa pure rima) che non
avevo programmi di grafica per fare un banner su questo pc XD (ora ho di
nuovo il mio PC veramente :D)

Rosso Guardiano della
http://i.imgur.com/Os5rvhx.png

Rpg2s RPG BY FORUM:

Nome: Darth Reveal

 

PV totali 2
PA totali 16

Descrizione: ragazzo dai lunghi capelli rossi ed occhi dello stesso colore. Indossa una elegante giacca rossa sopra ad una maglietta nera. Porta pantaloni rossi larghi, una cintura nera e degli stivali dello stesso colore. E' solito trasportare lo spadone dietro la schiena in un fodero apposito. Ha un pendente al collo e tiene ben legato un pezzo di stoffa (che gli sta particolarmente a cuore) intorno al braccio sinistro sotto la giacca, copre una cicatrice.
Bozze vesti non definitive qui.

Equipaggiamento:
Indossa:
60$ e 59$ divisi in due tasche interne
Levaitan

Spada a due mani elsa lunga

Guanti del Defender (2PA)
Anello del linguaggio animale (diventato del Richiamo)

Scrinieri da lanciere (2 PA)

Elmo del Leone (5 PA)

Corazza del Leone in Ferro Corrazzato (7 PA)

ZAINO (20) contenente:
Portamonete in pelle di cinghiale contenente: 100$
Scatola Sanitaria Sigillata (può contenere e tenere al sicuro fino a 4 oggetti curativi) (contiene Benda di pronto soccorso x3, Pozione di cura)
Corda
Bottiglia di idromele
Forma di formaggio
Torcia (serve ad illuminare, dura tre settori)

Fiasca di ceramica con Giglio Amaro (Dona +1PN e Velocità all'utilizzatore)
Ampolla Bianca

Semi di Balissa

 

CAVALLO NORMALE + SELLA (30 +2 armi) contentente:
66$
Benda di pronto soccorso x3
Spada a due mani

Fagotto per Adara (fazzoletto ricamato)


 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...